Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| TestResult | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\WptHarness; |
| 6 | |
| 7 | /** |
| 8 | * Per-test result row written to the harness ledger |
| 9 | * (`var/wpt/report.json`). One instance per WPT test per harness run. |
| 10 | * |
| 11 | * Phase 4A.5 serialises a collection of these into the published |
| 12 | * dashboard at `docs/site/standards/spec-coverage/wpt-report.md`. |
| 13 | */ |
| 14 | final readonly class TestResult |
| 15 | { |
| 16 | /** |
| 17 | * @param string $testId Stable WPT test identifier — the |
| 18 | * relative path under |
| 19 | * `vendor-data/wpt/`, minus the |
| 20 | * file extension. Example: |
| 21 | * `css/css-transforms/transform-2d-001`. |
| 22 | * @param TestStatus $status Where the test landed in the |
| 23 | * {@see TestStatus} bucket |
| 24 | * hierarchy. |
| 25 | * @param float $diffScore Perceptual diff score in |
| 26 | * `[0.0, 1.0]`. `0.0` is byte- |
| 27 | * identical to the reference; |
| 28 | * `1.0` is "completely |
| 29 | * different". Pass tolerance is |
| 30 | * set by the harness config and |
| 31 | * defaults to `0.01` per the WPT |
| 32 | * reftest convention. |
| 33 | * @param string|null $reason Human-readable explanation when |
| 34 | * the status is `OutOfScope`, |
| 35 | * `PendingSubstrate`, or |
| 36 | * `Skipped`. Null when status is |
| 37 | * `Pass` or `Fail`. |
| 38 | * @param string|null $diffArtefactPath Path under `var/wpt/diffs/` |
| 39 | * where rendered.png + ref.png + |
| 40 | * diff.png live. Null when no |
| 41 | * diff was produced (out-of-scope |
| 42 | * / skipped tests). |
| 43 | * @param float $renderMicros Wall-clock time the renderer |
| 44 | * spent on this test, in |
| 45 | * microseconds. Tracked so the |
| 46 | * dashboard can surface |
| 47 | * performance regressions |
| 48 | * alongside conformance ones. |
| 49 | */ |
| 50 | public function __construct( |
| 51 | public string $testId, |
| 52 | public TestStatus $status, |
| 53 | public float $diffScore, |
| 54 | public ?string $reason, |
| 55 | public ?string $diffArtefactPath, |
| 56 | public float $renderMicros, |
| 57 | ) {} |
| 58 | } |