Browse Source

Add tests for Table::saveMany()

ADmad 10 years ago
parent
commit
453f3c2ed2
1 changed files with 18 additions and 0 deletions
  1. 18 0
      tests/TestCase/ORM/TableTest.php

+ 18 - 0
tests/TestCase/ORM/TableTest.php

@@ -2778,6 +2778,24 @@ class TableTest extends TestCase
     }
 
     /**
+     * Test saveMany() with entities array
+     *
+     * @return void
+     */
+    public function testSaveManyArray()
+    {
+        $entities = [
+            new Entity(['name' => 'admad']),
+            new Entity(['name' => 'dakota'])
+        ];
+
+        $table = TableRegistry::get('authors');
+        $result = $table->saveMany($entities);
+        $this->assertSame($entities, $result);
+        $this->assertTrue(isset($result[0]->id));
+    }
+
+    /**
      * Test simple delete.
      *
      * @return void