-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[PhpUnitBridge] Fix running skipped tests expecting only deprecations #35489
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
Conversation
8db376e
to
993c43e
Compare
@@ -196,7 +196,7 @@ public function addSkippedTest($test, \Exception $e, $time) | |||
|
|||
public function startTest($test) | |||
{ | |||
if (-2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase)) { | |||
if (-2 < $this->state && ($test instanceof \PHPUnit\Framework\TestCase || $test instanceof TestCase) && $test->getTestResultObject()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want to move this new condition where $test->getTestResultObject()
is actually used? 🤔 There are other things in this if
that works without a test result object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now it's not obvious to me what it means when the getTestResult()
retval is null. I tend to think this code should not be reached at all, but I may be missing something (e.g. isolated tests) and then we should only skip adding failures on case by case basis. ping @nicolas-grekas
Thank you @chalasr. |
993c43e
to
6b02362
Compare
…eprecations (chalasr) This PR was merged into the 3.4 branch. Discussion ---------- [PhpUnitBridge] Fix running skipped tests expecting only deprecations | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - If a test class has unsatisfied `@requires` and contains test methods expecting deprecation only, you get: > Fatal error: Uncaught Error: Call to a member function beStrictAboutTestsThatDoNotTestAnything() on null in ./symfony/symfony-dev/vendor/symfony/phpunit-bridge/Legacy/SymfonyTestsListenerTrait.php:229 Spotted in #34925's build. Commits ------- 6b02362 [Phpunit] Fix running skipped tests expecting only deprecations
If a test class has unsatisfied
@requires
and contains test methods expecting deprecation only, you get:Spotted in #34925's build.