3
3
namespace PHPCR \Tests \Query ;
4
4
5
5
use PHPCR \Query \QueryInterface ;
6
+ use PHPCR \Query \QueryManagerInterface ;
6
7
7
8
require_once (__DIR__ . '/../../inc/BaseCase.php ' );
8
9
@@ -19,7 +20,7 @@ public static function setupBeforeClass($fixtures = '06_Query/characters')
19
20
*/
20
21
public function testPropertyWithBackslash ()
21
22
{
22
- /** @var QueryManager $queryManager */
23
+ /** @var QueryManagerInterface $queryManager */
23
24
$ queryManager = $ this ->sharedFixture ['qm ' ];
24
25
$ query = $ queryManager ->createQuery ('
25
26
SELECT data.class
@@ -40,7 +41,7 @@ public function testPropertyWithBackslash()
40
41
*/
41
42
public function testPropertyWithDoubleBackslash ()
42
43
{
43
- /** @var QueryManager $queryManager */
44
+ /** @var QueryManagerInterface $queryManager */
44
45
$ queryManager = $ this ->sharedFixture ['qm ' ];
45
46
$ query = $ queryManager ->createQuery ('
46
47
SELECT data.doublebackslash
@@ -61,7 +62,7 @@ public function testPropertyWithDoubleBackslash()
61
62
*/
62
63
public function testPropertyWithQuotes ()
63
64
{
64
- /** @var QueryManager $queryManager */
65
+ /** @var QueryManagerInterface $queryManager */
65
66
$ queryManager = $ this ->sharedFixture ['qm ' ];
66
67
$ query = $ queryManager ->createQuery (sprintf ('
67
68
SELECT data.quotes
@@ -83,7 +84,7 @@ public function testPropertyWithQuotes()
83
84
*/
84
85
public function testPropertyWithQuotesAndBackslash ()
85
86
{
86
- /** @var QueryManager $queryManager */
87
+ /** @var QueryManagerInterface $queryManager */
87
88
$ queryManager = $ this ->sharedFixture ['qm ' ];
88
89
$ query = $ queryManager ->createQuery (sprintf ('
89
90
SELECT data.quoteandbackslash
@@ -102,7 +103,7 @@ public function testPropertyWithQuotesAndBackslash()
102
103
103
104
public function testQueryWithColon ()
104
105
{
105
- /** @var QueryManager $queryManager */
106
+ /** @var QueryManagerInterface $queryManager */
106
107
$ queryManager = $ this ->sharedFixture ['qm ' ];
107
108
$ query = $ queryManager ->createQuery ('
108
109
SELECT data.property
@@ -112,4 +113,22 @@ public function testQueryWithColon()
112
113
QueryInterface::JCR_SQL2
113
114
)->execute ();
114
115
}
116
+
117
+ public function testQueryWithAmpersand ()
118
+ {
119
+ /** @var QueryManagerInterface $queryManager */
120
+ $ queryManager = $ this ->sharedFixture ['qm ' ];
121
+ $ query = $ queryManager ->createQuery ('
122
+ SELECT data.ampersand
123
+ FROM [nt:unstructured] AS data
124
+ WHERE data.ampersand = "foo & bar&baz"
125
+ ' ,
126
+ QueryInterface::JCR_SQL2
127
+ );
128
+
129
+ $ result = $ query ->execute ();
130
+ $ rows = $ result ->getRows ();
131
+ $ this ->assertCount (1 , $ rows );
132
+ $ this ->assertEquals ('foo & bar&baz ' , $ rows ->current ()->getValue ('ampersand ' ));
133
+ }
115
134
}
0 commit comments