Skip to content
Permalink
Browse files

Adding test for #4511

  • Loading branch information...
lorenzo committed Sep 6, 2014
1 parent 4d183f8 commit 745808910df95950e2559019893ee8661fbf6a8b
Showing with 20 additions and 0 deletions.
  1. +20 −0 tests/TestCase/ORM/QueryRegressionTest.php
@@ -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.
You can’t perform that action at this time.