[Finder] Update RealIteratorTestCase

This commit is contained in:
flip111 2018-06-06 00:03:34 +01:00 committed by Nicolas Grekas
parent ec6b941738
commit 7d0ebd41ab

View File

@ -60,11 +60,23 @@ abstract class RealIteratorTestCase extends IteratorTestCase
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
foreach (array_reverse(self::$files) as $file) { $paths = new \RecursiveIteratorIterator(
if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) { new \RecursiveDirectoryIterator(
@rmdir($file); self::$tmpDir,
\RecursiveDirectoryIterator::SKIP_DOTS
),
\RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($paths as $path) {
if ($path->isDir()) {
if ($path->isLink()) {
@unlink($path);
} else {
@rmdir($path);
}
} else { } else {
@unlink($file); @unlink($path);
} }
} }
} }