Repository navigation
Verifying the set
Written against v1.6.1.
The set is verified by applying the 17 patches in order to the v5.0.2 tag of pestphp/pest-plugin-mutate with git apply, then driving the patched code.
tests/check.sh does this on every pull request, on each push to main and once a week, in the Patches workflow (.github/workflows/patches.yml). The workflow's job is skipped when the RUN_REMOTE_CI variable is false; run the same script locally for the same check.
- It installs the pinned upstream into a temporary directory.
- It applies every patch
composer.jsonlists, in order, and fails if one does not apply. - It runs the behavior checks below against the patched code.
| Option | Effect |
|---|---|
SKIP_PATCH=<file> tests/check.sh |
Leaves one patch out. The negative control: the check for that patch must then fail. |
PATCH_DIR=<dir> tests/check.sh |
Applies the patches from another directory. |
-
tests/timeout.phpdrives the realMutationTest::start()and asserts the time limit the mutant-timeout patch gives a child: for a 3.9 s initial suite, 8 s in a serial run and 56 s at 12 processes. WithSKIP_PATCH=pest-plugin-mutate-mutant-timeout.patchthe 12-process figure is 8 s and the check fails. -
tests/crash.phpdriveshasFinished()with children that end in different ways. Of the first ten, six must score a kill: one that crashes after printing a failed test, one killed by a fatal error that prints PHPUnit's premature-end line naming its test, one that dies of a compile error in the mutated file, two that run past PHP's time limit, and one that exhausts the hard memory limit. Four must be refused: one that fails without a failed test, one that dies of a fatal error before any test starts, one that dies of a fatal error in another file, and one that exits 0 with no report. The later cases cover a silent exit of-1073741571(Windows only), which must score a kill, silent exits of 1 and 255, which stay refused, and a child that ends through the code's ownexitwhile a test runs, which must score a kill, against the same silent exit before any test starts or after every test finished, which stay refused. -
tests/patchwork.phpchecks that Patchwork is back in front of the stream wrapper after a pass-through read. -
tests/retry.phpdriveshasFinished()with a child that runs past its limit. One that times out once and is killed on the second attempt, and one that times out once and passes on it, are scored by the second attempt; one that times out twice is run once more without the mutation, and is scored a timeout when that run finishes and untested when it runs past the limit too (a slow covering test file). A child whose fast test fails the mutant before the slow file is scored a kill. WithSKIP_PATCH=pest-plugin-mutate-mutant-timeout-retry.patchthe first two cases score a timeout and the check fails. -
tests/defaults.phpdrivesMutationGeneratorandMutationTest::start()over multi-line functions whose parameter default is a bare literal,-5,[1, 2]and3 + 1, a function nothing calls, and a literal in a function body. Every default mutant must reach the end of its function and select the test covering that function; the uncalled function's default must stay uncovered; the body literal keeps its own line. With the patches as they stood before UAMS-Web/patches-pest-plugin-mutate#123 (PATCH_DIRpointing at them) the-5,[1, 2]and3 + 1cases fail, six rows in all, and the bare literal and the body literal still pass. -
tests/constants.phpdrivesMutationGeneratorwith a covered class that holds a constant array. With the covered lines of that class aslinesToMutate, as--covered-onlypasses them, both constant mutants must be generated; a class with no covered line must get none; with no filter the population is unchanged. A second class carries an attribute: its constant mutants must keep their own line (not the attribute's), carry the class range for the coverage lookup, keep it through serialization, and find the tests covering the class whenMutationTest::start()looks them up. WithSKIP_PATCH=pest-plugin-mutate-class-constant-coverage.patchthe first case generates none and the check fails. -
tests/junit.phpdrives the realMutationTest::start()with a run that was given--log-junit=<file>and with one given--log-junit <file>, and reads the child's command line. It must carry one--log-junit(its own), none naming the run's file, and every other option; a run given no--log-junitstill gets the child's own. With the no-test-check patch as it stood before #64 the child carries two and the run's file, which Pest refuses. -
tests/activation.phploads the patchedsrc/Autoload.phpwith no mutation variables set (the wrapper must not start and the source file reads unchanged), then with them set (the wrapper starts and the source file reads as the replacement), then a second time (it must not start a second wrapper). WithSKIP_PATCH=pest-plugin-mutate-isolated-process-activation.patchit fails for the missing file. -
tests/unreadable.phpchecks what the stat family reports for a mode-000file, a missing path, a dangling symlink and the source file, with no wrapper and with the mutation stream wrapper started. With the wrapper,is_file()andfile_exists()must report the unreadable file present, as they do without it; a missing path must report absent, calling no error handler for an existence check and one, unsilenced, forstat()orlstat();is_link()must report the dangling symlink; and including the source file must load the override. WithSKIP_PATCH=pest-plugin-mutate-url-stat-unreadable.patchthe unreadable file reports absent and the check fails. Where mode000does not stop a read (as root, or on Windows) the unreadable rows are skipped, and fail whenCIis set. -
tests/coverage-report.phprunspest --mutateon a small project (one class, with a mutant a test kills, one it does not, and one nothing calls) throughvendor/bin/pest, against a coverage report produced from the same project. A run given the report (PEST_MUTATE_COVERAGE_REPORT) must not run the suite (a test appends to a file each time the suite runs outside a mutant child), must leave the report byte-identical, and must print the same mutants, results and ids as a run that produced its own report; it must do the same for a second run and for a path relative to the working directory. A run given none must run the suite and remove the report it wrote. A run also given--filteror--coverage-php(naming the report or not) must score the same and leave the report unchanged. A report that does not exist, is a directory, does not parse, does not return a report or holds no coverage data must fail the run and name its path. It also readsPEST_MUTATE_SUITE_SECONDS(a number above zero and finite is taken, anything else is ignored, and a parallel run records it divided by its process count). WithSKIP_PATCH=pest-plugin-mutate-coverage-report.patchthe check fails for the missingMutate::coverageReport(). Producing a report needs a coverage driver (pcov or Xdebug): without one the project cases are skipped, and fail whenCIis set.
The other nine patches are checked for applying only.
After the 17 patches are applied in order, applying pest-plugin-mutate-windows-filter-length.patch a second time must fail. tests/check.sh does not run this; it applies each patch once.
A consumer needs no test of its own that asserts the mutant-timeout patch is present in vendor/: this repository's check fails when the patch stops applying to the pin or stops changing the limit.
Related: Patches, Troubleshooting.
Home | Using the patches | Patches | Versioning | Verifying the set | Adding or retiring a patch | Troubleshooting | README | Repository
Written against v1.6.1. Edit these pages in docs/wiki/ through a pull request; edits made here are overwritten on the next publish.
Getting started
Reference
Maintaining the package
Troubleshooting
Project