示例#1
0
 public function testGetNext()
 {
     $col = new Collection();
     $this->assertNull($col->getNext(), 'getNext() returns null on an empty collection');
     $data = array('bar1', 'bar2', 'bar3');
     $col = new Collection($data);
     $this->assertEquals('bar2', $col->getNext(), 'getNext() returns the second element when the internal pointer is at the beginning of the list');
     $this->assertEquals('bar2', $col->getCurrent(), 'getNext() increments the internal pointer');
     $col->getNext();
     $this->assertNull($col->getNext(), 'getNext() returns null when the internal pointer is at the end of the list');
 }