Navigation Menu

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

[PhpUnitBridge] Fix running skipped tests expecting only deprecations #35489

Merged
merged 1 commit into from Feb 3, 2020

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Jan 28, 2020

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.

@chalasr chalasr added this to the 3.4 milestone Jan 28, 2020
@chalasr chalasr force-pushed the phpunit-null-testres branch 3 times, most recently from 8db376e to 993c43e Compare January 28, 2020 01:23
@@ -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()) {
Copy link
Contributor

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.

Copy link
Member Author

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

@nicolas-grekas
Copy link
Member

Thank you @chalasr.

nicolas-grekas added a commit that referenced this pull request Feb 3, 2020
…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
@nicolas-grekas nicolas-grekas merged commit 6b02362 into symfony:3.4 Feb 3, 2020
@chalasr chalasr deleted the phpunit-null-testres branch February 3, 2020 11:57
This was referenced Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants