@@ -316,4 +316,46 @@ public function testQueryMultiValuedProperty()
316316 $ this ->assertSame ('foo bar ' , $ rows ->current ()->getValue ('tags ' ));
317317 }
318318
319+ public function testQueryWithLengthOperand ()
320+ {
321+ /** @var $query QueryInterface */
322+ $ query = $ this ->sharedFixture ['qm ' ]->createQuery ('
323+ SELECT data.*
324+ FROM [nt:unstructured] AS data
325+ WHERE LENGTH(data.jcr:data) = 121
326+ AND ISDESCENDANTNODE([/tests_general_base])
327+ ' ,
328+ QueryInterface::JCR_SQL2
329+ );
330+
331+ $ this ->assertInstanceOf ('\PHPCR\Query\QueryInterface ' , $ query );
332+ $ result = $ query ->execute ();
333+ $ this ->assertInstanceOf ('\PHPCR\Query\QueryResultInterface ' , $ result );
334+
335+ $ rows = $ result ->getRows ();
336+
337+ $ this ->assertCount (3 , $ rows , 'Expected 3 nodes with a jcr:data property with length 121 ' );
338+
339+ /** @var $query QueryInterface */
340+ $ query = $ this ->sharedFixture ['qm ' ]->createQuery ('
341+ SELECT data.*
342+ FROM [nt:unstructured] AS data
343+ WHERE
344+ data.empty-value IS NOT NULL
345+ AND LENGTH(data.empty-value) < 1
346+ AND LENGTH(data.empty-value) > -1
347+ AND ISDESCENDANTNODE([/tests_general_base])
348+ ' ,
349+ QueryInterface::JCR_SQL2
350+ );
351+
352+ $ this ->assertInstanceOf ('\PHPCR\Query\QueryInterface ' , $ query );
353+ $ result = $ query ->execute ();
354+ $ this ->assertInstanceOf ('\PHPCR\Query\QueryResultInterface ' , $ result );
355+
356+ $ rows = $ result ->getRows ();
357+
358+ $ this ->assertCount (1 , $ rows , 'Expected 1 node with property "empty-value" with a length smaller then 1 and greater then -1 ' );
359+ }
360+
319361}
0 commit comments