Skip to content
docsv0.24.0

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.

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()):

Parameters

Parameters of __construct()
NameTypeDescription
$rootsMilpa\DevTools\Support\RootResolver
$runnerMilpa\DevTools\Support\ProcessRunner
$parserMilpa\DevTools\Test\JUnitParser
$deltaMilpa\DevTools\Test\TestDelta

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>