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