Skip to content

Commit

Permalink
Emit Test\Failed (instead of Test\Errored) when an assertion fails in…
Browse files Browse the repository at this point in the history
… "after test" method
  • Loading branch information
sebastianbergmann committed Sep 18, 2023
1 parent aecdcb2 commit dc7281e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,14 @@ final public function runBare(): void
$this->invokeAfterClassHookMethods($hookMethods, $emitter);
}
}
} catch (AssertionError|AssertionFailedError $e) {
$this->status = TestStatus::failure($e->getMessage());

$emitter->testFailed(
$this->valueObjectForEvents(),
Event\Code\ThrowableBuilder::from($e),
Event\Code\ComparisonFailureBuilder::from($e),
);
} catch (Throwable $exceptionRaisedDuringTearDown) {
if (!isset($e)) {
$this->status = TestStatus::error($exceptionRaisedDuringTearDown->getMessage());
Expand Down

0 comments on commit dc7281e

Please sign in to comment.