Пример #1
0
 public function seeRightPathConvert()
 {
     $data = ['phar:///test\\data\\.\\..\\..\\data/.////./Windows/\\..\\../.\\data1.phar' => 'phar:///data1.phar', 'phar://' => 'phar://' . getcwd(), 'phar://C:\\test\\./data\\.\\..\\..\\data/.////./Windows/\\../.\\data.phar' => 'phar://C:/data/data.phar', __DIR__ . '/../../.' => realpath(__DIR__ . '/../../.')];
     foreach ($data as $path => $expected) {
         $this->assertEquals($expected, helpers\FileHelper::realPath($path));
     }
 }
Пример #2
0
 /**
  * @return string
  */
 public function getRelativePath()
 {
     $path = substr(FileHelper::realPath($this->iterator->current()->getPathname()), strlen($this->initPath));
     if ($path[0] === '/') {
         $path = substr($path, 1);
     }
     return $path;
 }