Skip to content

[13.x] Simplify most of the exceptions expectations - #61049

Merged
taylorotwell merged 3 commits into
laravel:13.xfrom
lucasmichot:13.x-expect-exception-object
Aug 5, 2026
Merged

[13.x] Simplify most of the exceptions expectations#61049
taylorotwell merged 3 commits into
laravel:13.xfrom
lucasmichot:13.x-expect-exception-object

Conversation

@lucasmichot

@lucasmichot lucasmichot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Swaps expectException() + expectExceptionMessage() for the single expectExceptionObject() call, wherever the full exception message is known and asserted exactly. Less boilerplate, same coverage.

Error and its subclasses (TypeError, ValueError, ArgumentCountError, etc.) are left alone on purpose - didn't want to touch those here.

Also worth noting: PHPUnit 13.2 deprecates expectExceptionMessage() in favor of expectExceptionMessageIs() (strict match) or expectExceptionMessageIsOrContains() (same "contains" behavior as the old method), so these call sites would need updating eventually anyway.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@lucasmichot
lucasmichot marked this pull request as ready for review August 5, 2026 15:05
@taylorotwell
taylorotwell merged commit 910cd94 into laravel:13.x Aug 5, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants