From f42244fc64a93581cf6e9b90e35e2751378deaa4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 26 Oct 2023 14:43:52 +0900 Subject: [PATCH] test: add tearDown() and tweak setUp() --- tests/system/Config/BaseConfigTest.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/system/Config/BaseConfigTest.php b/tests/system/Config/BaseConfigTest.php index 94d60577e44a..7c05af3a390e 100644 --- a/tests/system/Config/BaseConfigTest.php +++ b/tests/system/Config/BaseConfigTest.php @@ -49,8 +49,17 @@ protected function setUp(): void require $this->fixturesFolder . '/Encryption.php'; } - BaseConfig::$registrars = []; - BaseConfig::setModules(new Modules()); // reset to clean copy of Modules + BaseConfig::reset(); + } + + protected function tearDown(): void + { + parent::tearDown(); + + // This test modifies BaseConfig::$modules, so should reset. + BaseConfig::reset(); + // This test modifies Services locator, so should reset. + $this->resetServices(); } public function testBasicValues(): void @@ -284,9 +293,6 @@ public function testDiscoveryNotEnabledWillNotPopulateRegistrarsArray(): void $config = new RegistrarConfig(); $this->assertSame([], $config::$registrars); - - // Reset Modules Config. - RegistrarConfig::setModules(new Modules()); } /** @@ -304,8 +310,5 @@ public function testRedoingDiscoveryWillStillSetDidDiscoveryPropertyToTrue(): vo $config = new RegistrarConfig(); $this->assertTrue($this->getPrivateProperty($config, 'didDiscovery')); - - // Reset locator. - $this->resetServices(); } }