test overriding

This commit is contained in:
Norbert Wagner 2021-01-11 11:58:40 +01:00
parent b08be903d2
commit 998ab30bd2
8 changed files with 38 additions and 1 deletions

View File

@ -35,7 +35,7 @@ class SettingsTest extends TestCase
public function testLoad()
{
$cfg = (new Settings())->appPath(dirname(__FILE__).'/')->load();
$cfg = $this->load('cfg');
$this->assertNotEmpty($cfg);
return $cfg;
}
@ -48,6 +48,18 @@ class SettingsTest extends TestCase
$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()
{
$path = './config/';
@ -60,6 +72,11 @@ class SettingsTest extends TestCase
$this->assertEquals($defaultName, $cfg->buildFileName());
}
private function load(string $dir)
{
return (new Settings())->appPath(dirname(__FILE__)."/$dir/")->load();
}
}
/* jEdit buffer local properties {{{

View File

@ -0,0 +1,3 @@
<?php return [
'answer' => 42
];

View File

@ -0,0 +1,4 @@
<?php return [
'mode' => 'prod',
'answer' => false
];

View File

@ -0,0 +1,3 @@
<?php return [
'answer' => false
];

View File

@ -0,0 +1,3 @@
<?php return [
'mode' => 'test'
];

View File

@ -0,0 +1,4 @@
<?php return [
'mode' => 'prod',
'answer' => false
];

View File

@ -0,0 +1,3 @@
<?php return [
'answer' => 42
];