AssignRendererTest: first new simple test
This commit is contained in:
parent
9cd5f46a68
commit
c741042108
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Icinga\Modules\Director;
|
||||||
|
|
||||||
|
use Icinga\Data\Filter\Filter;
|
||||||
|
use Icinga\Module\Director\IcingaConfig\AssignRenderer;
|
||||||
|
use Icinga\Module\Director\Test\BaseTestCase;
|
||||||
|
|
||||||
|
class AssignRendererTest extends BaseTestCase
|
||||||
|
{
|
||||||
|
public function testWhetherACombinedFilterRendersCorrectly()
|
||||||
|
{
|
||||||
|
$string = 'host.name="*internal"|(service.vars.priority<2'
|
||||||
|
. '&host.vars.is_clustered=true)';
|
||||||
|
|
||||||
|
$expected = 'assign where match("*internal", host.name) ||'
|
||||||
|
. ' (service.vars.priority < 2 && host.vars.is_clustered == true)';
|
||||||
|
|
||||||
|
$filter = Filter::fromQueryString($string);
|
||||||
|
$renderer = AssignRenderer::forFilter($filter);
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $renderer->renderAssign());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue