mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-13 16:03:20 -05:00
Tests: add some more basic tests
This commit is contained in:
parent
cbf8db3073
commit
7511d0f4c5
2 changed files with 51 additions and 1 deletions
|
|
@ -5,7 +5,6 @@ namespace Tests\Icinga\Module\Businessprocess\Operator;
|
|||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\HostNode;
|
||||
use Icinga\Module\Businessprocess\Test\BaseTestCase;
|
||||
use Icinga\Web\View;
|
||||
|
||||
class HostNodeTest extends BaseTestCase
|
||||
{
|
||||
|
|
@ -42,6 +41,16 @@ class HostNodeTest extends BaseTestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Icinga\Exception\ConfigurationError
|
||||
*/
|
||||
public function testWhetherSettingAnInvalidStateFails()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$host = $bp->createHost('localhost')->setState(98);
|
||||
$bp->createBp('p')->addChild($host)->getState();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HostNode
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -102,6 +102,47 @@ class AndOperatorTest extends BaseTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testWhetherSimpleAndOperationWorks()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$bp->throwErrors();
|
||||
$host = $bp->createHost('localhost')->setState(1);
|
||||
$service = $bp->createService('localhost', 'ping')->setState(1);
|
||||
$p = $bp->createBp('p');
|
||||
$p->addChild($host);
|
||||
$p->addChild($service);
|
||||
|
||||
$this->assertEquals(
|
||||
'DOWN',
|
||||
$host->getStateName()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'WARNING',
|
||||
$service->getStateName()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'CRITICAL',
|
||||
$p->getStateName()
|
||||
);
|
||||
}
|
||||
|
||||
public function testWhetherSimpleOrOperationWorks()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$bp->throwErrors();
|
||||
$host = $bp->createHost('localhost')->setState(1);
|
||||
$service = $bp->createService('localhost', 'ping')->setState(1);
|
||||
$p = $bp->createBp('p', '|');
|
||||
$p->addChild($host);
|
||||
$p->addChild($service);
|
||||
|
||||
$this->assertEquals('DOWN',$host->getStateName());
|
||||
$this->assertEquals('WARNING', $service->getStateName());
|
||||
$this->assertEquals('WARNING', $p->getStateName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BusinessProcess
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue