Skip to content

Commit

Permalink
Adding test for #4511
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Sep 6, 2014
1 parent 4d183f8 commit 7458089
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/TestCase/ORM/QueryRegressionTest.php
Expand Up @@ -439,4 +439,24 @@ public function testDeepBelongsToManySubqueryStrategy() {
collection($result[2]->articles[0]->tags)->extract('name')->toArray()
);
}

/**
* Tests that getting the count of a query having containments return
* the correct results
*
* @see https://github.com/cakephp/cakephp/issues/4511
* @return void
*/
public function testCountWithContain() {
$table = TableRegistry::get('Articles');
$table->belongsTo('Authors', ['joinType' => 'inner']);
$count = $table
->find()
->contain(['Authors' => function($q) {
return $q->where(['Authors.id' => 1]);
}])
->count();
$this->assertEquals(2, $count);
}

}

0 comments on commit 7458089

Please sign in to comment.