Skip to content

Commit

Permalink
Merge pull request #176 from phpcr/test-date
Browse files Browse the repository at this point in the history
testing date in queries
  • Loading branch information
lsmith77 committed Jan 18, 2016
2 parents 92b5028 + 2b71365 commit 4816315
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/Query/QuerySql2OperationsTest.php
Expand Up @@ -47,6 +47,26 @@ public function testQueryField()
$this->assertEquals(array('bar'), $vals);
}

public function testQueryFieldDate()
{
/** @var $query QueryInterface */
$query = $this->sharedFixture['qm']->createQuery("
SELECT *
FROM [nt:base]
WHERE [mydateprop] <= CAST('2011-04-27T13:01:07.472+02:00' AS DATE)
AND [mydateprop] >= CAST('2011-04-01T13:01:07.472+02:00' AS DATE)
AND (ISSAMENODE([/tests_general_base]) OR ISDESCENDANTNODE([/tests_general_base]))
",
QueryInterface::JCR_SQL2
);

$result = $query->execute();
$this->assertCount(1, $result->getRows());
/** @var RowInterface $row */
$row = $result->getRows()->current();
$this->assertEquals('/tests_general_base/index.txt/jcr:content', $row->getPath());
}

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

0 comments on commit 4816315

Please sign in to comment.