Skip to content

Commit f200aeb

Browse files
committed
Fix(testing): Register shutdown handler to delete temp input file
- Register shutdown function to delete the temporary input file via FileSystem::delete - Avoid leftover test artifacts by removing fixture-derived files on process exit - Return $inputFilePath and ensure it is cleaned up after tests
1 parent e91db1f commit f200aeb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Testing/PHPUnit/AbstractRectorTestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ protected function doTestFile(string $fixtureFilePath, bool $includeFixtureDirec
159159

160160
// write temp file
161161
FileSystem::write($inputFilePath, $inputFileContents, null);
162+
register_shutdown_function([FileSystem::class, 'delete'], $inputFilePath);
162163

163164
$this->doTestFileMatchesExpectedContent(
164165
$inputFilePath,

0 commit comments

Comments
 (0)