8000 minor #27508 [Finder] Update RealIteratorTestCase (flip111) · alcalyn/symfony@9f1d1d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9f1d1d8

Browse files
minor symfony#27508 [Finder] Update RealIteratorTestCase (flip111)
This PR was submitted for the master branch but it was squashed and merged into the 2.8 branch instead (closes symfony#27508). Discussion ---------- [Finder] Update RealIteratorTestCase | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#27480 | License | MIT | Doc PR | n/a Makes the entire test directory empty instead of trying to delete particular files and directories. The old method failed when trying to remove a directory which was not empty. Commits ------- 7d0ebd4 [Finder] Update RealIteratorTestCase
2 parents ec6b941 + 7d0ebd4 commit 9f1d1d8

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,20 @@ public static function setUpBeforeClass()
6060

6161
public static function tearDownAfterClass()
6262
{
63-
foreach (array_reverse(self::$files) as $file) {
64-
if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) {
65-
@rmdir($file);
63+
$paths = new \RecursiveIteratorIterator(
64+
new \RecursiveDirectoryIterator(self::$tmpDir, \RecursiveDirectoryIterator::SKIP_DOTS),
65+
\RecursiveIteratorIterator::CHILD_FIRST
66+
);
67+
68+
foreach ($paths as $path) {
69+
if ($path->isDir()) {
70+
if ($path->isLink()) {
71+
@unlink($path);
72+
} else {
73+
@rmdir($path);
74+
}
6675
} else {
67-
@unlink($file);
76+
@unlink($path);
6877
}
6978
}
7079
}

0 commit comments

Comments
 (0)
0