@@ -247,6 +247,30 @@ public function testQueryJoinReference()
247
247
}
248
248
249
249
public function testQueryOrder ()
250
+ {
251
+ /** @var $query QueryInterface */
252
+ $ query = $ this ->sharedFixture ['qm ' ]->createQuery ('
253
+ SELECT data.foo
254
+ FROM [nt:unstructured] AS data
255
+ WHERE ISDESCENDANTNODE([/tests_general_base]) AND data.foo IS NOT NULL
256
+ ORDER BY data.foo
257
+ ' ,
258
+ QueryInterface::JCR_SQL2
259
+ );
260
+
261
+ $ this ->assertInstanceOf ('\PHPCR\Query\QueryInterface ' , $ query );
262
+ $ result = $ query ->execute ();
263
+ $ this ->assertInstanceOf ('\PHPCR\Query\QueryResultInterface ' , $ result );
264
+ $ vals = array ();
265
+ foreach ($ result ->getRows () as $ row ) {
266
+ $ vals [] = $ row ->getValue ('data.foo ' );
267
+ }
268
+
269
+ // rows that do not have that field are empty string. empty is before fields with values
270
+ $ this ->assertEquals (array ('bar ' , 'bar2 ' ), $ vals );
271
+ }
272
+
273
+ public function testQueryOrderWithMissingProperty ()
250
274
{
251
275
/** @var $query QueryInterface */
252
276
$ query = $ this ->sharedFixture ['qm ' ]->createQuery ('
@@ -265,8 +289,8 @@ public function testQueryOrder()
265
289
foreach ($ result ->getRows () as $ row ) {
266
290
$ vals [] = $ row ->getValue ('data.zeronumber ' );
267
291
}
268
- // rows that do not have that field are null . empty is before fields with values
269
- $ this ->assertEquals (array (null , null , null , null , null , null , null , null , 0 ), $ vals );
292
+ // rows that do not have that field are empty string . empty is before fields with values
293
+ $ this ->assertEquals (array ('' , '' , '' , '' , '' , '' , '' , '' , 0 ), $ vals );
270
294
}
271
295
272
296
public function testQueryMultiValuedProperty ()
0 commit comments