public function testCallIteratorMethods() { $methods = ['getPosition', 'isFirst', 'isLast', 'isOdd', 'isEven']; $data = array('bar1', 'bar2', 'bar3'); $col = new Collection($data); $it = $col->getIterator(); foreach ($it as $item) { foreach ($methods as $method) { $this->assertNotNull($it->{$method}(), $method . '() returns a not null value'); } } }
public function testGetIterator() { $data = array('bar1', 'bar2', 'bar3'); $col = new Collection($data); $it1 = $col->getIterator(); $it2 = $col->getIterator(); $this->assertNotSame($it1, $it2, 'getIterator() returns always a new iterator'); }