You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wp-env: Incompatible version of phpunit used when a custom phpVersion config value is set #29323
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
Closing as resolved: wp-env no longer runs a separate phpunit container — tests execute inside the WordPress container, so they always use the phpVersion you configured, which eliminates the mismatch this described. Thanks!
Activity
Env: Abandon custom php version, for now
Add php unit test suite (#80)
mukeshpanchal27 commentedon Sep 26, 2022
👋 Is there any update on this? I'm facing similar issue in Performance repo.
youknowriad commentedon Aug 23, 2026
Closing as resolved: wp-env no longer runs a separate phpunit container — tests execute inside the WordPress container, so they always use the phpVersion you configured, which eliminates the mismatch this described. Thanks!