Skip to content
This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Commit 5b36a8d

Browse files
committed
Fixed tests for import without filecheck
1 parent 4a83551 commit 5b36a8d

File tree

5 files changed

+38
-4
lines changed

5 files changed

+38
-4
lines changed

Config/Config.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static function factory(array $param, $class = 'ConfigDefault')
4141
return new $class($param);
4242
} else {
4343
throw new \ErrorException(
44-
'Config::factory() - could not instantiate ' . $class . ' - not in self::$whitelist'
44+
'Config::factory() - could not instantiate ' . $class
4545
);
4646
}
4747
}

Config/ConfigEnv.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private function mergeEnvironments($param)
6363
$toMerge
6464
);
6565
} else {
66-
$merged = $config->get($this->defaultEnv);
66+
$merged = $config->get($this->defaultEnv, []);
6767
}
6868

6969
$this->setByArray(

Test/BaseConfigTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function setUp()
3434

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

3939
$this->configImportFile = vfsStream::newFile('testimport.yml')->at($this->root);
4040
$this->configImportFile->setContent(TestData::getYamlImportFile());

Test/TestData.php

+34
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class TestData
1515
public static function getYamlImportFile()
1616
{
1717
return <<<EOT
18+
---
1819
testkey_5:
1920
default: yaddayadda
2021
my_test: is testing hard
@@ -29,6 +30,38 @@ public static function getYamlImportFile()
2930
public static function getYamlConfigFile()
3031
{
3132
return <<<EOT
33+
---
34+
default:
35+
testkey_4: 'default test'
36+
prod:
37+
testkey_1: 'testvalue'
38+
testkey_2:
39+
- dummy1
40+
- dummy2
41+
- dummy3
42+
testkey_3:
43+
subkey_1: subvalue1
44+
subkey_2: 123
45+
subkey_3: ~
46+
47+
stage: []
48+
test: []
49+
dev:
50+
testkey_2:
51+
- 25
52+
- 69
53+
EOT;
54+
}
55+
56+
/**
57+
* provide yaml schema testdata
58+
*
59+
* @return string
60+
*/
61+
public static function getYamlImportConfigFile()
62+
{
63+
return <<<EOT
64+
---
3265
imports:
3366
- { resource: 'vfs://configs/testimport.yml' }
3467
default:
@@ -64,6 +97,7 @@ public static function getYamlTimerConfigFile()
6497
$tomorrow = new \DateTime('tomorrow');
6598

6699
return <<<EOT
100+
---
67101
timers:
68102
example_timer_config_1:
69103
interval:

Tests/Config/ConfigEnvTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testFactoryProdWithoutFilecheck()
5252
// merged environments config
5353
$config = Config::factory(
5454
[
55-
'file' => $this->getTestYaml(),
55+
'file' => TestData::getYamlConfigFile(),
5656
'filecheck' => false,
5757
],
5858
'ConfigEnv'

0 commit comments

Comments
 (0)