WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.37k stars 4.15k forks source link

wp-env: Incompatible version of phpunit used when a custom phpVersion config value is set #29323

Open coreymckrill opened 3 years ago

coreymckrill commented 3 years ago

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 the latest tag, which I guess must be pinned to version 7 at the moment.

Step-by-step reproduction instructions

  1. Add "phpVersion": "7.2" to Gutenberg's .wp-env.json file.
  2. Rebuild the containers with npm run wp-env start.
  3. 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

Device information

mukeshpanchal27 commented 2 years ago

👋 Is there any update on this? I'm facing similar issue in Performance repo.