Example #1
0
 public function testIsFirst()
 {
     $col = new Collection();
     $this->assertTrue($col->isFirst(), 'isFirst() returns true on an empty collection');
     $data = array('bar1', 'bar2', 'bar3');
     $col = new Collection($data);
     $expectedRes = array(true, false, false);
     foreach ($col as $element) {
         $this->assertEquals(array_shift($expectedRes), $col->isFirst(), 'isFirst() returns true only for the first element');
         $this->assertEquals($element, $col->getCurrent(), 'isFirst() does not change the current position');
     }
 }