Пример #1
0
 /**
  * @dataProvider findRelativePathProvider
  */
 public function test_findRelativePath_returnsCorrectPath($parentPath, $childPath, $expected)
 {
     $actual = PathWorker::findRelativePath($parentPath, $childPath);
     $this->assertEquals($expected, $actual);
 }
Пример #2
0
 /**
  * Attempts to determine a file path using the specified read directories
  *
  * @param   string     $mockDir       Directory where file should be saved
  * @param   string     $targetFileDir Path to target entity
  * @param   ConfigData $config        ConfigData object
  * @return  string
  */
 private function tryForReadDirBasedPath($mockDir, $targetFileDir, ConfigData $config)
 {
     // this is only really required if we're recursing dirs for files
     $readDirs = $config->getReadDirectories();
     if (empty($readDirs) || !$config->getPreserveDirStructure()) {
         return $mockDir;
     }
     if (!($targetOriginDir = $this->findTargetFileOriginDir($readDirs, $targetFileDir))) {
         return $mockDir;
     }
     $relPath = PathWorker::findRelativePath($targetOriginDir, $targetFileDir);
     return $mockDir . $relPath;
 }