icingaweb2-module-businessp.../test/php/library/Businessprocess/HostNodeTest.php
Thomas Gelf 91087b73ab Host/ServiceNode: fix tests using Link component
That way it's no longer directly based on Icinga\Web\Url and runs through.
Also fixed wrong expectations in HostNodeTest
2016-11-24 00:35:22 +01:00

48 lines
No EOL
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;Hoststatus',
$this->localhost()->getAlias()
);
}
public function testRendersCorrectLink()
{
$this->assertEquals(
'<a href="/icingaweb2/monitoring/host/show?host=localhost">'
. 'localhost</a>',
$this->localhost()->renderLink(new View())
);
}
/**
* @return HostNode
*/
protected function localhost()
{
$bp = new BusinessProcess();
return new HostNode($bp, (object) array(
'hostname' => 'localhost',
'state' => 0,
));
}
}