public function testUseAIteratorAndValidateAuthors($expected) { $iterator = new BookListIterator($this->bookList); while ($iterator->valid()) { $expectedBook = array_shift($expected); $this->assertEquals($expectedBook, $iterator->current()->getAuthorAndTitle()); $iterator->next(); } }