Skip to content

Commit

Permalink
test: add tearDown() and tweak setUp()
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Oct 26, 2023
1 parent 469eef4 commit f42244f
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/system/Config/BaseConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -284,9 +293,6 @@ public function testDiscoveryNotEnabledWillNotPopulateRegistrarsArray(): void
$config = new RegistrarConfig();

$this->assertSame([], $config::$registrars);

// Reset Modules Config.
RegistrarConfig::setModules(new Modules());
}

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

$this->assertTrue($this->getPrivateProperty($config, 'didDiscovery'));

// Reset locator.
$this->resetServices();
}
}

0 comments on commit f42244f

Please sign in to comment.