Skip to content

Commit

Permalink
Test subqueries in conditions too.
Browse files Browse the repository at this point in the history
  • Loading branch information
ndm2 committed Sep 8, 2016
1 parent 7ea595f commit d3a84aa
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/TestCase/Database/QueryTest.php
Expand Up @@ -2841,7 +2841,6 @@ public function testUpdateSetCallable()
*/
public function testUpdateStripAliasesFromConditions()
{
$this->loadFixtures('Authors');
$query = new Query($this->connection);

$query
Expand All @@ -2854,14 +2853,21 @@ public function testUpdateStripAliasesFromConditions()
'b.name NOT IN' => ['foo', 'bar'],
'OR' => [
$query->newExpr()->eq(new IdentifierExpression('c.name'), 'zap'),
'd.name' => 'baz'
'd.name' => 'baz',
(new Query($this->connection))->select(['e.name'])->where(['e.name' => 'oof'])
]
]
],
]);

$this->assertQuotedQuery(
'UPDATE <authors> SET <name> = :c0 WHERE \(<id> = :c1 OR \(<name> not in \(:c2,:c3\) AND \(\(<c>\.<name>\) = :c4 OR <name> = :c5\)\)\)',
'UPDATE <authors> SET <name> = :c0 WHERE \(' .
'<id> = :c1 OR \(' .
'<name> not in \(:c2,:c3\) AND \(' .
'\(<c>\.<name>\) = :c4 OR <name> = :c5 OR \(SELECT <e>\.<name> WHERE <e>\.<name> = :c6\)' .
'\)' .
'\)' .
'\)',
$query->sql(),
!$this->autoQuote
);
Expand Down

0 comments on commit d3a84aa

Please sign in to comment.