Skip to content

Commit

Permalink
FilterTest: Add HasValue & HasNotValue test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Nov 15, 2021
1 parent 41197c2 commit 10d4a70
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions tests/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,24 @@ class FilterTest extends TestCase
'problem' => '1',
'service' => 'ping',
'state' => 2,
'handled' => '1'
'handled' => '1',
'host_id' => 1
],
[
'host' => 'localhost',
'problem' => '1',
'service' => 'www.icinga.com',
'state' => 0,
'handled' => '0'
'handled' => '0',
'host_id' => null
],
[
'host' => 'localhost',
'problem' => '1',
'service' => 'www.icinga.com',
'state' => 1,
'handled' => '0'
'handled' => '0',
'host_id' => 1
]
];

Expand Down Expand Up @@ -183,6 +186,34 @@ public function testUnequalMatchesMultiValuedColumns()
]));
}

public function testHasValueMatches()
{
$hasValue = Filter::hasValue('host_id');

$this->assertTrue(Filter::match($hasValue, $this->row(0)));
}

public function testHasValueMismatches()
{
$hasValue = Filter::hasValue('host_id');

$this->assertFalse(Filter::match($hasValue, $this->row(1)));
}

public function testHasNotValueMatches()
{
$hasValue = Filter::hasNotValue('host_id');

$this->assertTrue(Filter::match($hasValue, $this->row(1)));
}

public function testHasValueNotMismatches()
{
$hasValue = Filter::hasNotValue('host_id');

$this->assertFalse(Filter::match($hasValue, $this->row(0)));
}

public function testGreaterThanMatches()
{
$greaterThan = Filter::greaterThan('state', 1);
Expand Down

0 comments on commit 10d4a70

Please sign in to comment.