-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class #22925
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
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.
👍
Thank you @GawainLynch. |
…heck for namespaced class (GawainLynch) This PR was merged into the 3.3 branch. Discussion ---------- [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Some projects, e.g. [Codeception](https://github.com/Codeception/Codeception/blob/2.3.2/shim.php#L47), also alias pre-PHPUnit namespaces leading to a collision and exceptions such as: ``` [PHPUnit\Framework\Exception (2)] Cannot declare class Symfony\Bridge\PhpUnit\SymfonyTestsListener, because the name is already in use ``` This just add a check for the namespaced class, and exits if either aliased or exists. Commits ------- 7ba3afd Adjust PHPUnit class_alias check to also check for namespaced class
This breaks the bridge, see #22929 for reversal. |
…ias check (nicolas-grekas) This PR was merged into the 4.0-dev branch. Discussion ---------- Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check This reverts commit cfb090d, reversing changes made to 4e8f403. | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - PR #22925 made the bridge fail with: > Fatal error: Declaration of Symfony\Bridge\PhpUnit\SymfonyTestsListener::addSkippedTest() must be compatible with that of PHPUnit_Framework_TestListener::addSkippedTest() in /home/travis/build/symfony/symfony/vendor/symfony/phpunit-bridge/SymfonyTestsListener.php on line 32 See https://travis-ci.org/symfony/symfony/builds/236863221 on 3.3 and https://travis-ci.org/symfony/symfony/builds/236863238 on 3.4 Commits ------- 934c0c0 Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class (GawainLynch)"
…ias check (nicolas-grekas) This PR was merged into the 3.3 branch. Discussion ---------- Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check This reverts commit cfb090d, reversing changes made to 4e8f403. | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - PR #22925 made the bridge fail with: > Fatal error: Declaration of Symfony\Bridge\PhpUnit\SymfonyTestsListener::addSkippedTest() must be compatible with that of PHPUnit_Framework_TestListener::addSkippedTest() in /home/travis/build/symfony/symfony/vendor/symfony/phpunit-bridge/SymfonyTestsListener.php on line 32 See https://travis-ci.org/symfony/symfony/builds/236863221 on 3.3 and https://travis-ci.org/symfony/symfony/builds/236863238 on 3.4 Commits ------- 934c0c0 Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class (GawainLynch)"
* 3.3: Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class (GawainLynch)"
@GawainLynch please open an other PR if you want to give it another try. |
@nicolas-grekas I will, do. Bolt uses Codeception for acceptance tests, and we've locked at 3.2.1 (before they added that alias), but that makes things "interesting" in the future 😉 I'll think though approach for a bit, and then try try try again 😄 |
A solution might be to check the PHPUnit version instead of relying on class existence to detect PHPUnit versions |
@stof but, if I'm right, for Symfony we always do the opposite of what you are proposing: instead of relying on version numbers (for Symfony kernel, Symfony Forms, etc.) we always check if some class exists or if some method exists, etc. |
Some projects, e.g. Codeception, also alias pre-PHPUnit namespaces leading to a collision and exceptions such as:
This just add a check for the namespaced class, and exits if either aliased or exists.