Skip to content
docsv0.44.3

TestBaselineHandler

Records a test baseline and reports the delta against it, so a regression can be told apart from a failure that was already there. The `test` operation already answers "does the suite pass right now" ({@see TestHandler}). What it cannot answer is "did MY change break this" — a red suite looks the same whether the failure is new or pre-existing, and "it already failed" stays an unverifiable claim. This handler closes that gap: `test:baseline` snapshots which tests pass and fail, and `test:delta` runs again and names the new, resolved, and unchanged failures against that snapshot. Like {@see TestHandler} it runs the suite in a real subprocess (running PHPUnit inside PHPUnit is a recursion nobody wants to debug) via an injected {@see ProcessRunner} seam, and reads per-test identity from PHPUnit's JUnit log rather than the human summary, because counts cannot distinguish one broken test from another. NEITHER LEAVES ANYTHING IN THE HOUSE (greenhouse decisions/0523). A baseline is the instrument's own note, not the house's state: it lives in the system's temp area, keyed by the house's root, and PHPUnit is told not to cache its results. So both operations declare an `ephemeral` mutation, and that one declaration is what the terminal's unsigned door (decisions/0522) and the house's closure both read: running the suite needs no signature and is not a change to the house. It used to write `.milpa/test-baseline.json` inside the house, which is a change that lasts, and declaring it ephemeral then would have been a lie.

TestBaselineHandler::__construct()

public function __construct(Milpa\DevTools\Support\RootResolver $roots = new RootResolver(), Milpa\DevTools\Support\ProcessRunner $runner = new ProcessRunner(), Milpa\DevTools\Test\JUnitParser $parser = new JUnitParser(), Milpa\DevTools\Test\TestDelta $delta = new TestDelta(), ?string $baselines = null, Milpa\DevTools\Test\HouseWrites $witness = new HouseWrites()):

Parameters

Parameters of __construct()
NameTypeDescription
$rootsMilpa\DevTools\Support\RootResolver
$runnerMilpa\DevTools\Support\ProcessRunner
$parserMilpa\DevTools\Test\JUnitParser
$deltaMilpa\DevTools\Test\TestDelta
$baselines(string | null)the directory baselines live under, outside every house; null is the system temp area's `milpa-test-baselines`
$witnessMilpa\DevTools\Test\HouseWrites

TestBaselineHandler::handleBaseline()

public function handleBaseline(array $input): array

Runs the suite and records which tests passed and failed as the baseline to compare against later.

Parameters

Parameters of handleBaseline()
NameTypeDescription
$inputarray<string, mixed>

TestBaselineHandler::handleDelta()

public function handleDelta(array $input): array

Runs the suite again and reports the new, resolved, and unchanged failures against the baseline.

Parameters

Parameters of handleDelta()
NameTypeDescription
$inputarray<string, mixed>