Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added test for Collection::insert()

  • Loading branch information...
commit 1538bd32f950217f546f30b51dedccd06bbdc412 1 parent 68e90dd
@lorenzo lorenzo authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 tests/TestCase/Collection/CollectionTest.php
View
16 tests/TestCase/Collection/CollectionTest.php
@@ -839,4 +839,20 @@ public function testNestObjects() {
$this->assertEquals($expected, $collection->toArray());
}
+/**
+ * Tests insert
+ *
+ * @return void
+ */
+ public function testInsert() {
+ $items = [['a' => 1], ['b' => 2]];
+ $collection = new Collection($items);
+ $iterator = $collection->insert('c', [3, 4]);
+ $this->assertInstanceOf('\Cake\Collection\Iterator\InsertIterator', $iterator);
+ $this->assertEquals(
+ [['a' => 1, 'c' => 3], ['b' => 2, 'c' => 4]],
+ iterator_to_array($iterator)
+ );
+ }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.