Browse Source

Moving test case to another file

Jose Lorenzo Rodriguez 10 years ago
parent
commit
c003498ef7

+ 22 - 0
tests/TestCase/ORM/Association/BelongsToManyTest.php

@@ -913,4 +913,26 @@ class BelongsToManyTest extends TestCase
         $association = new BelongsToMany('Contacts.Tags', $config);
         $this->assertEquals('tags', $association->property());
     }
+
+    /**
+     * Tests that fetching belongsToMany association will not force
+     * all fields being returned, but intead will honor the select() clause
+     *
+     * @see https://github.com/cakephp/cakephp/issues/7916
+     * @return void
+     */
+    public function testEagerLoadingBelongsToManyLimitedFields()
+    {
+        $table = TableRegistry::get('Articles');
+        $table->belongsToMany('Tags');
+        $result = $table
+            ->find()
+            ->contain(['Tags' => function ($q) {
+                return $q->select(['id']);
+            }])
+            ->first();
+
+        $this->assertNotEmpty($result->tags[0]->id);
+        $this->assertEmpty($result->tags[0]->name);
+    }
 }

+ 0 - 22
tests/TestCase/ORM/QueryRegressionTest.php

@@ -1236,26 +1236,4 @@ class QueryRegressionTest extends TestCase
         // Not executing the query first, just getting the count
         $this->assertEquals(3, $query->count());
     }
-
-    /**
-     * Tests that fetching belongsToMany association will not force
-     * all fields being returned, but intead will honor the select() clause
-     *
-     * @see https://github.com/cakephp/cakephp/issues/7913
-     * @return void
-     */
-    public function testEagerLoadingBelongsToManyLimitedFields()
-    {
-        $table = TableRegistry::get('Articles');
-        $table->belongsToMany('Tags');
-        $result = $table
-            ->find()
-            ->contain(['Tags' => function ($q) {
-                return $q->select(['id']);
-            }])
-            ->first();
-
-        $this->assertNotEmpty($result->tags[0]->id);
-        $this->assertEmpty($result->tags[0]->name);
-    }
 }