diff --git a/tests/SettingsTest.php b/tests/SettingsTest.php index 6c0a242..619d2f6 100644 --- a/tests/SettingsTest.php +++ b/tests/SettingsTest.php @@ -27,26 +27,24 @@ use PHPUnit\Framework\TestCase; class SettingsTest extends TestCase { - public function testConstruct() { $cfg = new Settings(); $this->assertNotEmpty($cfg); - return $cfg; } - + /** - * @depends testConstruct */ - public function testLoadNoFile(Settings $cfg) + public function testLoadNoFile() { + $cfg = new Settings(); $this->expectException(\ErrorException::class); $cfg->load(); } /** */ - private function appPath(Settings $cfg, ?string $dir='') + private function appPath(Settings $cfg, string $dir='') { if (isset($dir)) $dir .= '/'; @@ -57,10 +55,10 @@ class SettingsTest extends TestCase } /** - * @depends testConstruct */ - public function testLoad(Settings $cfg) + public function testLoad() { + $cfg = new Settings(); $cfg = $this->appPath($cfg)->load(); $this->assertNotEmpty($cfg); return $cfg; @@ -71,44 +69,49 @@ class SettingsTest extends TestCase */ public function testMode(Settings $cfg) { - $this->assertEquals('test', $cfg->mode); + $this->assertEquals('default', $cfg->testFiles); + $this->assertEquals('prod', $cfg->mode); } /** - * @depends testConstruct */ - public function testSiteOverride(Settings $cfg) + public function testSiteOverride() { + $cfg = new Settings(); $cfg = $this->appPath($cfg)->site('site')->load(); + + $this->assertEquals('default', $cfg->testFiles); $this->assertEquals(42, $cfg->answer); } /** - * @depends testConstruct */ - public function testTestingOverride(Settings $cfg) + public function testTestingOverride() { - $cfg = $this->appPath($cfg, 'testingOverride')->load(); + $cfg = new Settings(); + $cfg = $this->appPath($cfg, 'testing')->load(); + + $this->assertEquals('testing', $cfg->testFiles); $this->assertEquals(42, $cfg->answer); } /** - * @depends testConstruct */ - public function testLocalOverride(Settings $cfg) + public function testLocalOverride() { + $cfg = new Settings(); $cfg = $this->appPath($cfg, 'localOverride')->load(); $this->assertEquals(42, $cfg->answer); } /** - * @depends testConstruct * @dataProvider fileNameData */ - public function testBuildFileName(string $prefix, $type, string $site, string $expected, Settings $cfg) + public function testBuildFileName(string $prefix, $type, string $site, string $expected) { $path = './config/'; + $cfg = new Settings(); $cfg->appPath('./'); if ($prefix !== '') $cfg->prefix($prefix); if ($site !== '') diff --git a/tests/cfg/config/default.conf.php b/tests/cfg/config/default.conf.php index 6a760e4..ca5fae7 100644 --- a/tests/cfg/config/default.conf.php +++ b/tests/cfg/config/default.conf.php @@ -1,4 +1,5 @@ 'test', + 'mode' => 'prod', + 'testFiles' => 'default', 'answer' => false ]; diff --git a/tests/cfg/testingOverride/config/conf.php b/tests/cfg/testing/config/conf.php similarity index 100% rename from tests/cfg/testingOverride/config/conf.php rename to tests/cfg/testing/config/conf.php diff --git a/tests/cfg/testingOverride/config/default.conf.php b/tests/cfg/testing/config/default.conf.php similarity index 67% rename from tests/cfg/testingOverride/config/default.conf.php rename to tests/cfg/testing/config/default.conf.php index 580d8cf..5497456 100644 --- a/tests/cfg/testingOverride/config/default.conf.php +++ b/tests/cfg/testing/config/default.conf.php @@ -1,4 +1,5 @@ 'prod', + 'testFiles' => 'testing', 'answer' => false ]; diff --git a/tests/cfg/testingOverride/config/testing.conf.php b/tests/cfg/testing/config/testing.conf.php similarity index 100% rename from tests/cfg/testingOverride/config/testing.conf.php rename to tests/cfg/testing/config/testing.conf.php