mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 16:24:05 +02:00
IcingaHostTest: add a couple of tests...
...related to recently added lazy-loading capabilities
This commit is contained in:
parent
27811eebe6
commit
407a47a6ec
@ -141,6 +141,52 @@ class IcingaHostTest extends BaseTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGivesPlainObjectWithInvalidUnresolvedDependencies()
|
||||||
|
{
|
||||||
|
$props = array(
|
||||||
|
'zone' => 'invalid',
|
||||||
|
'check_command' => 'unknown',
|
||||||
|
'event_command' => 'What event?',
|
||||||
|
'check_period' => 'Not time is a good time @ nite',
|
||||||
|
'command_endpoint' => 'nirvana',
|
||||||
|
);
|
||||||
|
|
||||||
|
$host = $this->host();
|
||||||
|
foreach ($props as $k => $v) {
|
||||||
|
$host->$k = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
$plain = $host->toPlainObject();
|
||||||
|
foreach ($props as $k => $v) {
|
||||||
|
$this->assertEquals($plain->$k, $v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRendersWithInvalidUnresolvedDependencies()
|
||||||
|
{
|
||||||
|
$newHost = $this->host();
|
||||||
|
$newHost->zone = 'invalid';
|
||||||
|
$newHost->check_command = 'unknown';
|
||||||
|
$newHost->event_command = 'What event?';
|
||||||
|
$newHost->check_period = 'Not time is a good time @ nite';
|
||||||
|
$newHost->command_endpoint = 'nirvana';
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
(string) $newHost,
|
||||||
|
$this->loadRendered('host2')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \Icinga\Exception\NotFoundError
|
||||||
|
*/
|
||||||
|
public function testFailsToStoreWithInvalidUnresolvedDependencies()
|
||||||
|
{
|
||||||
|
$newHost = $this->host();
|
||||||
|
$newHost->zone = 'invalid';
|
||||||
|
$newHost->store($this->getDb());
|
||||||
|
}
|
||||||
|
|
||||||
protected function host()
|
protected function host()
|
||||||
{
|
{
|
||||||
return IcingaHost::create(array(
|
return IcingaHost::create(array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user