Skip to content

Commit

Permalink
Assert that exception is thrown without message (#42360)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaffe-fr authored May 11, 2022
1 parent b5b5c63 commit 6f717ad
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,10 @@ protected function assertThrows(Closure $test, string $expectedClass = Throwable
$actualMessage = $exception->getMessage();
}

if (! $thrown) {
Assert::fail(
sprintf(
'Failed asserting that exception of type "%s" is thrown.',
$expectedClass
)
);
}
Assert::assertTrue(
$thrown,
sprintf('Failed asserting that exception of type "%s" is thrown.', $expectedClass)
);

if (isset($expectedMessage)) {
if (! isset($actualMessage)) {
Expand Down

0 comments on commit 6f717ad

Please sign in to comment.