If a custom php version is set using the phpVersion property in the .wp-env.json file, the phpunit container will be provisioned using an image that includes phpunit version 8 or 9, both of which are currently not compatible with the WP unit testing framework.
This only applies if the custom php version is set to 7.2 or higher, but because xdebug is currently breaking the docker build for anything less than 7.2, it's essentially applicable whenever the phpVersion property is used.
This problem doesn't happen when phpVersion isn't set, even though the default php version is 7.4, because in that case the phpunit container image will use the latest tag, which I guess must be pinned to version 7 at the moment.
Step-by-step reproduction instructions
Add "phpVersion": "7.2" to Gutenberg's .wp-env.json file.
Rebuild the containers with npm run wp-env start.
Run npm run test-php.
Expected behaviour
The tests should work, regardless of which php version is set. WP php unit tests shouldn't be using phpunit 8 or above under any circumstances right now.
Actual behaviour
You'll eventually see "Error: Looks like you're using PHPUnit 8.5.14. WordPress requires at least PHPUnit 5.4 and is currently only compatible with PHPUnit up to 7.x.". The unit tests won't complete.
WordPress information
WordPress version: trunk
Gutenberg version: trunk
Are all plugins except Gutenberg deactivated? Yes
Are you using a default theme (e.g. Twenty Twenty-One)? Yes
Description
If a custom php version is set using the
phpVersion
property in the .wp-env.json file, the phpunit container will be provisioned using an image that includes phpunit version 8 or 9, both of which are currently not compatible with the WP unit testing framework.This only applies if the custom php version is set to 7.2 or higher, but because xdebug is currently breaking the docker build for anything less than 7.2, it's essentially applicable whenever the
phpVersion
property is used.This problem doesn't happen when
phpVersion
isn't set, even though the default php version is 7.4, because in that case the phpunit container image will use thelatest
tag, which I guess must be pinned to version 7 at the moment.Step-by-step reproduction instructions
"phpVersion": "7.2"
to Gutenberg's .wp-env.json file.npm run wp-env start
.npm run test-php
.Expected behaviour
The tests should work, regardless of which php version is set. WP php unit tests shouldn't be using phpunit 8 or above under any circumstances right now.
Actual behaviour
You'll eventually see "Error: Looks like you're using PHPUnit 8.5.14. WordPress requires at least PHPUnit 5.4 and is currently only compatible with PHPUnit up to 7.x.". The unit tests won't complete.
WordPress information
Device information