[FileSystem] remove symlinks under windows

This commit is contained in:
Erik Trapman 2012-06-13 10:26:28 +02:00
parent 66ff06096c
commit 0b58828b3f
2 changed files with 17 additions and 1 deletions

View File

@ -94,7 +94,9 @@ class Filesystem
if (is_dir($file) && !is_link($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);
} else {
unlink($file);

View File

@ -421,6 +421,20 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(is_link($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()
{