Skip to content

Commit f42244f

Browse files
committed
test: add tearDown() and tweak setUp()
1 parent 469eef4 commit f42244f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

tests/system/Config/BaseConfigTest.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,17 @@ protected function setUp(): void
4949
require $this->fixturesFolder . '/Encryption.php';
5050
}
5151

52-
BaseConfig::$registrars = [];
53-
BaseConfig::setModules(new Modules()); // reset to clean copy of Modules
52+
BaseConfig::reset();
53+
}
54+
55+
protected function tearDown(): void
56+
{
57+
parent::tearDown();
58+
59+
// This test modifies BaseConfig::$modules, so should reset.
60+
BaseConfig::reset();
61+
// This test modifies Services locator, so should reset.
62+
$this->resetServices();
5463
}
5564

5665
public function testBasicValues(): void
@@ -284,9 +293,6 @@ public function testDiscoveryNotEnabledWillNotPopulateRegistrarsArray(): void
284293
$config = new RegistrarConfig();
285294

286295
$this->assertSame([], $config::$registrars);
287-
288-
// Reset Modules Config.
289-
RegistrarConfig::setModules(new Modules());
290296
}
291297

292298
/**
@@ -304,8 +310,5 @@ public function testRedoingDiscoveryWillStillSetDidDiscoveryPropertyToTrue(): vo
304310
$config = new RegistrarConfig();
305311

306312
$this->assertTrue($this->getPrivateProperty($config, 'didDiscovery'));
307-
308-
// Reset locator.
309-
$this->resetServices();
310313
}
311314
}

0 commit comments

Comments
 (0)