Skip to content

Commit

Permalink
Fixed tests for import without filecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
maschmann committed Dec 17, 2015
1 parent 4a83551 commit 5b36a8d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function factory(array $param, $class = 'ConfigDefault')
return new $class($param);
} else {
throw new \ErrorException(
'Config::factory() - could not instantiate ' . $class . ' - not in self::$whitelist'
'Config::factory() - could not instantiate ' . $class
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Config/ConfigEnv.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private function mergeEnvironments($param)
$toMerge
);
} else {
$merged = $config->get($this->defaultEnv);
$merged = $config->get($this->defaultEnv, []);
}

$this->setByArray(
Expand Down
2 changes: 1 addition & 1 deletion Test/BaseConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function setUp()

$this->root = vfsStream::setup('configs');
$this->configFile = vfsStream::newFile('default.yml')->at($this->root);
$this->configFile->setContent(TestData::getYamlConfigFile());
$this->configFile->setContent(TestData::getYamlImportConfigFile());

$this->configImportFile = vfsStream::newFile('testimport.yml')->at($this->root);
$this->configImportFile->setContent(TestData::getYamlImportFile());
Expand Down
34 changes: 34 additions & 0 deletions Test/TestData.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class TestData
public static function getYamlImportFile()
{
return <<<EOT
---
testkey_5:
default: yaddayadda
my_test: is testing hard
Expand All @@ -29,6 +30,38 @@ public static function getYamlImportFile()
public static function getYamlConfigFile()
{
return <<<EOT
---
default:
testkey_4: 'default test'
prod:
testkey_1: 'testvalue'
testkey_2:
- dummy1
- dummy2
- dummy3
testkey_3:
subkey_1: subvalue1
subkey_2: 123
subkey_3: ~
stage: []
test: []
dev:
testkey_2:
- 25
- 69
EOT;
}

/**
* provide yaml schema testdata
*
* @return string
*/
public static function getYamlImportConfigFile()
{
return <<<EOT
---
imports:
- { resource: 'vfs://configs/testimport.yml' }
default:
Expand Down Expand Up @@ -64,6 +97,7 @@ public static function getYamlTimerConfigFile()
$tomorrow = new \DateTime('tomorrow');

return <<<EOT
---
timers:
example_timer_config_1:
interval:
Expand Down
2 changes: 1 addition & 1 deletion Tests/Config/ConfigEnvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testFactoryProdWithoutFilecheck()
// merged environments config
$config = Config::factory(
[
'file' => $this->getTestYaml(),
'file' => TestData::getYamlConfigFile(),
'filecheck' => false,
],
'ConfigEnv'
Expand Down

0 comments on commit 5b36a8d

Please sign in to comment.