public function testIteration() { $listing = array('a', 'b', 'c'); $iterator = new DirectoryBuffer($listing); $i = 0; while ($iterator->valid()) { $this->assertEquals($listing[$i], $iterator->current()); $this->assertEquals($i, $iterator->key()); $i++; $iterator->next(); } $this->assertEquals(count($listing), $i); $iterator->rewind(); $this->assertEquals(reset($listing), $iterator->current()); $this->assertEquals(key($listing), $iterator->key()); }
/** * streamWrapper::dir_rewinddir — Rewind directory handle * * @return boolean Returns TRUE on success or FALSE on failure. */ public function dir_rewinddir() { $this->dirBuffer->rewind(); return true; }