Example #1
0
 public function testGetPosition()
 {
     $col = new Collection();
     $this->assertEquals(0, $col->getPosition(), 'getPosition() returns 0 on an empty collection');
     $data = array('bar1', 'bar2', 'bar3');
     $col = new Collection($data);
     $expectedPositions = array(0, 1, 2);
     foreach ($col as $element) {
         $this->assertEquals(array_shift($expectedPositions), $col->getPosition(), 'getPosition() returns the current position');
         $this->assertEquals($element, $col->getCurrent(), 'getPosition() does not change the current position');
     }
 }