Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Restore exceptions/errors to test assertion failure messages #51725

Merged
merged 4 commits into from
Jun 6, 2024

Conversation

jessarcher
Copy link
Member

This PR is an alternative to #51709 that solves the issue of unexpected exceptions and validation errors no longer being included in test assertion failures.

#51709 only solves the issue for status assertions and only includes unexpected exceptions but not validation errors.

I couldn't find anything in PHPUnit that would let me hook in to catch and transform the exceptions globally like we used to, so I've removed the code we had there are localized the responsibility to the TestResponse class. I tried a few different ideas, like wrapping every assertion in a try/catch or inside a closure that gets passed to another method that does the try/catch, but I ultimately felt it was nicer to wrap the Assert class instead.

I have removed some methods and properties that might constitute a BC; however, these were all contained within the testing side of the framework. I'm happy to re-instate them with a @deprecated tag if preferred.

@jessarcher jessarcher force-pushed the fix-test-assertion-context branch from 47f5f1f to fbcdd5b Compare June 6, 2024 06:42
composer.json Outdated Show resolved Hide resolved
@jessarcher jessarcher force-pushed the fix-test-assertion-context branch from fbcdd5b to 6593e01 Compare June 6, 2024 06:51
@jessarcher jessarcher marked this pull request as ready for review June 6, 2024 06:55
composer.json Outdated Show resolved Hide resolved
@taylorotwell taylorotwell merged commit 8ce249a into 11.x Jun 6, 2024
29 checks passed
@taylorotwell taylorotwell deleted the fix-test-assertion-context branch June 6, 2024 14:18
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.

3 participants