Skip to content

Commit a687521

Browse files
committed
Merge pull request #129 from phpcr/test-join-on-ischild
test JOIN ON ISCHILDNODE
2 parents 443c545 + 8ca851d commit a687521

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/06_Query/QuerySql2OperationsTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,31 @@ public function testQueryJoinReference()
246246
$this->assertEquals(array('13543fc6-1abf-4708-bfcc-e49511754b40' => '13543fc6-1abf-4708-bfcc-e49511754b40'), $vals);
247247
}
248248

249+
public function testQueryJoinChildnode()
250+
{
251+
/** @var $query QueryInterface */
252+
$query = $this->sharedFixture['qm']->createQuery('
253+
SELECT [nt:unstructured].longNumber
254+
FROM [nt:file]
255+
INNER JOIN [nt:unstructured]
256+
ON ISCHILDNODE([nt:unstructured], [nt:file])
257+
WHERE [nt:unstructured].longNumber = 999
258+
AND ISDESCENDANTNODE([nt:file], [/tests_general_base])
259+
',
260+
QueryInterface::JCR_SQL2
261+
);
262+
263+
$this->assertInstanceOf('\PHPCR\Query\QueryInterface', $query);
264+
$result = $query->execute();
265+
$this->assertInstanceOf('\PHPCR\Query\QueryResultInterface', $result);
266+
$vals = array();
267+
268+
foreach ($result->getRows() as $row) {
269+
$vals[] = $row->getValue('nt:unstructured.longNumber');
270+
}
271+
$this->assertEquals(array(999), $vals);
272+
}
273+
249274
public function testQueryOrder()
250275
{
251276
/** @var $query QueryInterface */

0 commit comments

Comments
 (0)