|
13 | 13 |
|
14 | 14 | namespace CodeIgniter\Config; |
15 | 15 |
|
| 16 | +use AfterAutoloadModule\Test; |
16 | 17 | use CodeIgniter\Autoloader\Autoloader; |
17 | 18 | use CodeIgniter\Autoloader\FileLocator; |
18 | 19 | use CodeIgniter\Database\MigrationRunner; |
@@ -350,6 +351,26 @@ public function testResetSingleCaseInsensitive(): void |
350 | 351 | $this->assertNotInstanceOf(MockResponse::class, $someService); |
351 | 352 | } |
352 | 353 |
|
| 354 | + #[PreserveGlobalState(false)] |
| 355 | + #[RunInSeparateProcess] |
| 356 | + public function testUpdateServiceCache(): void |
| 357 | + { |
| 358 | + Services::injectMock('response', new MockResponse(new App())); |
| 359 | + $someService = service('response'); |
| 360 | + $this->assertInstanceOf(MockResponse::class, $someService); |
| 361 | + service('response')->setStatusCode(200); |
| 362 | + |
| 363 | + Services::autoloader()->addNamespace('AfterAutoloadModule', TESTPATH . '_support/Test/AfterAutoloadModule/'); |
| 364 | + Services::updateServicesCache(); |
| 365 | + |
| 366 | + $someService = service('response'); |
| 367 | + $this->assertInstanceOf(MockResponse::class, $someService); |
| 368 | + $this->assertSame(200, $someService->getStatusCode()); |
| 369 | + |
| 370 | + $someService = service('test'); |
| 371 | + $this->assertInstanceOf(Test::class, $someService); |
| 372 | + } |
| 373 | + |
353 | 374 | public function testFilters(): void |
354 | 375 | { |
355 | 376 | $result = Services::filters(); |
|
0 commit comments