Skip to content

Commit df298bc

Browse files
Add guard clause (on a fresh checkout such as on GitHub Actions the temporary directory might not exits)
1 parent d0050e8 commit df298bc

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tests/src/TestCase.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
namespace SebastianBergmann\CodeCoverage;
1111

12+
use function is_dir;
1213
use function rmdir;
1314
use function unlink;
1415
use BankAccount;
@@ -1946,8 +1947,14 @@ protected function setUpXdebugStubForClassWithOutsideFunction(): Driver
19461947

19471948
protected function removeTemporaryFiles(): void
19481949
{
1950+
$tmpPath = TEST_FILES_PATH . 'tmp';
1951+
1952+
if (!is_dir($tmpPath)) {
1953+
return;
1954+
}
1955+
19491956
$tmpFilesIterator = new RecursiveIteratorIterator(
1950-
new RecursiveDirectoryIterator(TEST_FILES_PATH . 'tmp', RecursiveDirectoryIterator::SKIP_DOTS),
1957+
new RecursiveDirectoryIterator($tmpPath, RecursiveDirectoryIterator::SKIP_DOTS),
19511958
RecursiveIteratorIterator::CHILD_FIRST,
19521959
);
19531960

0 commit comments

Comments
 (0)