more tests
This commit is contained in:
parent
81c9247571
commit
ed554705e5
3 changed files with 28 additions and 5 deletions
|
|
@ -38,10 +38,19 @@ class SettingsTest extends TestCase
|
|||
public function testLoadNoFile()
|
||||
{
|
||||
$cfg = new Settings();
|
||||
$this->expectException(\ErrorException::class);
|
||||
$this->expectException(\Exception::class);
|
||||
$cfg->load();
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function testReadOnly()
|
||||
{
|
||||
$cfg = new Settings();
|
||||
$this->expectException(\Exception::class);
|
||||
$cfg->answer = 42;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
private function appPath(Settings $cfg, string $dir='')
|
||||
|
|
@ -86,6 +95,19 @@ class SettingsTest extends TestCase
|
|||
$this->assertEquals('default', $nested->testFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testLoad
|
||||
*/
|
||||
public function testNestedArray(Settings $cfg)
|
||||
{
|
||||
$nested = $cfg->nested->toArray();
|
||||
$this->assertIsArray($nested);
|
||||
$this->assertIsIterable($nested);
|
||||
$this->assertEquals(1, $nested['level']);
|
||||
$this->assertEquals(2, $nested['nested']['level']);
|
||||
$this->assertEquals('default', $nested['testFiles']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testLoad
|
||||
*/
|
||||
|
|
@ -104,6 +126,7 @@ class SettingsTest extends TestCase
|
|||
$cfg = $this->appPath($cfg)->site('site')->load();
|
||||
|
||||
$this->assertEquals('default', $cfg->testFiles);
|
||||
$this->assertEquals('site', $cfg->testFile);
|
||||
$this->assertEquals(42, $cfg->answer);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue