diff --git a/classes/Config.php b/classes/Config.php index 1e8e9a1..e302bf7 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -135,7 +135,6 @@ class Config { $this->applyOptions($options); $this->getEnv(); - $this->validateOptions(); } /** @@ -216,6 +215,7 @@ class Config if (is_file($file)) { $options = Yaml::parse(file_get_contents($file)); self::$instance = new self($options); + self::$instance->validateOptions(); } else { throw new Exception("Can't find config file at ".$file); } diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index 6480521..7304ed0 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -41,6 +41,20 @@ class ConfigTest extends BaseTest $this->assertConfig($config); } + /** + * Test the getInstance function. + * + * @return void + */ + public function testGetInstanceFromScratch() + { + Config::destroyInstance(); + + $config = Config::getInstance(); + $this->assertEquals($config->convert, false); + $this->assertConfig($config); + } + /** * Assert that a Config object is correctly instantiated. *