Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[FileSystem] remove symlinks under windows

  • Loading branch information...
commit e1a53954e2d369cdba346ef1b7bd9e5cf113c1cd 1 parent e1f7c29
@ErikTrapman ErikTrapman authored
Showing with 17 additions and 1 deletion.
  1. +3 −1 Filesystem.php
  2. +14 −0 Tests/FilesystemTest.php
View
4 Filesystem.php
@@ -94,7 +94,9 @@ public function remove($files)
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
14 Tests/FilesystemTest.php
@@ -421,6 +421,20 @@ public function testSymlink()
$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()
{
Please sign in to comment.
Something went wrong with that request. Please try again.