Improve PHPUnit test infrastructure#588
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
@dd32 Heads up in case you have any feedback on this. |
There was a problem hiding this comment.
Pull request overview
This PR aims to improve local PHPUnit testing ergonomics and reproducibility for the Plugin Directory project by adding a dedicated npm test script, adding Yoast PHPUnit Polyfills, committing a composer.lock, and ignoring PHPUnit’s result cache file.
Changes:
- Add
plugins:testnpm script to run Plugin Directory PHPUnit tests viawp-env. - Add
yoast/phpunit-polyfillstocomposer.jsonand commitcomposer.lockfor reproducible dev installs. - Ignore
.phpunit.result.cachein Git.
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| environments/package.json | Adds a plugins:test script intended to run PHPUnit inside the wp-env environment. |
| composer.json | Adds Yoast PHPUnit Polyfills as a dev dependency. |
| composer.lock | New lockfile pinning dev dependency graph (including PHPUnit). |
| .gitignore | Ignores PHPUnit result cache file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add test-specific wp-env config for plugin directory with lifecycle script that upgrades PHPUnit to 11 and installs Yoast polyfills - Use tests-cli container for proper test isolation - Pin PHPUnit ^11.0 locally to match container version - Add Yoast PHPUnit Polyfills (^4.0) for cross-version test support - Add plugins:test and plugins:test:env npm scripts - Update CI workflow to use test config and tests-cli container - Add .phpunit.result.cache to .gitignore Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
61c8a4d to
597fdb1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 7 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
plugins:testnpm script to make it easier to run phpunit tests for the plugin directory..phpunit.result.cacheto.gitignoreto avoid it polluting diffs.composer.lockfor reproducible dev dependency installs for everyone. See https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-controlTest plan
composer install— confirms lock file installs correctlycd environments && npm run plugins:test— confirms the test script works🤖 Generated with Claude Code