Skip to content

Use wp-env for PHP unit test#802

Merged
mikachan merged 2 commits intotrunkfrom
php-unit-test-wp-env
Feb 25, 2026
Merged

Use wp-env for PHP unit test#802
mikachan merged 2 commits intotrunkfrom
php-unit-test-wp-env

Conversation

@t-hamano
Copy link
Contributor

@t-hamano t-hamano commented Jan 24, 2026

I noticed that PHP unit tests are failing in recent pull requests.

https://github.com/WordPress/create-block-theme/actions/runs/21311844655/job/61349179401

image

However, I'm not sure why we're using svn repo for the WordPress environment in the first place. I think using wp-env is 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:

image

@t-hamano t-hamano force-pushed the php-unit-test-wp-env branch from 1aed25c to 2bf7f59 Compare January 24, 2026 08:59
@t-hamano t-hamano self-assigned this Jan 24, 2026
@t-hamano t-hamano marked this pull request as ready for review January 24, 2026 09:02
Copy link
Member

@mikachan mikachan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two commands work well for me locally:

  • test:unit:php
  • test:unit:php:base

I've left two small inline comments, but they're not blockers. Thanks!

Co-authored-by: Sarah Norris <1645628+mikachan@users.noreply.github.com>
@mikachan mikachan merged commit 4cc3f8a into trunk Feb 25, 2026
12 checks passed
@mikachan mikachan deleted the php-unit-test-wp-env branch February 25, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants