mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
IcingaCommandTest: add new command-related tests
This commit is contained in:
parent
9d4ee40575
commit
41ed29df8c
@ -29,6 +29,35 @@ class IcingaCommandTest extends BaseTestCase
|
|||||||
$command->arguments()->get('-H')->required = true;
|
$command->arguments()->get('-H')->required = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCommandsWithArgumentsCanBeModified()
|
||||||
|
{
|
||||||
|
$command = $this->command();
|
||||||
|
$command->arguments = array(
|
||||||
|
'-H' => '$host$'
|
||||||
|
);
|
||||||
|
|
||||||
|
$command->arguments = array(
|
||||||
|
'-x' => (object) array(
|
||||||
|
'required' => true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
null,
|
||||||
|
$command->arguments()->get('-H')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'y',
|
||||||
|
$command->arguments()->get('-x')->get('required')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
true,
|
||||||
|
$command->toPlainObject()->arguments['-x']->required
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
protected function command()
|
protected function command()
|
||||||
{
|
{
|
||||||
return IcingaCommand::create(
|
return IcingaCommand::create(
|
||||||
@ -39,11 +68,11 @@ class IcingaCommandTest extends BaseTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function XXtearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
$db = $this->getDb();
|
$db = $this->getDb();
|
||||||
if (IcingaTimePeriod::exists($this->testPeriodName, $db)) {
|
if (IcingaCommand::exists($this->testCommandName, $db)) {
|
||||||
IcingaTimePeriod::load($this->testPeriodName, $db)->delete();
|
IcingaCommand::load($this->testCommandName, $db)->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user