Skip to content

Commit

Permalink
Adding missing test case form previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Dec 31, 2012
1 parent 49fd02c commit 8555ff5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php
Expand Up @@ -467,4 +467,21 @@ public function testSelectOrWhereNoPreviousCondition() {
$this->assertEquals(['id' => 2], $result->fetch('assoc'));
}

/**
* Tests that Query::andWhere() can be used without calling where() before
*
* @return void
**/
public function testSelectAndWhereNoPreviousCondition() {
$this->_insertDateRecords();
$query = new Query($this->connection);
$result = $query
->select(['id'])
->from('dates')
->andWhere(['posted' => new \DateTime('2012-12-21 12:00')], ['posted' => 'datetime'])
->andWhere(['id' => 1])
->execute();
$this->assertCount(1, $result);
$this->assertEquals(['id' => 1], $result->fetch('assoc'));
}
}

0 comments on commit 8555ff5

Please sign in to comment.