| Q |
A |
| PHPUnit version |
10.0.7 |
| PHP version |
8.1.15 |
| Installation Method |
Composer |
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
- Create a TestCase with a test throwing an exception
- Override the
onNotSuccessfulTest method in that TestCase to call self::markTestSkipped() when that exception happened
- Run those tests both with PHPUnit 9 and 10 and compare the difference.
Expected behavior
Summary
In PHPUnit 9 and older, it was possible to override
TestCase::onNotSuccessfulTestto 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
onNotSuccessfulTestmethod in that TestCase to callself::markTestSkipped()when that exception happenedExpected behavior