示例#1
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());
 }
 /**
  * Tests the isEmpty() method
  *
  * @return void
  */
 public function testIsEmpty()
 {
     $collection = new Collection([1, 2, 3]);
     $this->assertFalse($collection->isEmpty());
     $collection = $collection->map(function () {
         return null;
     });
     $this->assertFalse($collection->isEmpty());
     $collection = $collection->filter();
     $this->assertTrue($collection->isEmpty());
 }