File tree 3 files changed +24
-1
lines changed
3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1
1
CHANGES
2
2
3
+ 2014-11-13
4
+ - fixed reserved words in queries which composed of upper case letters (Util::replaceBooleanWords)
5
+
3
6
2014-10-31
4
7
- Adding PSR-4 autoloading support
5
8
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public static function escapeTerm($term)
65
65
*/
66
66
public static function replaceBooleanWords ($ term )
67
67
{
68
- $ replacementMap = array ('AND ' =>'&& ' , 'OR ' =>'|| ' , 'NOT ' =>'! ' );
68
+ $ replacementMap = array (' AND ' =>' && ' , ' OR ' =>' || ' , ' NOT ' =>' ! ' );
69
69
$ result = strtr ($ term , $ replacementMap );
70
70
71
71
return $ result ;
Original file line number Diff line number Diff line change @@ -29,6 +29,26 @@ public function getEscapeTermPairs()
29
29
);
30
30
}
31
31
32
+ /**
33
+ * @dataProvider getReplaceBooleanWordsPairs
34
+ */
35
+ public function testReplaceBooleanWords ($ before , $ after )
36
+ {
37
+ $ this ->assertEquals ($ after , Util::replaceBooleanWords ($ before ));
38
+ }
39
+
40
+ public function getReplaceBooleanWordsPairs ()
41
+ {
42
+ return array (
43
+ array ('to be OR not to be ' , 'to be || not to be ' ),
44
+ array ('ORIGINAL GIFTS ' , 'ORIGINAL GIFTS ' ),
45
+ array ('Black AND White ' , 'Black && White ' ),
46
+ array ('TIMBERLAND Men`s ' , 'TIMBERLAND Men`s ' ),
47
+ array ('hello NOT kitty ' , 'hello !kitty ' ),
48
+ array ('SEND NOTIFICATION ' , 'SEND NOTIFICATION ' )
49
+ );
50
+ }
51
+
32
52
public function testEscapeTermSpecialCharacters ()
33
53
{
34
54
$ before = '\\+-&&||!(){}[]^"~*?:/ ' ;
You can’t perform that action at this time.
0 commit comments