Skip to content

[WIP] Test join on issamenode #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions fixtures/general/base.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>nt:unstructured</sv:value>
</sv:property>
<sv:property sv:name="jcr:mixinType" sv:type="Name" sv:multiple="true">
<sv:value>mix:referenceable</sv:value>
</sv:property>

<sv:property sv:name="foo" sv:type="String">
<sv:value>bar</sv:value>
Expand Down
50 changes: 50 additions & 0 deletions tests/06_Query/QuerySql2OperationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,56 @@ public function testQueryJoinChildnode()
$this->assertEquals(array(999), $vals);
}

public function testQueryJoinSamenode()
{
/** @var $query QueryInterface */
$query = $this->sharedFixture['qm']->createQuery('
SELECT [nt:unstructured].longNumber
FROM [nt:unstructured]
INNER JOIN [nt:file]
ON ISSAMENODE([nt:unstructured], [nt:file], "jcr:content")
WHERE [nt:unstructured].longNumber = 999
AND ISDESCENDANTNODE([nt:unstructured], [/tests_general_base])
',
QueryInterface::JCR_SQL2
);

$this->assertInstanceOf('\PHPCR\Query\QueryInterface', $query);
$result = $query->execute();
$this->assertInstanceOf('\PHPCR\Query\QueryResultInterface', $result);
$vals = array();

foreach ($result->getRows() as $row) {
$vals[] = $row->getValue('nt:file.path');
}
$this->assertEquals(array(999), $vals);
}

public function testQueryJoinSamenodeIdent()
{
/** @var $query QueryInterface */
$query = $this->sharedFixture['qm']->createQuery('
SELECT [nt:unstructured].longNumber
FROM [nt:unstructured]
INNER JOIN [mix:referenceable]
ON ISSAMENODE([mix:referenceable], [nt:unstructured])
WHERE [nt:unstructured].longNumber = 999
AND ISDESCENDANTNODE([nt:unstructured], [/tests_general_base])
',
QueryInterface::JCR_SQL2
);

$this->assertInstanceOf('\PHPCR\Query\QueryInterface', $query);
$result = $query->execute();
$this->assertInstanceOf('\PHPCR\Query\QueryResultInterface', $result);
$vals = array();

foreach ($result->getRows() as $row) {
$vals[] = $row->getValue('nt:file.path');
}
$this->assertEquals(array(999), $vals);
}

public function testQueryOrder()
{
/** @var $query QueryInterface */
Expand Down