Allow empty config filename (= default)
This commit is contained in:
parent
2a31951217
commit
e4f061e6c3
2 changed files with 11 additions and 1 deletions
|
@ -141,7 +141,7 @@ class Config
|
||||||
if (is_null(self::$instance) || self::$instance->file != $yamlfile) {
|
if (is_null(self::$instance) || self::$instance->file != $yamlfile) {
|
||||||
if (is_file($yamlfile)) {
|
if (is_file($yamlfile)) {
|
||||||
$options = Yaml::parse(file_get_contents($yamlPath));
|
$options = Yaml::parse(file_get_contents($yamlPath));
|
||||||
} elseif ($yamlfile == 'config.yml') {
|
} elseif ($yamlfile == 'config.yml' || empty($yamlfile)) {
|
||||||
/*
|
/*
|
||||||
Allow for the default file to be missing in order to
|
Allow for the default file to be missing in order to
|
||||||
not surprise users that did not create a config file
|
not surprise users that did not create a config file
|
||||||
|
|
|
@ -64,6 +64,16 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||||
Config::getInstance('foo');
|
Config::getInstance('foo');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the getInstance function with aen empty filename.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testGetInstanceWithEmptyFile()
|
||||||
|
{
|
||||||
|
$config = Config::getInstance('');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the getInstance function with the CONVERT and PYTHON environment variables.
|
* Test the getInstance function with the CONVERT and PYTHON environment variables.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue