/**
  * @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);
 }
Ejemplo n.º 3
0
 public function rewind()
 {
     if (false === $this->isRewindable()) {
         return;
     }
     parent::next();
     parent::rewind();
 }
Ejemplo n.º 4
0
 /**
  * @return mixed object
  *
  * @throws AccessDeniedException
  */
 public function getChildren()
 {
     try {
         return parent::getChildren();
     } catch (\UnexpectedValueException $e) {
         throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
     }
 }
 /**
  * Do nothing for non rewindable stream
  */
 public function rewind()
 {
     if (false === $this->isRewindable()) {
         return;
     }
     // @see https://bugs.php.net/bug.php?id=49104
     parent::next();
     parent::rewind();
 }
Ejemplo n.º 6
0
 public function rewind()
 {
     if (false === $this->isRewindable()) {
         return;
     }
     if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
         parent::next();
     }
     parent::rewind();
 }
 /**
  * @return \RecursiveIterator
  *
  * @throws AccessDeniedException
  */
 public function getChildren()
 {
     try {
         return parent::getChildren();
     } catch (\UnexpectedValueException $e) {
         if ($this->ignoreUnreadableDirs) {
             // If directory is unreadable and finder is set to ignore it, a fake empty content is returned.
             return new \RecursiveArrayIterator(array());
         } else {
             throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
         }
     }
 }
Ejemplo n.º 8
0
 /**
  * Return an instance of SplFileInfo with support for relative paths
  *
  * @return SplFileInfo File information
  */
 public function current()
 {
     return new SplFileInfo(parent::current()->getPathname(), $this->getSubPath(), $this->getSubPathname());
 }
 /**
  * Do nothing for non rewindable stream.
  */
 public function rewind()
 {
     if (false === $this->isRewindable()) {
         return;
     }
     // @see https://bugs.php.net/68557
     if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
         parent::next();
     }
     parent::rewind();
 }