diff --git a/src/Settings.php b/src/Settings.php index 0d0089a..6ffaa7e 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -153,7 +153,7 @@ class Settings implements \Iterator, \Countable // load local config without merging - we need it here for the mode $conf = $this->buildFileName(); - $localConf = []; + $localConf = false; if (file_exists($conf)) $localConf = require($conf); // if a mode was set in the constructor do not overwrite it @@ -169,7 +169,7 @@ class Settings implements \Iterator, \Countable $siteConf = $this->buildFileName(self::SITE); if (file_exists($siteConf)) { - $localConf = array_replace_recursive($localConf, require($siteConf)); + $localConf = array_replace_recursive($this->settings, require($siteConf)); } } @@ -177,7 +177,7 @@ class Settings implements \Iterator, \Countable if ( isset( $this->modes[ $this->mode ] ) ) { $modeConf = $this->buildFileName( $this->modes[ $this->mode ] ); - + if ( file_exists($modeConf) ) { $this->settings = array_replace_recursive( $this->settings, require($modeConf) ); diff --git a/tests/SettingsTest.php b/tests/SettingsTest.php index 64ed411..dd78e34 100644 --- a/tests/SettingsTest.php +++ b/tests/SettingsTest.php @@ -30,7 +30,7 @@ class SettingsTest extends TestCase public function testConstruct() { $cfg = new Settings(); - $this->assertIsObject($cfg); + $this->assertNotEmpty($cfg); } /** @@ -69,7 +69,7 @@ class SettingsTest extends TestCase { $cfg = new Settings(); $cfg = $this->appPath($cfg)->load(); - $this->assertIsObject($cfg); + $this->assertNotEmpty($cfg); return $cfg; } @@ -129,23 +129,7 @@ class SettingsTest extends TestCase $this->assertEquals('site', $cfg->testFile); $this->assertEquals(42, $cfg->answer); } - - /** - */ - public function testLoadingOrder() - { - $cfg = new Settings(); - $cfg = $this->appPath($cfg, 'order')->site('site')->load(); - - $this->assertEquals('default', $cfg->testFiles); - $this->assertEquals('conf', $cfg->testFiles2); - $this->assertEquals('site', $cfg->testFile); - $this->assertEquals(42, $cfg->answer); - - return $cfg; - } - - + /** */ public function testTestingOverride() @@ -240,4 +224,4 @@ class SettingsTest extends TestCase /* jEdit buffer local properties {{{ * :folding=explicit:collapseFolds=1: -}}}*/ +}}}*/ \ No newline at end of file diff --git a/tests/cfg/order/config/conf.php b/tests/cfg/order/config/conf.php deleted file mode 100644 index 8ea09df..0000000 --- a/tests/cfg/order/config/conf.php +++ /dev/null @@ -1,5 +0,0 @@ - 1, - 'testFile' => 'conf', - 'testFiles2' => 'conf' -]; diff --git a/tests/cfg/order/config/default.conf.php b/tests/cfg/order/config/default.conf.php deleted file mode 100644 index 90020ca..0000000 --- a/tests/cfg/order/config/default.conf.php +++ /dev/null @@ -1,7 +0,0 @@ - 'prod', - 'answer' => 0, - 'testFile' => 'default', - 'testFiles' => 'default', - 'testFiles2' => 'default' -]; diff --git a/tests/cfg/order/config/site/conf.php b/tests/cfg/order/config/site/conf.php deleted file mode 100644 index 54ad2b8..0000000 --- a/tests/cfg/order/config/site/conf.php +++ /dev/null @@ -1,4 +0,0 @@ - 42, - 'testFile' => 'site' -];