/** * @dataProvider getPaths * * @param string $path * @param bool $seekable * @param array $contains * @param string $message */ public function testSeek($path, $seekable, $contains, $message = null) { try { $i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS); } catch (\UnexpectedValueException $e) { $this->markTestSkipped(sprintf('Unsupported stream "%s".', $path)); } $actual = array(); $i->seek(0); $actual[] = $i->getPathname(); $i->seek(1); $actual[] = $i->getPathname(); $this->assertEquals($contains, $actual); }
/** * @group network */ public function testSeekOnFtp() { try { $i = new RecursiveDirectoryIterator('ftp://speedtest.tele2.net/', \RecursiveDirectoryIterator::SKIP_DOTS); } catch (\UnexpectedValueException $e) { $this->markTestSkipped('Unsupported stream "ftp".'); } $contains = array('ftp://speedtest.tele2.net' . DIRECTORY_SEPARATOR . '1000GB.zip', 'ftp://speedtest.tele2.net' . DIRECTORY_SEPARATOR . '100GB.zip'); $actual = array(); $i->seek(0); $actual[] = $i->getPathname(); $i->seek(1); $actual[] = $i->getPathname(); $this->assertEquals($contains, $actual); }