Skip to content
Permalink
Browse files

Test subqueries in conditions too.

  • Loading branch information...
ndm2
ndm2 committed Sep 8, 2016
1 parent 7ea595f commit d3a84aaac3810252cda628aed1dfb7598feb751b
Showing with 9 additions and 3 deletions.
  1. +9 −3 tests/TestCase/Database/QueryTest.php
@@ -2841,7 +2841,6 @@ public function testUpdateSetCallable()
*/
public function testUpdateStripAliasesFromConditions()
{
$this->loadFixtures('Authors');
$query = new Query($this->connection);
$query
@@ -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
);

0 comments on commit d3a84aa

Please sign in to comment.
You can’t perform that action at this time.