diff --git a/tests/ActionTest.php b/tests/ActionTest.php index 5ab3098..d135b89 100644 --- a/tests/ActionTest.php +++ b/tests/ActionTest.php @@ -64,28 +64,25 @@ private function removeDirectory(string $dir): void { $dir = realpath($dir); - if (is_dir($dir) && is_readable($dir) && is_writable($dir)) { + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($dir), + \RecursiveIteratorIterator::CHILD_FIRST, + ); - $iterator = new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($dir), - \RecursiveIteratorIterator::CHILD_FIRST, - ); + foreach ($iterator as $path) { - foreach ($iterator as $path) { - - if (!$path instanceof \SplFileInfo) { - continue; - } - - if ($path->isDir()) { - rmdir((string) $path); - } else { - unlink((string) $path); - } + if (!$path instanceof \SplFileInfo) { + continue; } - rmdir($dir); + if ($path->isDir()) { + rmdir((string) $path); + } else { + unlink((string) $path); + } } + + rmdir($dir); } public function testBuildComposerPackage(): void