diff --git a/tests/FilterTest.php b/tests/FilterTest.php index b26b3fc..b732a5b 100644 --- a/tests/FilterTest.php +++ b/tests/FilterTest.php @@ -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 ] ]; @@ -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 testHasNotValueMismatches() + { + $hasValue = Filter::hasNotValue('host_id'); + + $this->assertFalse(Filter::match($hasValue, $this->row(0))); + } + public function testGreaterThanMatches() { $greaterThan = Filter::greaterThan('state', 1);