-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[PhpUnitBridge] not compatible with latest phpunit #21125
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
Comments
A [EDIT] Also this is needed for every PHPUnit's class that used by the bridge. |
It may be worth reporting this to PHPUnit to see whether they could include this class in their BC layer (they have BC classes for some classes) |
I've opened a PR on PHPUnit: sebastianbergmann/phpunit#2414 |
The BC layer PR has been refused. We need to try an other approach, like a way to declare a lot of |
I don't think it's our job to alias classes in the phpunit namespace/prefix... We should try harder to find another solution that could be purely on our side. |
My temporary solution, used with success in my project, was adding a
and then putting classes like the ones proposed by @Jean85 in his PR. |
@nicolas-grekas what approach would you suggest? I skimmed through the bridge and it seems to me that the class_alias is the only option, due to the fact that various static methods are used, like
|
@Jean85 add some |
I would find that way a bit harder to read in Symfony's codebase, and it would force us to do that everywhere, without being sure of having everything tested IMHO. |
I agree, but the PhpUnit namespace is not our vendor, so me must not get there. An example of a nasty side effect of using |
The odd thing is that phpunit 5.7 has a forward compatibility layer, but it's not implementing every class. See https://github.com/sebastianbergmann/phpunit/tree/5.7/src/ForwardCompatibility |
I'm not sure what Sebastian is up to on that, the 6.0 has the same classes in reverse as a BC layer, but he shot down my PR... |
@Jean85 Maybe he would accept a similar PR für PHPUnit 5.7 to ensure forward compatibility. That would at least make more sense than providing backwards compatibility in a major version where you are actually able to do BC breaking changes. But note that this wouldn't still help us as we also need to support versions of PHPUnit prior to 5.7. |
@xabbuh do we really need it? Phpunit 4.8 will be out of support in one month. |
@garak We need to be compatible with PHPUnit 4.8 as long as we have Symfony versions with active support that are compatible with PHP 5.5 or lower. |
The opposite solution would be lock the bridge at |
I guess it shouldn't be too hard to make the bridge compatible with PHPUnit 6. I try to look into it tonight. |
The bridge itself should be possible. For the Symfony testsuite itself, it is not, until we can require PHPUnit 5.7+ to use the new namespaced TestCase class |
Yes, but that's okay for the Symfony development as we can control which PHPUnit versions we want to use. PHPUnit 6 support in the bridge is nice though as people want to use PHPUnit 6 for their own projects/packages. |
The Bridge major version is NOT is sync with Symfony's, right? So, IMHO the best solution is to migrate it completely to PHPUnit 6.0 in a 4.0 release, and leave the 3.x for PHPUnit 4.8 and 5.7. |
I agree with @Jean85 |
@Jean85 Releases of the bridge are still synchronized with Symfony. The only difference is the PHP requirement, where we kept support for PHP 5.3 in the bridge even in 3.2, to allow us to benefit from the bridge new features even when running the testsuite for LTS branches. Releasing a new major version of the bridge that Symfony itself cannot use is a no-go, as it would mean that Symfony would not receive new features anymore (unless we continue to add new features in 3.x after releasing 4.0, which does not fit our process). Anyway, adding support for PHPUnit 6 in the bridge should be possible without a new major version IMO with some tricks. |
Thanks @stof for the clarification about the release process; I agree for the tricks, but:
|
While at lunch 😄 I got an other idea about a different approach to solve this issue:
Advantages:
|
I've started a WIP PR (#21158) to try my approach, and the only doubt that I have is how to solve argument typehints; example:
The only approach that I found that would preserve BC is a bit verbose:
|
Hi guys, small tip - I got same problem with PHP 5.6.29 + latest stable phpunit (v5.7.5):
Problem does not appear in PHP 7.0.9+ Resolved adding manually "files" in "autoload-dev" with entry:
This change works for php5 and 7. |
Just a quick update to notice that phpunit 6 is now stable. |
Unfortunately I haven't found a working solution for my PR #21221 |
|
See #21694 |
This PR was merged into the 3.3-dev branch. Discussion ---------- [Bridge/PhpUnit] Add PHPUnit 6 support | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #21125 | License | MIT | Doc PR | - This PR makes our phpunit bridge compatible with all namespaced versions of phpunit, from 4.8.35 to 6. It takes another approach than #21668 and #21221, thus replaces them. Tested locally : tests pass when using phpunit 5.7, and fails with v6.0 because our own test suite is not yet compatible with it - but at least it runs nice. If this were handled as usual Symfony component, we would consider some changes to be BC breaks. But in this specific case - a phpunit bridge - it makes no sense to me to apply the bc policy here. I added `@final` and `@internal` annotations to make this clearer. Commits ------- 9e0745c [Bridge/PhpUnit] Add PHPUnit 6 support
I tried to use phpunit-bridge with latest phpunit (
^6.0@dev
, will be stable next month), it does not work due to changes in phpunit itself.Error: Class 'PHPUnit_Util_ErrorHandler' not found
.Since phpunit (at last) switched to namespaces, the current class is
PHPUnit\Util\ErrorHandler
, notPHPUnit_Util_ErrorHandler
any more.I see that supporting this is a BC break, so maybe we could provide a compatibility layer to old phpunit?
The text was updated successfully, but these errors were encountered: