/** * Test toArray method * * @return void */ public function testToArray() { $data = [1, 2, 3, 4]; $collection = new Collection($data); $this->assertEquals($data, $collection->toArray()); }
/** * 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()); }