bug #12761 [Filesystem] symlink use RealPath instead LinkTarget (aitboudad)
This PR was squashed before being merged into the 2.3 branch (closes #12761).
Discussion
----------
[Filesystem] symlink use RealPath instead LinkTarget
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
Commits
-------
a8b8d33
[Filesystem] symlink use RealPath instead LinkTarget
This commit is contained in:
commit
122e117264
@ -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