Skip to content

VerificationFailure ​

Rasuvaeff\Understudy\VerificationFailure

Class — Package: rasuvaeff/understudy — Source — Version: v1.1.0-1-g6ed023f

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:

KinddoubleexpectationexpectedMinimum/expectedMaximumactualCountobservedCallsexpectedCalls
UnmetExpectationlabelcall specthe claimed boundsmatched callscalls to the same method—
StrictStubUnusedlabelcall spec—0——
OutOfOrderlabelthe call that came first————
OutOfSequence—the mismatched position—calls madethe whole protocolthe specified sequence
UnaccountedCallslabel——unaccounted callsthe unaccounted calls—
UnusedDoublelabel—0/0calls receivedevery call—

The readonly fields of this class and every existing FailureKind case are stable: renaming, removing or retyping one is a major-version change. A NEW kind, or a field newly populated for an existing kind, may arrive in a minor — so match on FailureKind with a default arm; an exhaustive match over the enum is not a supported way to consume it.

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,
)
ParameterTypeDefaultDescription
$kindFailureKindrequired
$summarynon-empty-stringrequiredthis failure's rendered text; the exception's message is these joined with a blank line
$doublestring|nullNULLthe label of the double the claim is about
$expectationstring|nullNULLthe call specification, as failure messages render it
$expectedMinimumint<0, max>|nullNULL
$expectedMaximumint<0, max>|nullNULL
$actualCountint<0, max>|nullNULL
$observedCallslist<\Invocation>|nullNULLthe calls the rendered report shows
$expectedCallslist<string>|nullNULLthe specified sequence, for OutOfSequence