Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix TestRunner compatibility to PhpUnit 8#30085

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@alexander-schranz
Copy link
Contributor

@alexander-schranzalexander-schranz commentedFeb 5, 2019
edited
Loading

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketsrelated to:#30055
LicenseMIT
Doc PR-

Modify the installed phpunit version to be compatibility with the symfony custom TestRunner. This is sure not the best way but maybe currently the fastest way to support PhpUnit 8. The hack should be removed as soon as there is another way to implement a custom Runner.

ostrolucky reacted with confused emoji
@alexander-schranzalexander-schranzforce-pushed thefeature/phpunit-8-runner-compatibility branch 5 times, most recently from3e4a969 to0e36059CompareFebruary 6, 2019 00:15
@alexander-schranzalexander-schranz changed the titleFix PhpUnit 8 runner compatibilityFix test runner compatibility to PhpUnit 8Feb 6, 2019
@alexander-schranzalexander-schranz changed the titleFix test runner compatibility to PhpUnit 8Fix TestRunner compatibility to PhpUnit 8Feb 6, 2019
@alexander-schranzalexander-schranzforce-pushed thefeature/phpunit-8-runner-compatibility branch from0e36059 to353ba54CompareFebruary 6, 2019 00:32
@nicolas-grekasnicolas-grekas added this to the3.4 milestoneFeb 7, 2019
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Before merging, we should be sure there is really no alternatives - we should also report the issue to Sebastian so that he knows some extensibility point is now missing. Could you please have a look?

derrabus reacted with thumbs up emoji
@kunicmarko20
Copy link

kunicmarko20 commentedFeb 7, 2019
edited
Loading

Isn't it a better solution to check phpunit version here:

if (false) {
class TestRunner
{
}
}

and then provide the class with or without final? (if it is even possible like that)

@nicolas-grekas
Copy link
Member

@kunicmarko20 could you please have a look if that would be possible? Can you find any other alternative?

@alexander-schranz
Copy link
ContributorAuthor

@nicolas-grekas is it maybe possible to remove the TestRunner and move this logic to the Test Command?

@fabpot
Copy link
Member

@nicolas-grekas@alexander-schranz How can we move forward here?

@alexander-schranz
Copy link
ContributorAuthor

Will have a look at it, at theEU-FOSSA Hackathon.

@ostrolucky
Copy link
Contributor

Could this help?https://github.com/dg/bypass-finals

nexik and derrabus reacted with thumbs down emoji

@alexander-schranz
Copy link
ContributorAuthor

@ostrolucky think we don't want to remove all finals.

Maybe there is some suggestion by@sebastianbergmann how we could automatically register the SymfonyListener programmatically now. Did create an issue at the phpunit repositorysebastianbergmann/phpunit#3594

#EU-FOSSA

@sebastianbergmann
Copy link
Contributor

As I already wrote insebastianbergmann/phpunit#3594 (comment) (why do we have to discuss the same issue in different places?), "automatically registereing" is not possible, and intentionally so: the test runner should not be extended through inheritance but by hooking into certain events. You can find the available hookshere.

What you should do is implement a class that implements one or more of theseHook interfaces. Then have PHPUnit load that class through its configuration file. PHPUnit will then register the hooks.

I can only advise against "hacking around" or "extending" the PHPUnit test runner and then, again and again, update your workarounds when internal implementation details of PHPUnit change. Please do not rely on private implementation details.

In#30085 (review)@nicolas-grekas wrote

we should also report the issue to Sebastian so that he knows some extensibility point is now missing

Yes, please: let me know if you are missing an extension point. While working onhttps://github.com/Roave/no-leaks@Ocramius ran into limitations of the current hooks provided and we plan to work on this in the future.

On a related note, the whole idea of phpunit-bridge is a mystery to me. I do not know what problem(s) you are trying to solve with it. It would be great if somebody could explain that at some point to me. It might be that there are solutions in there for problems that could be solved differently, either inside PHPUnit or in Symfony. I am not conviced that the best medium for this explanation would be a ticket or email. This should, ideally, be a real conversation. Maybe somebody from Symfony can come to a PHPUnit code sprint (there is one in Würzburg this month) or I can come to a Symfony code sprint.

