@@ -38,10 +38,8 @@ public static function setUpBeforeClass()
38
38
if ('\\' === DIRECTORY_SEPARATOR && null === self ::$ symlinkOnWindows ) {
39
39
$ target = tempnam (sys_get_temp_dir (), 'sl ' );
40
40
$ link = sys_get_temp_dir ().'/sl ' .microtime (true ).mt_rand ();
41
- if (@symlink ($ target , $ link )) {
42
- self ::$ symlinkOnWindows = @is_link ($ link );
43
- unlink ($ link );
44
- }
41
+ self ::$ symlinkOnWindows = @symlink ($ target , $ link ) && is_link ($ link );
42
+ @unlink ($ link );
45
43
unlink ($ target );
46
44
}
47
45
}
@@ -61,6 +59,7 @@ protected function tearDown()
61
59
foreach ($ this ->longPathNamesWindows as $ path ) {
62
60
exec ('DEL ' .$ path );
63
61
}
62
+ $ this ->longPathNamesWindows = array ();
64
63
}
65
64
66
65
$ this ->filesystem ->remove ($ this ->workspace );
@@ -350,7 +349,7 @@ public function testRemoveCleansInvalidLinks()
350
349
351
350
// create symlink to nonexistent dir
352
351
rmdir ($ basePath .'dir ' );
353
- $ this ->assertFalse (is_dir ($ basePath .'dir-link ' ));
352
+ $ this ->assertFalse ('\\' === DIRECTORY_SEPARATOR ? @ readlink ( $ basePath . ' dir-link ' ) : is_dir ($ basePath .'dir-link ' ));
354
353
355
354
$ this ->filesystem ->remove ($ basePath );
356
355
@@ -742,6 +741,8 @@ public function testRemoveSymlink()
742
741
$ this ->filesystem ->remove ($ link );
743
742
744
743
$ this ->assertTrue (!is_link ($ link ));
744
+ $ this ->assertTrue (!is_file ($ link ));
745
+ $ this ->assertTrue (!is_dir ($ link ));
745
746
}
746
747
747
748
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget ()
@@ -915,7 +916,7 @@ public function testMirrorCopiesLinks()
915
916
$ this ->filesystem ->mirror ($ sourcePath , $ targetPath );
916
917
917
918
$ this ->assertTrue (is_dir ($ targetPath ));
918
- $ this ->assertFileEquals ($ sourcePath .'file1 ' , $ targetPath .DIRECTORY_SEPARATOR . 'link1 ' );
919
+ $ this ->assertFileEquals ($ sourcePath .'file1 ' , $ targetPath .'link1 ' );
919
920
$ this ->assertTrue (is_link ($ targetPath .DIRECTORY_SEPARATOR .'link1 ' ));
920
921
}
921
922
@@ -935,7 +936,7 @@ public function testMirrorCopiesLinkedDirectoryContents()
935
936
$ this ->filesystem ->mirror ($ sourcePath , $ targetPath );
936
937
937
938
$ this ->assertTrue (is_dir ($ targetPath ));
938
- $ this ->assertFileEquals ($ sourcePath .'/nested/file1.txt ' , $ targetPath .DIRECTORY_SEPARATOR . 'link1/file1.txt ' );
939
+ $ this ->assertFileEquals ($ sourcePath .'/nested/file1.txt ' , $ targetPath .'link1/file1.txt ' );
939
940
$ this ->assertTrue (is_link ($ targetPath .DIRECTORY_SEPARATOR .'link1 ' ));
940
941
}
941
942
@@ -959,7 +960,7 @@ public function testMirrorCopiesRelativeLinkedContents()
959
960
$ this ->filesystem ->mirror ($ sourcePath , $ targetPath );
960
961
961
962
$ this ->assertTrue (is_dir ($ targetPath ));
962
- $ this ->assertFileEquals ($ sourcePath .'/nested/file1.txt ' , $ targetPath .DIRECTORY_SEPARATOR . 'link1/file1.txt ' );
963
+ $ this ->assertFileEquals ($ sourcePath .'/nested/file1.txt ' , $ targetPath .'link1/file1.txt ' );
963
964
$ this ->assertTrue (is_link ($ targetPath .DIRECTORY_SEPARATOR .'link1 ' ));
964
965
$ this ->assertEquals ('nested ' , readlink ($ targetPath .DIRECTORY_SEPARATOR .'link1 ' ));
965
966
}
@@ -1089,7 +1090,7 @@ private function markAsSkippedIfChmodIsMissing()
1089
1090
1090
1091
private function markAsSkippedIfPosixIsMissing ()
1091
1092
{
1092
- if ('\\' === DIRECTORY_SEPARATOR || !function_exists ('posix_isatty ' )) {
1093
+ if (!function_exists ('posix_isatty ' )) {
1093
1094
$ this ->markTestSkipped ('POSIX is not supported ' );
1094
1095
}
1095
1096
}
0 commit comments