Skip to content

Commit 753aa92

Browse files
committed
Merge pull request #179 from phpcr/multi_num_comp
Test comparing multiple LONG property in query
2 parents 772f2df + b70a78c commit 753aa92

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

fixtures/general/base.xml

+6
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,12 @@
360360
<sv:value>2</sv:value>
361361
</sv:property>
362362

363+
<sv:property sv:name="longNumberToCompareMulti" sv:type="Long" sv:multiple="true">
364+
<sv:value>4</sv:value>
365+
<sv:value>2</sv:value>
366+
<sv:value>8</sv:value>
367+
</sv:property>
368+
363369
<sv:property sv:name="stringToCompare" sv:type="String">
364370
<sv:value>2</sv:value>
365371
</sv:property>

tests/Query/QueryResultsTest.php

+24
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,30 @@ public function testCompareNumberFields()
172172
$this->assertEquals(10, $rows[0]->getValue('data.longNumberToCompare'));
173173
}
174174

175+
public function testCompareNumberFieldsMulti()
176+
{
177+
$query = $this->sharedFixture['qm']->createQuery('
178+
SELECT data.longNumberToCompareMulti
179+
FROM [nt:unstructured] AS data
180+
WHERE data.longNumberToCompareMulti = 2
181+
AND ISDESCENDANTNODE([/tests_general_base])
182+
',
183+
\PHPCR\Query\QueryInterface::JCR_SQL2
184+
);
185+
$result = $query->execute();
186+
187+
$rows = array();
188+
foreach ($result->getRows() as $row) {
189+
$rows[] = $row;
190+
}
191+
192+
$this->assertCount(1, $rows);
193+
194+
// returning a string value is, perhaps suprisingly, the correct behavior.
195+
$this->assertEquals('4 2 8', $rows[0]->getValue('data.longNumberToCompareMulti'));
196+
}
197+
198+
175199
public function testCompareStringFields()
176200
{
177201
$query = $this->sharedFixture['qm']->createQuery(

0 commit comments

Comments
 (0)