Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9d22b24

Browse files
minor#18055 [Filesystem] Cleanup/sync with 2.3 (nicolas-grekas)
This PR was merged into the 2.7 branch.Discussion----------[Filesystem] Cleanup/sync with 2.3| Q | A| ------------- | ---| Branch | 2.7| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -Sibling of#18054 to keep code in syncCommits-------c417d7a [Filesystem] Cleanup/sync with 2.3
2 parentsf1b218b +c417d7a commit9d22b24

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

‎src/Symfony/Component/Filesystem/Tests/FilesystemTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public function testRemoveCleansInvalidLinks()
347347

348348
// create symlink to nonexistent dir
349349
rmdir($basePath.'dir');
350-
$this->assertFalse(is_dir($basePath.'dir-link'));
350+
$this->assertFalse('\\' ===DIRECTORY_SEPARATOR ? @readlink($basePath.'dir-link') :is_dir($basePath.'dir-link'));
351351

352352
$this->filesystem->remove($basePath);
353353

@@ -383,7 +383,7 @@ public function testFilesExistsFails()
383383
$file =str_repeat('T',259 -strlen($basePath));
384384
$path =$basePath.$file;
385385
exec('TYPE NUL >>'.$file);// equivalent of touch, we can not use the php touch() here because it suffers from the same limitation
386-
self::$longPathNamesWindows[] =$path;// save this so we can clean up later
386+
$this->longPathNamesWindows[] =$path;// save this so we can clean up later
387387
chdir($oldPath);
388388
$this->filesystem->exists($path);
389389
}

‎src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
1717
{
1818
private$umask;
1919

20-
staticprotected$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
publicstaticfunctionsetUpBeforeClass()
3535
{
36-
if (!empty(self::$longPathNamesWindows)) {
37-
foreach (self::$longPathNamesWindowsas$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
protectedfunctionsetUp()
5347
{
5448
$this->umask =umask(0);
49+
$this->filesystem =newFilesystem();
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 =newFilesystem();
5953
}
6054

6155
protectedfunctiontearDown()
6256
{
57+
if (!empty($this->longPathNamesWindows)) {
58+
foreach ($this->longPathNamesWindowsas$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
protectedfunctionmarkAsSkippedIfSymlinkIsMissing($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

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp