Skip to content

Verifying the set

github-actions[bot] edited this page Dec 1, 2026 · 4 revisions

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.

What runs, and where

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.

  1. It installs the pinned upstream into a temporary directory.
  2. It applies every patch composer.json lists, in order, and fails if one does not apply.
  3. 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.

The behavior checks

  • tests/timeout.php drives the real MutationTest::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. With SKIP_PATCH=pest-plugin-mutate-mutant-timeout.patch the 12-process figure is 8 s and the check fails.

  • tests/crash.php drives hasFinished() 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 own exit while 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.php checks that Patchwork is back in front of the stream wrapper after a pass-through read.

  • tests/retry.php drives hasFinished() 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. With SKIP_PATCH=pest-plugin-mutate-mutant-timeout-retry.patch the first two cases score a timeout and the check fails.

  • tests/defaults.php drives MutationGenerator and MutationTest::start() over multi-line functions whose parameter default is a bare literal, -5, [1, 2] and 3 + 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_DIR pointing at them) the -5, [1, 2] and 3 + 1 cases fail, six rows in all, and the bare literal and the body literal still pass.

  • tests/constants.php drives MutationGenerator with a covered class that holds a constant array. With the covered lines of that class as linesToMutate, as --covered-only passes 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 when MutationTest::start() looks them up. With SKIP_PATCH=pest-plugin-mutate-class-constant-coverage.patch the first case generates none and the check fails.

  • tests/junit.php drives the real MutationTest::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-junit still 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.php loads the patched src/Autoload.php with 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). With SKIP_PATCH=pest-plugin-mutate-isolated-process-activation.patch it fails for the missing file.

  • tests/unreadable.php checks what the stat family reports for a mode-000 file, 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() and file_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, for stat() or lstat(); is_link() must report the dangling symlink; and including the source file must load the override. With SKIP_PATCH=pest-plugin-mutate-url-stat-unreadable.patch the unreadable file reports absent and the check fails. Where mode 000 does not stop a read (as root, or on Windows) the unreadable rows are skipped, and fail when CI is set.

  • tests/coverage-report.php runs pest --mutate on a small project (one class, with a mutant a test kills, one it does not, and one nothing calls) through vendor/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 --filter or --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 reads PEST_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). With SKIP_PATCH=pest-plugin-mutate-coverage-report.patch the check fails for the missing Mutate::coverageReport(). Producing a report needs a coverage driver (pcov or Xdebug): without one the project cases are skipped, and fail when CI is set.

The other nine patches are checked for applying only.

A check by hand

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.

What this means for a consumer

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.

Clone this wiki locally