TenantAtlas/apps/platform/tests/Feature/Guards/FixtureLaneImpactBudgetTest.php
2026-04-16 19:27:47 +02:00

54 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
use Tests\Support\TestLaneManifest;
use Tests\Support\TestLaneReport;
it('keeps the shared fixture slimming pre-migration baselines recorded for the standard lanes', function (): void {
$fastFeedback = TestLaneManifest::comparisonBaseline('shared-test-fixture-slimming', 'fast-feedback');
$confidence = TestLaneManifest::comparisonBaseline('shared-test-fixture-slimming', 'confidence');
expect($fastFeedback)->toMatchArray([
'laneId' => 'fast-feedback',
'wallClockSeconds' => 176.73623,
'targetImprovementPercent' => 10,
'maxRegressionPercent' => 5,
])
->and($confidence)->toMatchArray([
'laneId' => 'confidence',
'wallClockSeconds' => 394.383441,
'targetImprovementPercent' => 10,
'maxRegressionPercent' => 5,
]);
});
it('classifies lane-impact comparison status against the recorded fixture slimming baseline', function (): void {
$improved = TestLaneReport::buildReport(
laneId: 'fast-feedback',
wallClockSeconds: 150.0,
slowestEntries: [],
durationsByFile: [],
comparisonProfile: 'shared-test-fixture-slimming',
);
$stable = TestLaneReport::buildReport(
laneId: 'fast-feedback',
wallClockSeconds: 180.0,
slowestEntries: [],
durationsByFile: [],
comparisonProfile: 'shared-test-fixture-slimming',
);
$regressed = TestLaneReport::buildReport(
laneId: 'fast-feedback',
wallClockSeconds: 190.0,
slowestEntries: [],
durationsByFile: [],
comparisonProfile: 'shared-test-fixture-slimming',
);
expect(data_get($improved, 'sharedFixtureSlimmingComparison.status'))->toBe('improved')
->and(data_get($stable, 'sharedFixtureSlimmingComparison.status'))->toBe('stable')
->and(data_get($regressed, 'sharedFixtureSlimmingComparison.status'))->toBe('regressed');
});