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