@@ -76,17 +76,30 @@ public function testQueries()
76
76
}
77
77
}
78
78
79
- public function testPropertyComparisonWithWhitespace ()
79
+ public function getSQL2WithWhitespace ()
80
80
{
81
- $ sql2 = 'SELECT * FROM [nt:file] WHERE prop1 = "Foo bar" ' ;
81
+ return array (
82
+ array ('SELECT * FROM [nt:file] WHERE prop1 = "Foo bar" ' , 'Foo bar ' ),
83
+ array ('SELECT * FROM [nt:file] WHERE prop1 = "Foo bar" ' , 'Foo bar ' ),
84
+ array ('SELECT * FROM [nt:file] WHERE prop1 = "Foo\tbar" ' , 'Foo\tbar ' ),
85
+ array ('SELECT * FROM [nt:file] WHERE prop1 = "Foo\n\tbar" ' , 'Foo\nbar ' ),
86
+ array ('SELECT * FROM [nt:file] WHERE prop1 = "Foo \t bar" ' , 'Foo \t bar ' ),
87
+ array ('SELECT * FROM [nt:file] WHERE prop1 = "Foo \t \n bar" ' , 'Foo \t \n bar ' ),
88
+ );
89
+ }
82
90
91
+ /**
92
+ * @dataProvider getSQL2WithWhitespace
93
+ */
94
+ public function testPropertyComparisonWithWhitespace ($ sql2 , $ literal )
95
+ {
83
96
$ qom = $ this ->parser ->parse ($ sql2 );
84
97
85
98
$ this ->assertInstanceOf ('PHPCR\Query\QOM\ComparisonInterface ' , $ qom ->getConstraint ());
86
99
$ this ->assertInstanceOf ('PHPCR\Query\QOM\PropertyValueInterface ' , $ qom ->getConstraint ()->getOperand1 ());
87
100
$ this ->assertInstanceOf ('PHPCR\Query\QOM\LiteralInterface ' , $ qom ->getConstraint ()->getOperand2 ());
88
101
89
102
$ this ->assertEquals ('prop1 ' , $ qom ->getConstraint ()->getOperand1 ()->getPropertyName ());
90
- $ this ->assertEquals (' Foo bar ' , $ qom ->getConstraint ()->getOperand2 ()->getLiteralValue ());
103
+ $ this ->assertEquals ($ literal , $ qom ->getConstraint ()->getOperand2 ()->getLiteralValue ());
91
104
}
92
105
}
0 commit comments