Skip to content

ConflictingExpectation

Rasuvaeff\Understudy\Exception\ConflictingExpectation

ClassPackage: rasuvaeff/understudySourceVersion: v0.4.1

Extends: LogicException

Implements: Throwable, Stringable, Exception\UnderstudyError

A when() or expect() names a call another registration already specifies, and the two would not compose: whichever is declared later takes the dispatch, and the earlier one silently loses its purpose — a stub's answer is replaced by the mode default, or a count is starved and reported as "called never" about a call that did happen.

Refused at registration, because that is where the mistake is made: the dispatch semantics stay exactly as documented, and the only layering this closes is the one with no working reading. Two plain stubs for one call are still the documented "most recently registered wins" arrangement.

Methods

claimAfterStub()

php
static claimAfterStub(non-empty-string $label, non-empty-string $spec): self

stubAfterCountedExpectation()

php
static stubAfterCountedExpectation(
    non-empty-string $label,
    non-empty-string $spec,
): self

duplicateCountedExpectation()

php
static duplicateCountedExpectation(
    non-empty-string $label,
    non-empty-string $spec,
): self