PropertyCheck
Rasuvaeff\PropertyTesting\PhpUnit\PropertyCheck
Class — Package: property-testing-phpunit — Source — Version: v0.1.0
Fluent builder mapping the engine's structured PropertyResult onto PHPUnit: a pass counts one assertion, every failing outcome surfaces as one AssertionFailedError carrying the engine failure as previous — the message is the engine's own (seed, original and shrunk arguments, shrink statistics included).
Environment parity with the Testo adapter: PROPERTY_RUNS overrides every run count, PROPERTY_SEED seeds unseeded properties (an explicit PhpUnit\seed() wins), PROPERTY_VERBOSE traces every run, and PROPERTY_DB enables the regression corpus — an explicit seed() disables replay, exactly like an attribute seed does under Testo. An Assume::that() discard is a discarded run inside the property, never a skipped PHPUnit test.
Constructor
__construct(
PHPUnit\Framework\TestCase $testCase,
string $id,
string $name,
array<string,\ArbitraryInterface> $generators,
)| Parameter | Type | Default | Description |
|---|---|---|---|
$testCase | PHPUnit\Framework\TestCase | required | |
$id | string | required | |
$name | string | required | |
$generators | array<string,\ArbitraryInterface> | required |
Methods
runs()
runs(int $runs): selfNumber of successful checks to complete; discarded runs do not count.
seed()
seed(int $seed): selfPins the random phase's seed. A pinned seed also disables regression replay, so the pinned reproducibility wins over the corpus.
maxShrinks()
maxShrinks(int $maxShrinks): selfCap on accepted shrink steps; 0 disables shrinking.
maxDiscards()
maxDiscards(int $maxDiscards): selfMaximum discarded runs before the property gives up.
timeoutMs()
timeoutMs(int $timeoutMs): selfWall-clock deadline for a single run, in milliseconds.
budgetMs()
budgetMs(int $budgetMs): selfWall-clock budget for the whole random phase, in milliseconds.
examples()
examples(list<list> $examples): selfFixed positional argument tuples run before the random phase. A failing example short-circuits and is reported unshrunk — it is already minimal.
listeners()
listeners(PropertyListener $listeners): selfObservers of the run's engine events, notified in the given order.
output()
output(resource $stdout, resource $stderr): selfRedirects the distribution report, discard warning and verbose trace — for tests of this adapter itself.
check()
check(callable $property): voidRuns the property. The closure's parameter names select the generators.