diff --git a/src/Database/IdentifierQuoter.php b/src/Database/IdentifierQuoter.php index cfd8588968f..1f46032a116 100644 --- a/src/Database/IdentifierQuoter.php +++ b/src/Database/IdentifierQuoter.php @@ -190,13 +190,12 @@ protected function _quoteComparison(Comparison $expression) { } $expression->field($quoted); } elseif ($field instanceof ExpressionInterface) { - $expression->field($this->quoteExpression($field)); + $this->quoteExpression($field); } $value = $expression->getValue(); if ($value instanceof ExpressionInterface) { $this->quoteExpression($value); - $expression->value($value); } } diff --git a/tests/TestCase/Database/QueryTest.php b/tests/TestCase/Database/QueryTest.php index 62372eb8bd6..ef212d81fc3 100644 --- a/tests/TestCase/Database/QueryTest.php +++ b/tests/TestCase/Database/QueryTest.php @@ -871,11 +871,9 @@ public function testSelectWhereUsingExpressionInField() { $field = clone $exp; $field->add('SELECT min(id) FROM comments'); return $exp - ->gt($field, 100, 'integer'); - }); - - debug($result->sql()); - $rsult = $result->execute(); + ->eq($field, 100, 'integer'); + }) + ->execute(); $this->assertCount(0, $result); }