diff --git a/tests/SettingsTest.php b/tests/SettingsTest.php index 00cbb64..93c33d7 100644 --- a/tests/SettingsTest.php +++ b/tests/SettingsTest.php @@ -35,7 +35,7 @@ class SettingsTest extends TestCase public function testLoad() { - $cfg = (new Settings())->appPath(dirname(__FILE__).'/')->load(); + $cfg = $this->load('cfg'); $this->assertNotEmpty($cfg); return $cfg; } @@ -48,6 +48,18 @@ class SettingsTest extends TestCase $this->assertEquals('test', $cfg->mode); } + public function testTestingOverride() + { + $cfg = $this->load('cfg/testingOverride'); + $this->assertEquals(42, $cfg->answer); + } + + public function testLocalOverride() + { + $cfg = $this->load('cfg/localOverride'); + $this->assertEquals(42, $cfg->answer); + } + public function testBuildFileName() { $path = './config/'; @@ -60,6 +72,11 @@ class SettingsTest extends TestCase $this->assertEquals($defaultName, $cfg->buildFileName()); } + + private function load(string $dir) + { + return (new Settings())->appPath(dirname(__FILE__)."/$dir/")->load(); + } } /* jEdit buffer local properties {{{ diff --git a/tests/config/default.conf.php b/tests/cfg/config/default.conf.php similarity index 100% rename from tests/config/default.conf.php rename to tests/cfg/config/default.conf.php diff --git a/tests/cfg/localOverride/config/conf.php b/tests/cfg/localOverride/config/conf.php new file mode 100644 index 0000000..20f0c6a --- /dev/null +++ b/tests/cfg/localOverride/config/conf.php @@ -0,0 +1,3 @@ + 42 +]; diff --git a/tests/cfg/localOverride/config/default.conf.php b/tests/cfg/localOverride/config/default.conf.php new file mode 100644 index 0000000..580d8cf --- /dev/null +++ b/tests/cfg/localOverride/config/default.conf.php @@ -0,0 +1,4 @@ + 'prod', + 'answer' => false +]; diff --git a/tests/cfg/localOverride/config/testing.conf.php b/tests/cfg/localOverride/config/testing.conf.php new file mode 100644 index 0000000..9a34e76 --- /dev/null +++ b/tests/cfg/localOverride/config/testing.conf.php @@ -0,0 +1,3 @@ + false +]; diff --git a/tests/cfg/testingOverride/config/conf.php b/tests/cfg/testingOverride/config/conf.php new file mode 100644 index 0000000..ded4c06 --- /dev/null +++ b/tests/cfg/testingOverride/config/conf.php @@ -0,0 +1,3 @@ + 'test' +]; diff --git a/tests/cfg/testingOverride/config/default.conf.php b/tests/cfg/testingOverride/config/default.conf.php new file mode 100644 index 0000000..580d8cf --- /dev/null +++ b/tests/cfg/testingOverride/config/default.conf.php @@ -0,0 +1,4 @@ + 'prod', + 'answer' => false +]; diff --git a/tests/cfg/testingOverride/config/testing.conf.php b/tests/cfg/testingOverride/config/testing.conf.php new file mode 100644 index 0000000..20f0c6a --- /dev/null +++ b/tests/cfg/testingOverride/config/testing.conf.php @@ -0,0 +1,3 @@ + 42 +];