Skip to content

Commit 97eb1e7

Browse files
committed
Merge pull request #174 from phpcr/outer-joins
test outer join with only one node found
2 parents 11f6d7a + 64b380a commit 97eb1e7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/Query/QuerySql2OperationsTest.php

+27
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace PHPCR\Tests\Query;
1313

1414
use PHPCR\Query\QueryInterface;
15+
use PHPCR\Query\RowInterface;
1516

1617
/**
1718
* Run non-trivial queries to try out where, the join features and such.
@@ -200,6 +201,32 @@ public function testQueryLeftJoin()
200201
), $vals);
201202
}
202203

204+
public function testQueryLeftJoinNull()
205+
{
206+
/** @var $query QueryInterface */
207+
$query = $this->sharedFixture['qm']->createQuery(
208+
'SELECT *
209+
FROM [nt:folder] AS folder
210+
LEFT OUTER JOIN [nt:file] AS file
211+
ON ISDESCENDANTNODE(file, folder)
212+
WHERE NAME(folder) = "emptyExample"
213+
',
214+
QueryInterface::JCR_SQL2
215+
);
216+
217+
$this->assertInstanceOf('\PHPCR\Query\QueryInterface', $query);
218+
$result = $query->execute();
219+
$this->assertInstanceOf('\PHPCR\Query\QueryResultInterface', $result);
220+
$this->assertCount(1, $result);
221+
222+
/** @var RowInterface $row */
223+
$row = $result->getRows()->current();
224+
$this->assertInstanceOf('\PHPCR\Query\RowInterface', $row);
225+
$this->assertEquals('/tests_general_base/emptyExample', $row->getPath('folder'));
226+
$this->assertNull($row->getPath('file'));
227+
$this->assertNull($row->getNode('file'));
228+
}
229+
203230
public function testQueryRightJoin()
204231
{
205232
/** @var $query QueryInterface */

0 commit comments

Comments
 (0)