Ocramius, voidtek, and alexander-schranz reacted with heart emoji

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedApr 6, 2019
edited
Loading

Meeting in person would be great for sure! I'm pretty busy this spring so not sure I can join the next sprint but let's tell each other if we see any opportunity!

The bridge creates an alternative "phpunit binary" that provides some extra features out of the box. With inheritance, it was possible to wire a different behavior by default, but now I'm not sure we can (I didn't have a deeper look). Which features? some extra annotations (@expectedDeprecation,@time-sensitive, etc) and some extra behaviors: the deprecations report that is displayed after running the tests, or a record/replay feature for skipped tests, maybe some more.

The extra features related to annotations work with a line in config files, but the extra behaviors are shipped out of the box when using the bridge.

That's why there is this specific bootstrapping extra layer, which is closed now, withfinal.

@alexander-schranzalexander-schranzforce-pushed thefeature/phpunit-8-runner-compatibility branch 2 times, most recently from349ac1e to343f4d4CompareApril 7, 2019 13:01
@alexander-schranz
Copy link
ContributorAuthor

alexander-schranz commentedApr 7, 2019
edited
Loading

Analysed more the current state and I think I could fix it by moving the logic from the TestRunner to the Command.

#EUFOSSA

@nicolas-grekas
Copy link
Member

if it works, perfect :)
wasn'tTestRunnerForV6 reference somewhere?

@xabbuh
Copy link
Member

Can we also remove thesrc/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php file?

@derrabus
Copy link
Member

@xabbuh It's still used in theCommandForV5, isn't it?

@alexander-schranzalexander-schranzforce-pushed thefeature/phpunit-8-runner-compatibility branch from343f4d4 to3bf78a0CompareApril 7, 2019 13:54
@alexander-schranz
Copy link
ContributorAuthor

@xabbuh done and move the v5 testrunner logic also to the commandforv5

returnnewTestRunnerForV5($this->arguments['loader']);
$listener =newSymfonyTestsListenerForV5();

$this->arguments['listeners'] =isset($this->arguments['listeners']) ?$this->arguments['listeners'] :array();
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@nicolas-grekas but here the long array syntax is correct or not?

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

cool, thanks for digging!

@nicolas-grekasnicolas-grekasforce-pushed thefeature/phpunit-8-runner-compatibility branch from3bf78a0 toa0c66a3CompareApril 8, 2019 07:56
@nicolas-grekas
Copy link
Member

Thank you@alexander-schranz.

@nicolas-grekasnicolas-grekas merged commita0c66a3 intosymfony:3.4Apr 8, 2019
nicolas-grekas added a commit that referenced this pull requestApr 8, 2019
This PR was squashed before being merged into the 3.4 branch (closes#30085).Discussion----------Fix TestRunner compatibility to PhpUnit 8| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | related to:#30055| License       | MIT| Doc PR        | -Modify the installed phpunit version to be compatibility with the symfony custom TestRunner. This is sure not the best way but maybe currently the fastest way to support PhpUnit 8. The hack should be removed as soon as there is another way to implement a custom Runner.Commits-------a0c66a3 Fix TestRunner compatibility to PhpUnit 8
@alexander-schranzalexander-schranz deleted the feature/phpunit-8-runner-compatibility branchApril 8, 2019 10:29
This was referencedApr 16, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@dunglasdunglasAwaiting requested review from dunglas

@lyrixxlyrixxAwaiting requested review from lyrixx

@srozesrozeAwaiting requested review from sroze

@xabbuhxabbuhAwaiting requested review from xabbuh

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

10 participants

@alexander-schranz@kunicmarko20@nicolas-grekas@fabpot@ostrolucky@sebastianbergmann@xabbuh@derrabus@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp