wp-phpunit-test-setup
Installation
SKILL.md
WordPress PHPUnit test setup
Get a real WordPress integration test harness running for a plugin or theme. The fast path is WP-CLI's scaffolder, which generates the same layout WordPress core uses. This skill is the setup + CI half; writing the actual tests is wp-phpunit-writing-tests.
When to use this skill
- Adding automated tests to a plugin/theme that has none.
- Wiring PHPUnit into CI (GitHub Actions, GitLab, etc.).
- Debugging
install-wp-tests.sh, the test database,tests/bootstrap.php, or "wrong PHPUnit version" errors. - Reviewing a repo's
phpunit.xml.dist,composer.jsontest scripts, or CI matrix.
The PHPUnit version reality (read this first)
The most common setup mistake: requiring PHPUnit 10 or 11 for a
WP_UnitTestCase integration suite. WordPress 7.1's core test library remains
on PHPUnit 9.x: the official matrix assigns PHPUnit 9 to WordPress 7.1 on PHP
7.4 through 8.5, and core's phpunit.xml.dist uses the PHPUnit 9.2 schema.
Check the official compatibility table
for each WordPress/PHP branch instead of extrapolating from the newest PHP.