mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
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
|
||
|
|
{
|
||
|
|
public function testReturnsCorrectHostName()
|
||
|
|
{
|
||
|
|
$this->assertEquals(
|
||
|
|
'localhost',
|
||
|
|
$this->localhost()->getHostname()
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function testReturnsCorrectAlias()
|
||
|
|
{
|
||
|
|
$this->assertEquals(
|
||
|
|
'localhost',
|
||
|
|
$this->localhost()->getAlias()
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function testRendersCorrectLink()
|
||
|
|
{
|
||
|
|
$this->assertEquals(
|
||
|
|
'<a href="/icingaweb2/monitoring/host/show?host=localhost">'
|
||
|
|
. 'localhost: ping <> pong</a>',
|
||
|
|
$this->localhost()->renderLink(new View())
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return HostNode
|
||
|
|
*/
|
||
|
|
protected function localhost()
|
||
|
|
{
|
||
|
|
$bp = new BusinessProcess();
|
||
|
|
return new HostNode($bp, (object) array(
|
||
|
|
'hostname' => 'localhost',
|
||
|
|
'state' => 0,
|
||
|
|
));
|
||
|
|
}
|
||
|
|
}
|