VerificationFailure
Rasuvaeff\Understudy\VerificationFailure
Class — Package: rasuvaeff/understudy — Source — Version: v0.4.1
The structured half of one verification failure — the same facts the rendered message states, addressable by field.
For tooling that wants to do something with a failure other than print it: a runner adapter, an IDE plugin, a report aggregator. The rendered message stays the human surface; this class is the machine one.
Which fields are set depends on the kind:
| Kind | double | expectation | expectedMinimum/expectedMaximum | actualCount | observedCalls | expectedCalls |
|---|---|---|---|---|---|---|
UnmetExpectation | label | call spec | the claimed bounds | matched calls | calls to the same method | — |
StrictStubUnused | label | call spec | — | 0 | — | — |
OutOfOrder | label | the call that came first | — | — | — | — |
OutOfSequence | — | the mismatched position | — | calls made | the whole protocol | the specified sequence |
UnaccountedCalls | label | — | — | unaccounted calls | the unaccounted calls | — |
UnusedDouble | label | — | 0/0 | calls received | every call | — |
The readonly fields of this class, of FailureKind, and of the exceptions carrying them are frozen public API from v0.1.0: renaming, removing or retyping any of them is a major-version change. New kinds and newly-populated fields are additive and may arrive in a minor.
Constructor
php
__construct(
FailureKind $kind,
non-empty-string $summary,
string|null $double = NULL,
string|null $expectation = NULL,
int<0, max>|null $expectedMinimum = NULL,
int<0, max>|null $expectedMaximum = NULL,
int<0, max>|null $actualCount = NULL,
list<\Invocation>|null $observedCalls = NULL,
list<string>|null $expectedCalls = NULL,
)| Parameter | Type | Default | Description |
|---|---|---|---|
$kind | FailureKind | required | |
$summary | non-empty-string | required | this failure's rendered text; the exception's message is these joined with a blank line |
$double | string|null | NULL | the label of the double the claim is about |
$expectation | string|null | NULL | the call specification, as failure messages render it |
$expectedMinimum | int<0, max>|null | NULL | |
$expectedMaximum | int<0, max>|null | NULL | |
$actualCount | int<0, max>|null | NULL | |
$observedCalls | list<\Invocation>|null | NULL | the calls the rendered report shows |
$expectedCalls | list<string>|null | NULL | the specified sequence, for OutOfSequence |