Skip to content

Commit 0ba498c

Browse files
Do not mark test that unintentionally covered code as risky when it fails
1 parent 4cbfc8b commit 0ba498c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Framework/TestResult.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -867,13 +867,9 @@ function_exists('xdebug_start_function_monitor');
867867
$linesToBeUsed
868868
);
869869
} catch (UnintentionallyCoveredCodeException $cce) {
870-
$this->addFailure(
871-
$test,
872-
new UnintentionallyCoveredCodeError(
873-
'This test executed code that is not listed as code to be covered or used:' .
874-
PHP_EOL . $cce->getMessage()
875-
),
876-
$time
870+
$unintentionallyCoveredCodeError = new UnintentionallyCoveredCodeError(
871+
'This test executed code that is not listed as code to be covered or used:' .
872+
PHP_EOL . $cce->getMessage()
877873
);
878874
} catch (OriginalCodeCoverageException $cce) {
879875
$error = true;
@@ -894,6 +890,12 @@ function_exists('xdebug_start_function_monitor');
894890
$this->addFailure($test, $e, $time);
895891
} elseif ($warning) {
896892
$this->addWarning($test, $e, $time);
893+
} elseif (isset($unintentionallyCoveredCodeError)) {
894+
$this->addFailure(
895+
$test,
896+
$unintentionallyCoveredCodeError,
897+
$time
898+
);
897899
} elseif ($this->beStrictAboutTestsThatDoNotTestAnything &&
898900
!$test->doesNotPerformAssertions() &&
899901
$test->getNumAssertions() === 0) {

0 commit comments

Comments
 (0)