Skip to content

Commit 5b47c11

Browse files
committed
fix: make FrameworkCodeTest tolerate files removed during the scan
1 parent f3a765e commit 5b47c11

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎tests/system/AutoReview/FrameworkCodeTest.php‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function testDeprecationsAreProperlyVersioned(): void
5959
$deprecationsWithoutVersion = [];
6060

6161
foreach ($this->getSourceFiles() as $file) {
62-
$lines = file($file, FILE_IGNORE_NEW_LINES);
62+
$lines = @file($file, FILE_IGNORE_NEW_LINES);
6363

6464
if ($lines === false) {
6565
continue;
@@ -156,6 +156,7 @@ private static function getTestClasses(): array
156156
FilesystemIterator::SKIP_DOTS,
157157
),
158158
RecursiveIteratorIterator::CHILD_FIRST,
159+
RecursiveIteratorIterator::CATCH_GET_CHILD,
159160
);
160161

161162
$testClasses = array_map(
@@ -211,12 +212,17 @@ private function getSourceFiles(): array
211212
FilesystemIterator::SKIP_DOTS,
212213
),
213214
RecursiveIteratorIterator::CHILD_FIRST,
215+
RecursiveIteratorIterator::CATCH_GET_CHILD,
214216
);
215217

216218
/** @var SplFileInfo $file */
217219
foreach ($iterator as $file) {
218220
if ($file->isFile() && str_ends_with($file->getPathname(), '.php')) {
219-
$phpFiles[] = $file->getRealPath();
221+
$realPath = $file->getRealPath();
222+
223+
if ($realPath !== false) {
224+
$phpFiles[] = $realPath;
225+
}
220226
}
221227
}
222228
}

0 commit comments

Comments
 (0)