Use separate config file for tests

This commit is contained in:
Pierre Rudloff 2016-08-19 01:07:51 +02:00
parent 78787512ab
commit 1400f3e86a
3 changed files with 28 additions and 12 deletions

View file

@ -65,12 +65,14 @@ class Config
*/
public $curl_params = array();
private $configFile;
/**
* Config constructor
*/
private function __construct()
private function __construct($yamlfile)
{
$yamlfile = __DIR__.'/../config.yml';
$this->file = $yamlfile;
if (is_file($yamlfile)) {
$yaml = Yaml::parse(file_get_contents($yamlfile));
if (isset($yaml) && is_array($yaml)) {
@ -91,10 +93,10 @@ class Config
*
* @return Config
*/
public static function getInstance()
public static function getInstance($yamlfile = __DIR__.'/../config.yml')
{
if (is_null(self::$instance)) {
self::$instance = new Config();
if (is_null(self::$instance) || self::$instance->file != $yamlfile) {
self::$instance = new Config($yamlfile);
}
return self::$instance;
}