Fix PHP CI including PHPCS and PHPUnit; bump PHP/WP versions#1095
Fix PHP CI including PHPCS and PHPUnit; bump PHP/WP versions#1095westonruter merged 24 commits intodevelopfrom
Conversation
5556587 to
9ffbeab
Compare
358a520 to
5c5b8dd
Compare
ce8771c to
96a6b84
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #1095 +/- ##
=============================================
+ Coverage 19.65% 29.34% +9.69%
+ Complexity 347 334 -13
=============================================
Files 57 57
Lines 2325 1690 -635
=============================================
+ Hits 457 496 +39
+ Misses 1868 1194 -674
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
| }, | ||
| "platform": { | ||
| "php": "5.6" | ||
| "php": "7.0" |
There was a problem hiding this comment.
Need to emulate it to 7.0 else it can download deps that don't support PHP 7.0.
There was a problem hiding this comment.
Humm. I had updated the composer.lock file for PHP 8.0 so we'll need to update it for 7.0. However, when I do so then I get errors when running tests locally:
$ npm run test:php
> test:php
> wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/pwa/ env WORDPRESS_TABLE_PREFIX=wptests_ vendor/bin/phpunit
ℹ Starting 'env WORDPRESS_TABLE_PREFIX=wptests_ vendor/bin/phpunit' on the tests-cli container.
[18-Jan-2024 22:34:19 UTC] PHP Warning: Private methods cannot be final as they are never overridden by other classes in /var/www/html/wp-content/plugins/pwa/vendor/phpunit/phpunit/src/Util/Configuration.php on line 176
[18-Jan-2024 22:34:19 UTC] PHP Fatal error: Cannot acquire reference to $GLOBALS in /var/www/html/wp-content/plugins/pwa/vendor/phpunit/phpunit/src/Util/Configuration.php on line 543
✖ Command failed with exit code 255
If I change it to 7.4 and run composer update then I can run PHPUnit successfully, even when I'm running PHP 8.1.
Can we change this then to (and run composer update):
| "php": "7.0" | |
| "php": "7.4" |
If that means removing tests for PHP 7.0-7.3, I'm fine with that.
There was a problem hiding this comment.
It's because the PHPUnit version is not compatible with the PHP version inside the container. So I think we need to use updated PHPUnit for local testing.
So we have two options now:
- We save PHPUnit 9.6 PHAR in bin like we do for PHPStan and keep 7.0 tests.
- Remove 7.0 tests and bump PHP emulation to 7.1.
There was a problem hiding this comment.
Now PHPUnit version is customizable in local development with - 9fa812d
With this, we can download any PHPUnit version and keep the tests for PHP 7.0.
Closes #983
Closes #1056