Browse Source

Fixing test case to reflect a more real use case

Jose Lorenzo Rodriguez 9 years ago
parent
commit
1dbaf1794c
1 changed files with 5 additions and 6 deletions
  1. 5 6
      tests/TestCase/ORM/QueryTest.php

+ 5 - 6
tests/TestCase/ORM/QueryTest.php

@@ -2993,22 +2993,21 @@ class QueryTest extends TestCase
 
         $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()));
     }
 
     /**