33namespace  PHPCR \Tests \Query ;
44
55use  PHPCR \Query \QueryInterface ;
6+ use  PHPCR \Query \QueryManagerInterface ;
67
78require_once (__DIR__  . '/../../inc/BaseCase.php ' );
89
@@ -19,7 +20,7 @@ public static function setupBeforeClass($fixtures = '06_Query/characters')
1920     */ 
2021    public  function  testPropertyWithBackslash ()
2122    {
22-         /** @var QueryManager  $queryManager */ 
23+         /** @var QueryManagerInterface  $queryManager */ 
2324        $ queryManager$ this sharedFixture ['qm ' ];
2425        $ query$ queryManagercreateQuery (' 
2526            SELECT data.class 
@@ -40,7 +41,7 @@ public function testPropertyWithBackslash()
4041     */ 
4142    public  function  testPropertyWithDoubleBackslash ()
4243    {
43-         /** @var QueryManager  $queryManager */ 
44+         /** @var QueryManagerInterface  $queryManager */ 
4445        $ queryManager$ this sharedFixture ['qm ' ];
4546        $ query$ queryManagercreateQuery (' 
4647            SELECT data.doublebackslash 
@@ -61,7 +62,7 @@ public function testPropertyWithDoubleBackslash()
6162     */ 
6263    public  function  testPropertyWithQuotes ()
6364    {
64-         /** @var QueryManager  $queryManager */ 
65+         /** @var QueryManagerInterface  $queryManager */ 
6566        $ queryManager$ this sharedFixture ['qm ' ];
6667        $ query$ queryManagercreateQuery (sprintf (' 
6768            SELECT data.quotes 
@@ -83,7 +84,7 @@ public function testPropertyWithQuotes()
8384     */ 
8485    public  function  testPropertyWithQuotesAndBackslash ()
8586    {
86-         /** @var QueryManager  $queryManager */ 
87+         /** @var QueryManagerInterface  $queryManager */ 
8788        $ queryManager$ this sharedFixture ['qm ' ];
8889        $ query$ queryManagercreateQuery (sprintf (' 
8990            SELECT data.quoteandbackslash 
@@ -102,7 +103,7 @@ public function testPropertyWithQuotesAndBackslash()
102103
103104    public  function  testQueryWithColon ()
104105    {
105-         /** @var QueryManager  $queryManager */ 
106+         /** @var QueryManagerInterface  $queryManager */ 
106107        $ queryManager$ this sharedFixture ['qm ' ];
107108        $ query$ queryManagercreateQuery (' 
108109            SELECT data.property 
@@ -112,4 +113,22 @@ public function testQueryWithColon()
112113            QueryInterface::JCR_SQL2 
113114        )->execute ();
114115    }
116+ 
117+     public  function  testQueryWithAmpersand ()
118+     {
119+         /** @var QueryManagerInterface $queryManager */ 
120+         $ queryManager$ this sharedFixture ['qm ' ];
121+         $ query$ queryManagercreateQuery (' 
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$ queryexecute ();
130+         $ rows$ resultgetRows ();
131+         $ this assertCount (1 , $ rows
132+         $ this assertEquals ('foo & bar&baz ' , $ rowscurrent ()->getValue ('ampersand ' ));
133+     }
115134}
0 commit comments