/** * @dataProvider findRelativePathProvider */ public function test_findRelativePath_returnsCorrectPath($parentPath, $childPath, $expected) { $actual = PathWorker::findRelativePath($parentPath, $childPath); $this->assertEquals($expected, $actual); }
/** * 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; }