Repository navigation
Add Infection mutation testing for PHP unit tests - #4913
Draft
stracker-phil wants to merge 23 commits into
Draft
stracker-phil wants to merge 23 commits into
stracker-phil wants to merge 23 commits into
Conversation
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. 🔗 Test this pull request with WordPress Playground What's included:
Login credentials:
Plugin Details:
🤖 Auto-generated for commit 99aa6d5 • Last updated: 2026-11-30T15:47:42.781Z |
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.
Changelog: (none - dev tooling)
Description
🎯 The goal
Line coverage shows which code the unit tests run, but not whether they check it. Mutation testing makes small changes to the source code and reports each change that no test detects. This PR adds Infection for the PHP unit tests in
tests/PHPUnit, for local runs and in CI.✅ The fix
tests/infection/, apart from the plugin dependencies. It runs only in DDEV.tests/infection/README.mdexplains how to run it and how to read the results.dev/develop. Escaped mutants show as warning annotations on the changed lines. The job does not fail because of escaped mutants, so it never blocks a merge.tests/PHPUnit/bootstrap.phpgives the mutant code to Patchwork.pull_request, so pull requests from forks get checks too.🧪 Tests
Infection first runs the full unit test suite in random order and stops on any failure or STDERR output. Some tests depended on test order or on time, or wrote to STDERR. These tests are fixed, and two tests that were always skipped are removed. No production code changes.