diff --git a/tests/TestCase/ORM/QueryTest.php b/tests/TestCase/ORM/QueryTest.php index 57636169916..50f26517a50 100644 --- a/tests/TestCase/ORM/QueryTest.php +++ b/tests/TestCase/ORM/QueryTest.php @@ -1861,6 +1861,24 @@ public function testContainWithQueryBuilderJoinableAssociation() $this->assertEquals(1, $result[0]->author->id); } + /** + * Test containing associations that have empty conditions. + * + * @return void + */ + public function testContainAssociationWithEmptyConditions() + { + $articles = TableRegistry::get('Articles'); + $articles->belongsTo('Authors', [ + 'conditions' => function ($exp, $query) { + return $exp; + } + ]); + $query = $articles->find('all')->contain(['Authors']); + $result = $query->toArray(); + $this->assertCount(4, $result); + } + /** * Tests the formatResults method *