diff --git a/system/Config/BaseService.php b/system/Config/BaseService.php index 38bac37fdaa9..572b6cf576bd 100644 --- a/system/Config/BaseService.php +++ b/system/Config/BaseService.php @@ -288,6 +288,7 @@ public static function reset(bool $initAutoloader = false) */ public static function resetSingle(string $name) { + $name = strtolower($name); unset(static::$mocks[$name], static::$instances[$name]); } diff --git a/tests/system/Config/ServicesTest.php b/tests/system/Config/ServicesTest.php index 7fed04f53aa3..5f8cc476ae88 100644 --- a/tests/system/Config/ServicesTest.php +++ b/tests/system/Config/ServicesTest.php @@ -343,6 +343,17 @@ public function testResetSingle() $this->assertSame($security, $security2); } + public function testResetSingleCaseInsensitive() + { + Services::injectMock('response', new MockResponse(new App())); + $someService = service('response'); + $this->assertInstanceOf(MockResponse::class, $someService); + + Services::resetSingle('Response'); + $someService = service('response'); + $this->assertNotInstanceOf(MockResponse::class, $someService); + } + public function testFilters() { $result = Services::filters();