Skip to content

Commit dc7281e

Browse files
Emit Test\Failed (instead of Test\Errored) when an assertion fails in "after test" method
1 parent aecdcb2 commit dc7281e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Framework/TestCase.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,14 @@ final public function runBare(): void
744744
$this->invokeAfterClassHookMethods($hookMethods, $emitter);
745745
}
746746
}
747+
} catch (AssertionError|AssertionFailedError $e) {
748+
$this->status = TestStatus::failure($e->getMessage());
749+
750+
$emitter->testFailed(
751+
$this->valueObjectForEvents(),
752+
Event\Code\ThrowableBuilder::from($e),
753+
Event\Code\ComparisonFailureBuilder::from($e),
754+
);
747755
} catch (Throwable $exceptionRaisedDuringTearDown) {
748756
if (!isset($e)) {
749757
$this->status = TestStatus::error($exceptionRaisedDuringTearDown->getMessage());

0 commit comments

Comments
 (0)