-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
TestCase::onNotSuccessfulTest cannot mark tests as skipped or failed anymore in PHPUnit 10 #5202
Comments
At least for me, there was only ever a single valid use case for this: to have an extension point to "do something" when a test fails. It was never meant to change the outcome of a test. So this is not a bug, it works as intended. |
What would be the way to do what the driver testsuite does then ? |
And as this is a behavior change for what is possible with |
Already done in 7142280 :) |
@sebastianbergmann do you think it is possible for PHPUnit 9.6 to report a deprecation for such usage ? |
I do not think so. |
Summary
In PHPUnit 9 and older, it was possible to override
TestCase::onNotSuccessfulTest
to change the outcome of a test, as this method was called before determining the test status based on the caught exception (and this method could throw a different one that would be used).In PHPUnit 10, this method is called after determining the test status, which voids any use case I know for that extension point.
Examples of usage of that method:
Current behavior
How to reproduce
onNotSuccessfulTest
method in that TestCase to callself::markTestSkipped()
when that exception happenedExpected behavior
The text was updated successfully, but these errors were encountered: