Skip to content

Commit 562262c

Browse files
flip111nicolas-grekas
authored andcommitted
[Finder] Update RealIteratorTestCase
1 parent b30fdb7 commit 562262c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Tests/Iterator/RealIteratorTestCase.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,23 @@ 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(
65+
self::$tmpDir,
66+
\RecursiveDirectoryIterator::SKIP_DOTS
67+
),
68+
\RecursiveIteratorIterator::CHILD_FIRST
69+
);
70+
71+
foreach ($paths as $path) {
72+
if ($path->isDir()) {
73+
if ($path->isLink()) {
74+
@unlink($path);
75+
} else {
76+
@rmdir($path);
77+
}
6678
} else {
67-
@unlink($file);
79+
@unlink($path);
6880
}
6981
}
7082
}

0 commit comments

Comments
 (0)