Skip to content

Commit 4816315

Browse files
committed
Merge pull request #176 from phpcr/test-date
testing date in queries
2 parents 92b5028 + 2b71365 commit 4816315

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/Query/QuerySql2OperationsTest.php

+20
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,26 @@ public function testQueryField()
4747
$this->assertEquals(array('bar'), $vals);
4848
}
4949

50+
public function testQueryFieldDate()
51+
{
52+
/** @var $query QueryInterface */
53+
$query = $this->sharedFixture['qm']->createQuery("
54+
SELECT *
55+
FROM [nt:base]
56+
WHERE [mydateprop] <= CAST('2011-04-27T13:01:07.472+02:00' AS DATE)
57+
AND [mydateprop] >= CAST('2011-04-01T13:01:07.472+02:00' AS DATE)
58+
AND (ISSAMENODE([/tests_general_base]) OR ISDESCENDANTNODE([/tests_general_base]))
59+
",
60+
QueryInterface::JCR_SQL2
61+
);
62+
63+
$result = $query->execute();
64+
$this->assertCount(1, $result->getRows());
65+
/** @var RowInterface $row */
66+
$row = $result->getRows()->current();
67+
$this->assertEquals('/tests_general_base/index.txt/jcr:content', $row->getPath());
68+
}
69+
5070
public function testQueryFieldSomeNull()
5171
{
5272
/** @var $query QueryInterface */

0 commit comments

Comments
 (0)