AssignRendererTest: first new simple test

This commit is contained in:
Thomas Gelf 2016-02-25 18:24:17 +01:00
parent 9cd5f46a68
commit c741042108
1 changed files with 24 additions and 0 deletions

View File

@ -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());
}
}