/**
  * Tests the append method
  *
  * @return void
  */
 public function testAppend()
 {
     $collection = new Collection([1, 2, 3]);
     $combined = $collection->append([4, 5, 6]);
     $this->assertEquals([1, 2, 3, 4, 5, 6], $combined->toArray(false));
     $collection = new Collection(['a' => 1, 'b' => 2]);
     $combined = $collection->append(['c' => 3, 'a' => 4]);
     $this->assertEquals(['a' => 4, 'b' => 2, 'c' => 3], $combined->toArray());
 }
Beispiel #2
0
 /**
  * Tests the append method with iterator
  */
 public function testAppendIterator()
 {
     $collection = new Collection([1, 2, 3]);
     $iterator = new ArrayIterator([4, 5, 6]);
     $combined = $collection->append($iterator);
     $this->assertEquals([1, 2, 3, 4, 5, 6], $combined->toList());
 }