diff --git a/tests/TestCase/ORM/QueryRegressionTest.php b/tests/TestCase/ORM/QueryRegressionTest.php index bf3c7a30868..c952c2722f6 100644 --- a/tests/TestCase/ORM/QueryRegressionTest.php +++ b/tests/TestCase/ORM/QueryRegressionTest.php @@ -502,4 +502,23 @@ public function testContainNoEmptyAssociatedObjects() { $this->assertNull($result->user, 'No record should be null.'); } +/** + * Tests that using a comparison expression inside an OR condition works + * + * @see https://github.com/cakephp/cakephp/issues/5081 + * @return void + */ + public function testOrConditionsWithExpression() { + $table = TableRegistry::get('Articles'); + $query = $table->find(); + $query->where([ + 'OR' => [ + new \Cake\Database\Expression\Comparison('id', 1, 'integer', '>') + ] + ]); + + $results = $query->toArray(); + $this->assertCount(3, $results); + } + }