Skip to content

Commit 289ea7d

Browse files
committed
test: fix failed tests
1 parent 8a5932e commit 289ea7d

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

tests/system/RESTful/ResourceControllerTest.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
* so we need to make sure that the methods routed to
3636
* return correct responses.
3737
*
38-
* @runTestsInSeparateProcesses
39-
* @preserveGlobalState disabled
40-
*
4138
* @internal
4239
*/
4340
final class ResourceControllerTest extends CIUnitTestCase
@@ -54,7 +51,10 @@ protected function setUp(): void
5451
parent::setUp();
5552

5653
$this->resetServices();
54+
}
5755

56+
private function createCodeigniter(): void
57+
{
5858
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
5959

6060
// Inject mock router.
@@ -86,6 +86,8 @@ public function testResourceGet()
8686
$_SERVER['REQUEST_URI'] = '/work';
8787
$_SERVER['REQUEST_METHOD'] = 'GET';
8888

89+
$this->createCodeigniter();
90+
8991
ob_start();
9092
$this->codeigniter->useSafeOutput(true)->run($this->routes);
9193
$output = ob_get_clean();
@@ -105,6 +107,8 @@ public function testResourceGetNew()
105107
$_SERVER['REQUEST_URI'] = '/work/new';
106108
$_SERVER['REQUEST_METHOD'] = 'GET';
107109

110+
$this->createCodeigniter();
111+
108112
ob_start();
109113
$this->codeigniter->useSafeOutput(true)->run($this->routes);
110114
$output = ob_get_clean();
@@ -125,6 +129,8 @@ public function testResourceGetEdit()
125129
$_SERVER['REQUEST_URI'] = '/work/1/edit';
126130
$_SERVER['REQUEST_METHOD'] = 'GET';
127131

132+
$this->createCodeigniter();
133+
128134
ob_start();
129135
$this->codeigniter->useSafeOutput(true)->run($this->routes);
130136
$output = ob_get_clean();
@@ -144,6 +150,8 @@ public function testResourceGetOne()
144150
$_SERVER['REQUEST_URI'] = '/work/1';
145151
$_SERVER['REQUEST_METHOD'] = 'GET';
146152

153+
$this->createCodeigniter();
154+
147155
ob_start();
148156
$this->codeigniter->useSafeOutput(true)->run($this->routes);
149157
$output = ob_get_clean();
@@ -162,6 +170,8 @@ public function testResourcePost()
162170
$_SERVER['REQUEST_URI'] = '/work';
163171
$_SERVER['REQUEST_METHOD'] = 'POST';
164172

173+
$this->createCodeigniter();
174+
165175
ob_start();
166176
$this->codeigniter->useSafeOutput(true)->run($this->routes);
167177
$output = ob_get_clean();
@@ -181,6 +191,8 @@ public function testResourcePatch()
181191
$_SERVER['REQUEST_URI'] = '/work/123';
182192
$_SERVER['REQUEST_METHOD'] = 'PATCH';
183193

194+
$this->createCodeigniter();
195+
184196
ob_start();
185197
$this->codeigniter->useSafeOutput(true)->run($this->routes);
186198
$output = ob_get_clean();
@@ -200,6 +212,8 @@ public function testResourcePut()
200212
$_SERVER['REQUEST_URI'] = '/work/123';
201213
$_SERVER['REQUEST_METHOD'] = 'PUT';
202214

215+
$this->createCodeigniter();
216+
203217
ob_start();
204218
$this->codeigniter->useSafeOutput(true)->run($this->routes);
205219
$output = ob_get_clean();
@@ -219,6 +233,8 @@ public function testResourceDelete()
219233
$_SERVER['REQUEST_URI'] = '/work/123';
220234
$_SERVER['REQUEST_METHOD'] = 'DELETE';
221235

236+
$this->createCodeigniter();
237+
222238
ob_start();
223239
$this->codeigniter->useSafeOutput(true)->run($this->routes);
224240
$output = ob_get_clean();

0 commit comments

Comments
 (0)