-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: work around PHPUnit hard-failing on unknown class
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
From 085e85e23d86b49cae114fcbe322325462c058cc Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Marek=20Barto=C5=A1?= <bartos.developer152@gmail.com> | ||
Date: Fri, 23 Dec 2022 16:27:23 +0100 | ||
Subject: [PATCH] Fix coverage failure in case of an invalid file | ||
|
||
--- | ||
src/CodeCoverage.php | 6 +++++- | ||
1 file changed, 5 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/CodeCoverage.php b/src/CodeCoverage.php | ||
index c35f27c8..9340f673 100644 | ||
--- a/src/CodeCoverage.php | ||
+++ b/src/CodeCoverage.php | ||
@@ -550,7 +550,11 @@ private function processUncoveredFilesFromFilter(): void | ||
|
||
foreach ($uncoveredFiles as $uncoveredFile) { | ||
if ($this->filter->isFile($uncoveredFile)) { | ||
- include_once $uncoveredFile; | ||
+ try { | ||
+ include_once $uncoveredFile; | ||
+ } catch (\Error $e) { | ||
+ // Include may fail if file content is not valid (due to implementing/extending non-existent class, ...) | ||
+ } | ||
} | ||
} | ||
|
||
-- | ||
2.34.1.windows.1 | ||
|