Repository navigation
Run PHPUnit on pull requests - #23
Merged
Merged
Conversation
Add a workflow that runs the PHPUnit suite against a MySQL service, using wordpress-develop for WordPress core and the test library. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use the runner's preinstalled MySQL instead of a service container, sparse-check out wordpress-develop, and move to actions/checkout@v7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Block outgoing HTTP in tests: the AJAX tests fire admin_init, whose core update checks made three real requests to api.wordpress.org per test. Build the security tests' users, posts and meta once per class in wpSetUpBeforeClass() instead of ~500 queries before every test. Suite runtime drops from 2.7s to 0.4s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Restrict GITHUB_TOKEN to read-only contents (the repo default is write), don't persist the token in the checkout, and pin actions to full commit SHAs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The PHPUnit suite in
tests/wasn't run in CI, which is how the #20 bootstrap regression reachedtrunkunnoticed (fixed in #22). This adds a workflow that runs it on every PR, speeds up the suite, and hardens both workflows.PHPUnit workflow
WordPress/wordpress-develop(srcplus the test library).Faster tests (CI: 3.6s → 1.2s, locally 2.7s → 0.4s)
admin_init, where core's update checks made three real requests toapi.wordpress.org, adding about 0.45s per test.wpSetUpBeforeClass(), instead of running about 500 queries before every test. Each test still runs in a rolled-back transaction, and five random-order runs all pass.Workflow security (both workflows)
permissions: contents: read. The repo default forGITHUB_TOKENis write, and PHPUnit runs PR code.persist-credentials: false, so the token isn't left in.git/configfor later steps.actions/checkoutv7.0.1,setup-php2.37.2).Testing
🤖 Generated with Claude Code