diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php index 94253c7ee7..4f274e2d12 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php @@ -60,11 +60,20 @@ abstract class RealIteratorTestCase extends IteratorTestCase public static function tearDownAfterClass() { - foreach (array_reverse(self::$files) as $file) { - if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) { - @rmdir($file); + $paths = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator(self::$tmpDir, \RecursiveDirectoryIterator::SKIP_DOTS), + \RecursiveIteratorIterator::CHILD_FIRST + ); + + foreach ($paths as $path) { + if ($path->isDir()) { + if ($path->isLink()) { + @unlink($path); + } else { + @rmdir($path); + } } else { - @unlink($file); + @unlink($path); } } }