예제 #1
0
 /**
  * Test toArray method
  *
  * @return void
  */
 public function testToArray()
 {
     $data = [1, 2, 3, 4];
     $collection = new Collection($data);
     $this->assertEquals($data, $collection->toArray());
 }
예제 #2
0
 /**
  * Tests the isEmpty() method does not consume data
  * from buffered iterators.
  *
  * @return void
  */
 public function testIsEmptyDoesNotConsume()
 {
     $array = new \ArrayIterator([1, 2, 3]);
     $inner = new \Cake\Collection\Iterator\BufferedIterator($array);
     $collection = new Collection($inner);
     $this->assertFalse($collection->isEmpty());
     $this->assertCount(3, $collection->toArray());
 }