/** * @covers ::current * @covers ::key * @covers ::next * @covers ::rewind * @covers ::valid */ public function testIterator() { $source = [new Model(), new Model()]; $models = new Models($source); $key = $models->key(); foreach ($models as $i => $model) { $this->assertSame(current($source), $model); next($source); } }
/** * Implement Iterator */ public function key() { return $this->current->key(); }