[Filesystem] symlink use RealPath instead LinkTarget
This commit is contained in:
parent
6945a2a15a
commit
a8b8d33e94
@ -405,7 +405,7 @@ class Filesystem
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_link($file)) {
|
if (is_link($file)) {
|
||||||
$this->symlink($file->getLinkTarget(), $target);
|
$this->symlink($file->getRealPath(), $target);
|
||||||
} elseif (is_dir($file)) {
|
} elseif (is_dir($file)) {
|
||||||
$this->mkdir($target);
|
$this->mkdir($target);
|
||||||
} elseif (is_file($file)) {
|
} elseif (is_file($file)) {
|
||||||
|
@ -899,6 +899,31 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
$this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMirrorCopiesRelativeLinkedContents()
|
||||||
|
{
|
||||||
|
$this->markAsSkippedIfSymlinkIsMissing();
|
||||||
|
|
||||||
|
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||||
|
$oldPath = getcwd();
|
||||||
|
|
||||||
|
mkdir($sourcePath.'nested/', 0777, true);
|
||||||
|
file_put_contents($sourcePath.'/nested/file1.txt', 'FILE1');
|
||||||
|
// Note: Create relative symlink
|
||||||
|
chdir($sourcePath);
|
||||||
|
symlink('nested', 'link1');
|
||||||
|
|
||||||
|
chdir($oldPath);
|
||||||
|
|
||||||
|
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
|
$this->filesystem->mirror($sourcePath, $targetPath);
|
||||||
|
|
||||||
|
$this->assertTrue(is_dir($targetPath));
|
||||||
|
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.DIRECTORY_SEPARATOR.'link1/file1.txt');
|
||||||
|
$this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
||||||
|
$this->assertEquals($sourcePath.'nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider providePathsForIsAbsolutePath
|
* @dataProvider providePathsForIsAbsolutePath
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user