diff --git a/fixtures/general/base.xml b/fixtures/general/base.xml
index 9da9e31e..7beddb5e 100644
--- a/fixtures/general/base.xml
+++ b/fixtures/general/base.xml
@@ -239,6 +239,9 @@
nt:unstructured
+
+ mix:referenceable
+
bar
diff --git a/tests/06_Query/QuerySql2OperationsTest.php b/tests/06_Query/QuerySql2OperationsTest.php
index 2c19be6c..9e625522 100644
--- a/tests/06_Query/QuerySql2OperationsTest.php
+++ b/tests/06_Query/QuerySql2OperationsTest.php
@@ -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 */