@@ -23,6 +23,25 @@ public function testParserIdentifiesSingleConditions()
2323 );
2424 }
2525
26+ public function testParserIdentifiesWildCardCharacters ()
27+ {
28+ $ expectedSimilar = QueryString::render (Filter::similar ('foo ' , 'ba* ' ));
29+
30+ $ this ->assertEquals (
31+ $ expectedSimilar ,
32+ QueryString::render (QueryString::parse ($ expectedSimilar )),
33+ "Filter\Parser doesn't parse conditions with wildcard character correctly "
34+ );
35+
36+ $ expectedUnlike = QueryString::render (Filter::unlike ('foo ' , 'ba* ' ));
37+
38+ $ this ->assertEquals (
39+ $ expectedUnlike ,
40+ QueryString::render (QueryString::parse ($ expectedUnlike )),
41+ "Filter\Parser doesn't parse conditions with wildcard character correctly "
42+ );
43+ }
44+
2645 public function testParserIdentifiesBooleanConditions ()
2746 {
2847 $ expectedTrue = QueryString::render (Filter::equal ('active ' , true ));
@@ -56,13 +75,27 @@ public function testParserIdentifiesRelationalOperators()
5675 "Filter\Parser doesn't parse = comparisons correctly "
5776 );
5877
78+ $ expectedSimilar = QueryString::render (Filter::similar ('foo ' , 'ba* ' ));
79+ $ this ->assertEquals (
80+ $ expectedSimilar ,
81+ QueryString::render (QueryString::parse ($ expectedSimilar )),
82+ "Filter\Parser doesn't parse != comparisons correctly for wildcard characters "
83+ );
84+
5985 $ expectedUnequal = QueryString::render (Filter::unequal ('foo ' , 'bar ' ));
6086 $ this ->assertEquals (
6187 $ expectedUnequal ,
6288 QueryString::render (QueryString::parse ($ expectedUnequal )),
6389 "Filter\Parser doesn't parse != comparisons correctly "
6490 );
6591
92+ $ expectedUnlike = QueryString::render (Filter::unlike ('foo ' , 'ba* ' ));
93+ $ this ->assertEquals (
94+ $ expectedUnlike ,
95+ QueryString::render (QueryString::parse ($ expectedUnlike )),
96+ "Filter\Parser doesn't parse != comparisons correctly for wildcard characters "
97+ );
98+
6699 $ expectedGreaterThan = QueryString::render (Filter::greaterThan ('length ' , 3 ));
67100 $ this ->assertEquals (
68101 $ expectedGreaterThan ,
@@ -340,6 +373,9 @@ public function testParserIdentifiesTheHolyGrail()
340373 /* testParserIdentifiesBooleanConditions */
341374 Filter::equal ('active ' , true ),
342375 Filter::equal ('active ' , false ),
376+ /* testParserIdentifiesWildCardCharacters */
377+ Filter::similar ('foo ' , 'ba* ' ),
378+ Filter::unlike ('foo ' , 'ba* ' ),
343379 /* testParserIdentifiesRelationalOperators */
344380 Filter::unequal ('foo ' , 'bar ' ),
345381 Filter::greaterThan ('length ' , 3 ),
0 commit comments