File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,23 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
2828 */
2929 private $ filesystem = null ;
3030
31+ private static $ symlinkOnWindows = null ;
32+
33+ public static function setUpBeforeClass ()
34+ {
35+ if (defined ('PHP_WINDOWS_VERSION_MAJOR ' )) {
36+ self ::$ symlinkOnWindows = true ;
37+ $ originDir = tempnam (sys_get_temp_dir (), 'sl ' );
38+ $ targetDir = tempnam (sys_get_temp_dir (), 'sl ' );
39+ if (true !== @symlink ($ originDir , $ targetDir )) {
40+ $ report = error_get_last ();
41+ if (is_array ($ report ) && false !== strpos ($ report ['message ' ], 'error code(1314) ' )) {
42+ self ::$ symlinkOnWindows = false ;
43+ }
44+ }
45+ }
46+ }
47+
3148 public function setUp ()
3249 {
3350 $ this ->filesystem = new Filesystem ();
@@ -863,6 +880,10 @@ private function markAsSkippedIfSymlinkIsMissing()
863880 if (!function_exists ('symlink ' )) {
864881 $ this ->markTestSkipped ('symlink is not supported ' );
865882 }
883+
884+ if (defined ('PHP_WINDOWS_VERSION_MAJOR ' ) && false === self ::$ symlinkOnWindows ) {
885+ $ this ->markTestSkipped ('symlink requires "Create symbolic links" privilege on windows ' );
886+ }
866887 }
867888
868889 private function markAsSkippedIfChmodIsMissing ()
You can’t perform that action at this time.
0 commit comments