[FileSystem] remove symlinks under windows
This commit is contained in:
parent
66ff06096c
commit
0b58828b3f
@ -94,7 +94,9 @@ class Filesystem
|
|||||||
|
|
||||||
if (is_dir($file) && !is_link($file)) {
|
if (is_dir($file) && !is_link($file)) {
|
||||||
$this->remove(new \FilesystemIterator($file));
|
$this->remove(new \FilesystemIterator($file));
|
||||||
|
rmdir($file);
|
||||||
|
} elseif(is_dir($file) && is_link($file)) {
|
||||||
|
// https://bugs.php.net/bug.php?id=52176 windows thinks symlinks are directories
|
||||||
rmdir($file);
|
rmdir($file);
|
||||||
} else {
|
} else {
|
||||||
unlink($file);
|
unlink($file);
|
||||||
|
@ -421,6 +421,20 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue(is_link($link));
|
$this->assertTrue(is_link($link));
|
||||||
$this->assertEquals($file, readlink($link));
|
$this->assertEquals($file, readlink($link));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @depends testSymlink
|
||||||
|
*/
|
||||||
|
public function testRemoveSymlink()
|
||||||
|
{
|
||||||
|
$this->markAsSkippedIfSymlinkIsMissing();
|
||||||
|
|
||||||
|
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||||
|
|
||||||
|
$this->filesystem->remove($link);
|
||||||
|
|
||||||
|
$this->assertTrue(!is_link($link));
|
||||||
|
}
|
||||||
|
|
||||||
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
|
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user