GaveUpException
Rasuvaeff\PropertyTesting\GaveUpException
Class — Package: property-testing-core — Source — Version: v1.0.0-1-g88fdee2
Extends: RuntimeException
Implements: Throwable, Stringable, PropertyTestingException
Thrown (as the failure of a property) when discarded inputs — or runs the environment refused — exceed their budget before the requested number of successful checks completes. It exposes successful, discarded, skipped and total attempt counts so the result cannot hide a weak input distribution.
The two budgets are separate, and so are the two messages. A discard is a statement about the input, and the fix is almost always to construct valid inputs directly (e.g. Gen::flatMap() / Gen::draw()) rather than generating broadly and discarding. A skip is a statement about the machine, where narrowing the generators would achieve nothing at all.
Constructor
__construct(
string $propertyName,
int $requiredRuns,
int $successfulRuns,
int $discardedRuns,
int $attempts,
int $maxDiscards,
int $skippedRuns = 0,
bool $exhaustedBySkips = false,
?int $maxSkips = NULL,
)| Parameter | Type | Default | Description |
|---|---|---|---|
$propertyName | string | required | Property that gave up, as the adapter named it. |
$requiredRuns | int | required | Successful checks the configuration asked for. |
$successfulRuns | int | required | Successful checks completed before the budget ran out. |
$discardedRuns | int | required | Runs discarded via Assume::that() — the input left the domain. |
$attempts | int | required | Bodies executed in total, discarded and skipped ones included. |
$maxDiscards | int | required | Cap the discard budget was measured against. |
$skippedRuns | int | 0 | Runs the environment refused (a missing dependency, a skipped lifecycle hook). |
$exhaustedBySkips | bool | false | Which budget ran out: the skips' one, or the discards'. It selects the message, because the two have no advice in common. |
$maxSkips | ?int | NULL | Cap the skip budget was measured against — equal to $maxDiscards whenever the caller configured a maxDiscards, and smaller when the two were left implicit. Null means the two budgets were not told apart; the message then falls back to $maxDiscards rather than printing a cap nobody measured against. |