Skip to content

Commit

Permalink
Adding test to prove that type are still correctly used when biding
Browse files Browse the repository at this point in the history
values inside a subquery
  • Loading branch information
lorenzo committed Jan 16, 2013
1 parent 9470451 commit 3b1e759
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php
Expand Up @@ -1354,6 +1354,22 @@ public function testSuqueryInWhere() {
['name' => 'Jet Li']
];
$this->assertEquals($expected, $result->fetchAll('assoc'));

$query = new Query($this->connection);
$subquery = (new Query($this->connection))
->select(['id'])
->from('dates')
->where(['posted >' => new \DateTime('2012-12-21 12:00')], ['posted' => 'datetime']);
$result = $query
->select(['name'])
->from(['authors'])
->where(['id !=' => $subquery])
->execute();

$expected = [
['name' => 'Chuck Norris'],
];
$this->assertEquals($expected, $result->fetchAll('assoc'));
}

}

0 comments on commit 3b1e759

Please sign in to comment.