2929 * so we need to make sure that the methods routed to
3030 * return correct responses.
3131 *
32- * @runTestsInSeparateProcesses
33- * @preserveGlobalState disabled
34- *
3532 * @internal
3633 */
3734final class ResourcePresenterTest extends CIUnitTestCase
@@ -48,7 +45,10 @@ protected function setUp(): void
4845 parent ::setUp ();
4946
5047 $ this ->resetServices ();
48+ }
5149
50+ private function createCodeigniter (): void
51+ {
5252 $ _SERVER ['SERVER_PROTOCOL ' ] = 'HTTP/1.1 ' ;
5353
5454 // Inject mock router.
@@ -80,6 +80,8 @@ public function testResourceGet()
8080 $ _SERVER ['REQUEST_URI ' ] = '/work ' ;
8181 $ _SERVER ['REQUEST_METHOD ' ] = 'GET ' ;
8282
83+ $ this ->createCodeigniter ();
84+
8385 ob_start ();
8486 $ this ->codeigniter ->useSafeOutput (true )->run ($ this ->routes );
8587 $ output = ob_get_clean ();
@@ -100,6 +102,8 @@ public function testResourceShow()
100102 $ _SERVER ['REQUEST_URI ' ] = '/work/show/1 ' ;
101103 $ _SERVER ['REQUEST_METHOD ' ] = 'GET ' ;
102104
105+ $ this ->createCodeigniter ();
106+
103107 ob_start ();
104108 $ this ->codeigniter ->useSafeOutput (true )->run ($ this ->routes );
105109 $ output = ob_get_clean ();
@@ -119,6 +123,8 @@ public function testResourceNew()
119123 $ _SERVER ['REQUEST_URI ' ] = '/work/new ' ;
120124 $ _SERVER ['REQUEST_METHOD ' ] = 'GET ' ;
121125
126+ $ this ->createCodeigniter ();
127+
122128 ob_start ();
123129 $ this ->codeigniter ->useSafeOutput (true )->run ($ this ->routes );
124130 $ output = ob_get_clean ();
@@ -138,6 +144,8 @@ public function testResourceCreate()
138144 $ _SERVER ['REQUEST_URI ' ] = '/work/create ' ;
139145 $ _SERVER ['REQUEST_METHOD ' ] = 'POST ' ;
140146
147+ $ this ->createCodeigniter ();
148+
141149 ob_start ();
142150 $ this ->codeigniter ->useSafeOutput (true )->run ($ this ->routes );
143151 $ output = ob_get_clean ();
@@ -158,6 +166,8 @@ public function testResourceRemove()
158166 $ _SERVER ['REQUEST_URI ' ] = '/work/remove/123 ' ;
159167 $ _SERVER ['REQUEST_METHOD ' ] = 'GET ' ;
160168
169+ $ this ->createCodeigniter ();
170+
161171 ob_start ();
162172 $ this ->codeigniter ->useSafeOutput (true )->run ($ this ->routes );
163173 $ output = ob_get_clean ();
@@ -178,6 +188,8 @@ public function testResourceDelete()
178188 $ _SERVER ['REQUEST_URI ' ] = '/work/delete/123 ' ;
179189 $ _SERVER ['REQUEST_METHOD ' ] = 'POST ' ;
180190
191+ $ this ->createCodeigniter ();
192+
181193 ob_start ();
182194 $ this ->codeigniter ->useSafeOutput (true )->run ($ this ->routes );
183195 $ output = ob_get_clean ();
@@ -199,6 +211,8 @@ public function testResourceEdit()
199211 $ _SERVER ['REQUEST_URI ' ] = '/work/edit/1 ' ;
200212 $ _SERVER ['REQUEST_METHOD ' ] = 'GET ' ;
201213
214+ $ this ->createCodeigniter ();
215+
202216 ob_start ();
203217 $ this ->codeigniter ->useSafeOutput (true )->run ($ this ->routes );
204218 $ output = ob_get_clean ();
@@ -219,6 +233,8 @@ public function testResourceUpdate()
219233 $ _SERVER ['REQUEST_URI ' ] = '/work/update/123 ' ;
220234 $ _SERVER ['REQUEST_METHOD ' ] = 'POST ' ;
221235
236+ $ this ->createCodeigniter ();
237+
222238 ob_start ();
223239 $ this ->codeigniter ->useSafeOutput (true )->run ($ this ->routes );
224240 $ output = ob_get_clean ();
0 commit comments