Skip to content

Runners and mutators

The gate drives the test runner a project already has, and adds the mutators a framework’s code needs.

Runners

RunnerWho makes the mutantsDecided in
PestPest’s own --mutate, through pestphp/pest-plugin-mutateADR-0004
InfectionInfection, with PHPUnit 12 or 13ADR-0004
PHPUnit on its ownthe gate, through a PHPUnit extensionADR-0023
PhpSpec, Codeceptionthe gate, through an extension of eachADR-0027
Testothe gate, through a Testo pluginADR-0027, ADR-0047

Every runner reports each mutant with the same statuses, and the gate judges them all by the same rules, so a verdict means the same under each. Zero-config chooses the runner that is installed: PHPUnit, PhpSpec, Codeception or Testo only where neither Pest’s mutation plugin nor Infection is, and Pest is not. A run refuses a runner release it does not drive before it starts, and doctor says so first (ADR-0041).

Mutator sets

SetWhat it mutatesTurned on
defaultPest’s default set, and a mutator for each family it leaves out: removing a throw, and public to protectedalways, under the native runners; Pest and Infection run their own mutators in its place
securityconstant-time comparisons, password checks, escaping, input filtering and session regenerationby every preset
laravelgates, guards, escaping, validation, transactions, caches and dispatchesby the laravel preset
symfonyaccess checks, CSRF and password checks, forms, flushes and message dispatchesby the symfony preset

mutators.sets turns sets on, and mutators.except turns single mutators off. Installing a package never changes a score by itself (ADR-0021).

Every mutator is written once against the gate’s SDK, on php-parser 5, and runs under every runner through a bridge the gate writes for it: under Pest beside Pest’s own mutators, under Infection beside the mutators the project’s Infection config turns on, and under the native runners in the gate’s own engine. A mutator tagged security makes security mutants, which are held to a floor of their own (floors and the score).

Writing mutators says how to write a set of your own.

Presets

A preset is a layer of config for a kind of project: library, laravel or symfony, chosen from composer.json where the config names none. It sets the trees to fall back on, the files every test reads, a longer timeout where the tests boot a framework, and the mutator sets (configuration).