@@ -17,7 +17,7 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
1717{
1818 private $ umask ;
1919
20- static protected $ longPathNamesWindows = array ();
20+ protected $ longPathNamesWindows = array ();
2121
2222 /**
2323 * @var \Symfony\Component\Filesystem\Filesystem
@@ -33,12 +33,6 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
3333
3434 public static function setUpBeforeClass ()
3535 {
36- if (!empty (self ::$ longPathNamesWindows )) {
37- foreach (self ::$ longPathNamesWindows as $ path ) {
38- exec ('DEL ' .$ path );
39- }
40- }
41-
4236 if ('\\' === DIRECTORY_SEPARATOR && null === self ::$ symlinkOnWindows ) {
4337 $ target = tempnam (sys_get_temp_dir (), 'sl ' );
4438 $ link = sys_get_temp_dir ().'/sl ' .microtime (true ).mt_rand ();
@@ -52,14 +46,21 @@ public static function setUpBeforeClass()
5246 protected function setUp ()
5347 {
5448 $ this ->umask = umask (0 );
49+ $ this ->filesystem = new Filesystem ();
5550 $ this ->workspace = rtrim (sys_get_temp_dir (), DIRECTORY_SEPARATOR ).DIRECTORY_SEPARATOR .time ().mt_rand (0 , 1000 );
5651 mkdir ($ this ->workspace , 0777 , true );
5752 $ this ->workspace = realpath ($ this ->workspace );
58- $ this ->filesystem = new Filesystem ();
5953 }
6054
6155 protected function tearDown ()
6256 {
57+ if (!empty ($ this ->longPathNamesWindows )) {
58+ foreach ($ this ->longPathNamesWindows as $ path ) {
59+ exec ('DEL ' .$ path );
60+ }
61+ $ this ->longPathNamesWindows = array ();
62+ }
63+
6364 $ this ->filesystem ->remove ($ this ->workspace );
6465 umask ($ this ->umask );
6566 }
@@ -102,10 +103,6 @@ protected function getFileGroup($filepath)
102103
103104 protected function markAsSkippedIfSymlinkIsMissing ($ relative = false )
104105 {
105- if (!function_exists ('symlink ' )) {
106- $ this ->markTestSkipped ('Function symlink is required. ' );
107- }
108-
109106 if ('\\' === DIRECTORY_SEPARATOR && false === self ::$ symlinkOnWindows ) {
110107 $ this ->markTestSkipped ('symlink requires "Create symbolic links" privilege on Windows ' );
111108 }
0 commit comments