-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix tests on PHP 8.0 #9054
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
Fix tests on PHP 8.0 #9054
Conversation
Why is simple-phpunit ignoreing the environment variable... |
Ok, got the tests to run now. Looks like there are some issues (mostly due to deprecated usage of phpunit causing real issues in 9.3.x or php 8.0 changing exception message text, from what I can see at a quick glance). |
Yeah given the amount of deprecation warnings we had on phpunit 8, I was pretty sure it wouldn't run on 9.. I doubt this can be fixed without adding a huge amount of overrides for assertions and a huge mess.. So I am not sure what's best tbh, might be better to ignore php8 for now, and hopefully we can then in composer 2.1 target php8 more easily once we drop older php releases. I don't think it's realistic to support 5.3 all the way up given phpunit and phpunit-bridge restrictions. |
The PHP ecosystem already relies on composer 2 working on PHP 8.0. I think we should try and update the test suite to work for both versions. I can try and work on it today... but we should also ask for help from others. If they wanna use composer on PHP 8.0, then they gotta put in their share. ;) |
Well Composer works fine on php8, the test suite doesn't now because of phpunit and co.. If someone puts in the work and it's not creating an unreasonable mess in the test suite I'll happily take it in, but otherwise IMO it can wait, it runs well enough for now, and php8 isn't out yet. |
Another approach would be to patch phpunit 8 to fix the match thing. ;) |
That'd be much easier (for us) but I have a feeling @sebastianbergmann may not see it the same? |
Yeh, I think so, and he has good reasons. For one, that might not be the only PHP 8.0 compatibility issue we run into, so the amount of stuff we might want backporting is potentially unbounded (it is certainly not the only PHP 8.0 compatibly issue within phpunit and its dependencies - there were a lot of other changes in particular around reflection of types). |
I am sorry, but PHPUnit 8.5 and PHPUnit 9.2 will not be updated to support PHP 8. |
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- Require PHPUnit 9.3 on PHP 8 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT The first version of PHPUnit to support PHP 8.0 is PHPUnit 9.3. --- Depends on #37607. Related to composer/composer#9054. Commits ------- 54b13c0 Require PHPUnit 9.3 on PHP 8
The tests are running now, at least, and there do seem to be some genuine issues (but also some issues due to using old phpunit methods). |
run: | | ||
composer require --no-update --dev symfony/phpunit-bridge:^5.1 | ||
composer config -g platform-check false | ||
run: composer require --no-update --dev symfony/phpunit-bridge:5.1.*@dev |
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.
Why @dev
, is that still needed at this point?
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.
Not needed any more.
|
||
- name: "Update Symfony's PHPUnitBridge to latest available for the current PHP always as it is not really a dependency of the project" | ||
run: "composer update ${{ env.COMPOSER_FLAGS }} symfony/phpunit-bridge" | ||
run: "composer update ${{ env.COMPOSER_FLAGS }} symfony/phpunit-bridge --with-all-dependencies" |
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.
Why the new flag? It'd allow updating symfony components we rely on, I am not sure that's a good idea as it breaks the validity of locked dependencies builds.
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.
That was needed because of old dependencies in the composer.lock, at the time.
Ok thanks for the feedback. Looks better now, will see what I can do about test failures later this week. |
Ok we are down to one weird syntax error bug which I assume is phpunit-bridge based, and one actual failure due to php8 sorting order in TransactionTest.. so I'll merge this for now it's already improving things a lot. Thanks |
Thanks for finishing up this PR. 🍻 |
We need PHPUnit 9.3@dev (and its @dev stability dependencies), which include PHP 8.0 support, including sebastianbergmann/phpunit#4374 which fixes the issue with Match which is currently crashing composer's test suite on actions.