Skip to content
Permalink
Browse files

Fixing test case to reflect a more real use case

  • Loading branch information...
lorenzo committed Jun 23, 2016
1 parent c55d553 commit 1dbaf1794cb69ae810a372734e6ebd395ff5eaa2
Showing with 5 additions and 6 deletions.
  1. +5 −6 tests/TestCase/ORM/QueryTest.php
@@ -2993,22 +2993,21 @@ public function testLeftJoinWithNested()
$results = $table
->find()
->select(['total_articles' => 'count(articles.id)'])
->select([
'authors.id',
'total_articles' => 'count(tags.id)'])
->leftJoinWith('articles.tags', function ($q) {
return $q->where(['tags.name' => 'tag3']);
})
->autoFields(true)
->group(['authors.id', 'authors.name']);
->group(['authors.id']);
$expected = [
1 => 2,
1 => 0,
2 => 0,
3 => 1,
4 => 0
];
$this->assertEquals($expected, $results->combine('id', 'total_articles')->toArray());
$fields = ['total_articles', 'id', 'name'];
$this->assertEquals($fields, array_keys($results->first()->toArray()));
}
/**

0 comments on commit 1dbaf17

Please sign in to comment.
You can’t perform that action at this time.