implement tests for site specific config
test that site directory config files are read correctly correct Settings.php to pass tests
This commit is contained in:
parent
998ab30bd2
commit
c2b13b2f86
4 changed files with 27 additions and 14 deletions
|
|
@ -35,7 +35,7 @@ class SettingsTest extends TestCase
|
|||
|
||||
public function testLoad()
|
||||
{
|
||||
$cfg = $this->load('cfg');
|
||||
$cfg = $this->init('cfg')->load();
|
||||
$this->assertNotEmpty($cfg);
|
||||
return $cfg;
|
||||
}
|
||||
|
|
@ -48,15 +48,24 @@ class SettingsTest extends TestCase
|
|||
$this->assertEquals('test', $cfg->mode);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function testSiteOverride()
|
||||
{
|
||||
$cfg = $this->init('cfg')->site('site')->load();
|
||||
$this->assertEquals(42, $cfg->answer);
|
||||
}
|
||||
|
||||
|
||||
public function testTestingOverride()
|
||||
{
|
||||
$cfg = $this->load('cfg/testingOverride');
|
||||
$cfg = $this->init('cfg/testingOverride')->load();
|
||||
$this->assertEquals(42, $cfg->answer);
|
||||
}
|
||||
|
||||
public function testLocalOverride()
|
||||
{
|
||||
$cfg = $this->load('cfg/localOverride');
|
||||
$cfg = $this->init('cfg/localOverride')->load();
|
||||
$this->assertEquals(42, $cfg->answer);
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +82,7 @@ class SettingsTest extends TestCase
|
|||
$this->assertEquals($defaultName, $cfg->buildFileName());
|
||||
}
|
||||
|
||||
private function load(string $dir)
|
||||
private function init(string $dir)
|
||||
{
|
||||
return (new Settings())->appPath(dirname(__FILE__)."/$dir/")->load();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue