Use wp-env for PHP unit test #802
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that PHP unit tests are failing in recent pull requests.
https://github.com/WordPress/create-block-theme/actions/runs/21311844655/job/61349179401
However, I'm not sure why we're using svn repo for the WordPress environment in the first place. I think using
wp-envis much simpler.This PR also configures a matrix of five PHP versions and two WordPress versions to ensure compatibility across multiple environments, which is similar to the PHP unit test configuration in Gutenberg.
How to test
Run the following script locally:
test:unit:php: This command starts wp-env before processing PHP unit tests.test:unit:php:base: Only process PHP unit tests.Verify that unit test failures are detected correctly. For example, change any string in this file and run
test:unit:php:base: