test: strict PHPUnit config, PCOV coverage and Infection mutation tests#218
Merged
Conversation
…ting - phpunit.xml.dist: random execution order, fail on risky/warning/empty suite, strict output checks, details on deprecations/notices/warnings - PCOV in the DDEV web image (disabled by default, enabled per run to avoid the opcache JIT warning); `ddev phpunit --coverage` generates text, HTML and Clover reports - Infection mutation testing via `ddev infection` / composer test:mutation - CI: PHP 8.3/8.4 matrix, coverage summary + artifact, mutation job Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR strengthens MageForge’s automated testing setup by tightening PHPUnit configuration, adding mutation testing via Infection, and improving coverage reporting (PCOV) locally (DDEV) and in CI.
Changes:
- Made PHPUnit execution stricter (random order, fail on risky/warnings, stricter output/global-state rules) and refined source inclusion/exclusion.
- Added Infection mutation testing configuration plus local DDEV commands to run mutation tests and coverage with PCOV.
- Updated the GitHub Actions PHPUnit workflow to run across PHP 8.3/8.4, generate coverage artifacts/summaries, and add a dedicated mutation-testing job.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
phpunit.xml.dist |
Adds stricter PHPUnit defaults and source filtering. |
infection.json5 |
Introduces Infection configuration and report outputs. |
composer.json |
Adds Infection dependency and test/coverage/mutation scripts. |
.gitignore |
Ignores generated testing reports. |
.github/workflows/phpunit.yml |
Runs PHPUnit matrix with optional coverage and adds mutation job. |
.ddev/web-build/Dockerfile.pcov |
Installs PCOV in the DDEV web image for faster coverage runs. |
.ddev/php/pcov.ini |
Disables PCOV by default (opt-in per run). |
.ddev/commands/web/phpunit |
Adds --coverage flag support and PCOV-enabled coverage runs. |
.ddev/commands/web/infection |
Adds a DDEV command to run Infection with PCOV-enabled initial test run. |
- shellcheck SC2250: brace all variable references in the phpunit command - hadolint: ignore .ddev/web-build/** — DDEV Dockerfile fragments have no FROM and use sudo by design - quote the apt package argument in Dockerfile.pcov Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PHPUnit's text report writes with a bare file_put_contents and only works if the Clover/HTML writers created reports/ first; drop that ordering dependence. Co-Authored-By: Claude Fable 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.
This pull request introduces comprehensive improvements to automated testing, focusing on code coverage and mutation testing for the MageForge module. It adds support for running mutation tests with Infection, enhances code coverage support using PCOV, and updates the CI workflow to test across multiple PHP versions and publish detailed reports. Several scripts and configuration files are updated or added to streamline these processes for both local development and CI.
Testing enhancements:
infection.json5,composer.json,.ddev/commands/web/infection, [1] [2] [3] [4] [5] [6].ddev/commands/web/phpunit,.ddev/php/pcov.ini,.ddev/web-build/Dockerfile.pcov, [1] [2] [3] [4]Continuous integration (CI) improvements:
.github/workflows/phpunit.yml, .github/workflows/phpunit.ymlL8-R122)Configuration improvements:
phpunit.xml.dist, phpunit.xml.distL6-R29)Composer updates:
composer.json, [1] [2] [3]