test overriding
This commit is contained in:
parent
b08be903d2
commit
998ab30bd2
8 changed files with 38 additions and 1 deletions
|
@ -35,7 +35,7 @@ class SettingsTest extends TestCase
|
||||||
|
|
||||||
public function testLoad()
|
public function testLoad()
|
||||||
{
|
{
|
||||||
$cfg = (new Settings())->appPath(dirname(__FILE__).'/')->load();
|
$cfg = $this->load('cfg');
|
||||||
$this->assertNotEmpty($cfg);
|
$this->assertNotEmpty($cfg);
|
||||||
return $cfg;
|
return $cfg;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,18 @@ class SettingsTest extends TestCase
|
||||||
$this->assertEquals('test', $cfg->mode);
|
$this->assertEquals('test', $cfg->mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testTestingOverride()
|
||||||
|
{
|
||||||
|
$cfg = $this->load('cfg/testingOverride');
|
||||||
|
$this->assertEquals(42, $cfg->answer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLocalOverride()
|
||||||
|
{
|
||||||
|
$cfg = $this->load('cfg/localOverride');
|
||||||
|
$this->assertEquals(42, $cfg->answer);
|
||||||
|
}
|
||||||
|
|
||||||
public function testBuildFileName()
|
public function testBuildFileName()
|
||||||
{
|
{
|
||||||
$path = './config/';
|
$path = './config/';
|
||||||
|
@ -60,6 +72,11 @@ class SettingsTest extends TestCase
|
||||||
|
|
||||||
$this->assertEquals($defaultName, $cfg->buildFileName());
|
$this->assertEquals($defaultName, $cfg->buildFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function load(string $dir)
|
||||||
|
{
|
||||||
|
return (new Settings())->appPath(dirname(__FILE__)."/$dir/")->load();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* jEdit buffer local properties {{{
|
/* jEdit buffer local properties {{{
|
||||||
|
|
3
tests/cfg/localOverride/config/conf.php
Normal file
3
tests/cfg/localOverride/config/conf.php
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<?php return [
|
||||||
|
'answer' => 42
|
||||||
|
];
|
4
tests/cfg/localOverride/config/default.conf.php
Normal file
4
tests/cfg/localOverride/config/default.conf.php
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?php return [
|
||||||
|
'mode' => 'prod',
|
||||||
|
'answer' => false
|
||||||
|
];
|
3
tests/cfg/localOverride/config/testing.conf.php
Normal file
3
tests/cfg/localOverride/config/testing.conf.php
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<?php return [
|
||||||
|
'answer' => false
|
||||||
|
];
|
3
tests/cfg/testingOverride/config/conf.php
Normal file
3
tests/cfg/testingOverride/config/conf.php
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<?php return [
|
||||||
|
'mode' => 'test'
|
||||||
|
];
|
4
tests/cfg/testingOverride/config/default.conf.php
Normal file
4
tests/cfg/testingOverride/config/default.conf.php
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?php return [
|
||||||
|
'mode' => 'prod',
|
||||||
|
'answer' => false
|
||||||
|
];
|
3
tests/cfg/testingOverride/config/testing.conf.php
Normal file
3
tests/cfg/testingOverride/config/testing.conf.php
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<?php return [
|
||||||
|
'answer' => 42
|
||||||
|
];
|
Loading…
Reference in a new issue