Skip to content

Commit 6ab13d9

Browse files
authored
improvement: added not like/contains filters
2 parents 52a47b9 + 1bdb41e commit 6ab13d9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/Filter/Operator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ abstract class Operator
1414
public const IS_NOT = 'is not';
1515
public const LIKE = 'like';
1616
public const CONTAINS = 'contains';
17+
public const NOT_LIKE = 'not like';
18+
public const NOT_CONTAINS = 'not contains';
1719
public const STARTS_WITH = 'starts with';
1820
public const ENDS_WITH = 'ends with';
1921
}

test/Filter/DisjunctionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public function testBuildQuery()
7575
*/
7676
public function testToString()
7777
{
78-
$left = new Condition('city', Operator::EQ, 'Bergamo');
78+
$left = new Condition('city', Operator::NOT_CONTAINS, 'Bergamo');
7979
$right = new Condition('age', Operator::LT, 30);
8080
$disjunction = new Disjunction($left, $right);
81-
$this->assertEquals("(city = 'Bergamo' or age < 30)", (string)$disjunction);
81+
$this->assertEquals("(city not contains 'Bergamo' or age < 30)", (string)$disjunction);
8282
}
8383
}

0 commit comments

Comments
 (0)