CounterExample
Rasuvaeff\PropertyTesting\CounterExample
Class — Package: property-testing-core — Source — Version: v0.1.0-12-g86ead85
Minimal failing input for a property, captured at falsification time.
Carries both the original (randomly generated) counterexample and the shrunk (minimised) one, plus the seed needed to reproduce the run.
Constructor
php
__construct(
int $seed,
int $runsBeforeFailure,
array<string,mixed> $originalArguments,
array<string,mixed> $shrunkArguments,
int $shrinkSteps = 0,
?\Throwable $failure = NULL,
int $skips = 0,
int $shrinkTrials = 0,
)| Parameter | Type | Default | Description |
|---|---|---|---|
$seed | int | required | Seed of the run that first failed (pass it to Property to reproduce). |
$runsBeforeFailure | int | required | Number of successful (non-discarded) runs before the failure. |
$originalArguments | array<string,mixed> | required | Randomly generated arguments that first failed. |
$shrunkArguments | array<string,mixed> | required | Minimised arguments that still fail. |
$shrinkSteps | int | 0 | Number of accepted shrink steps between the original and the minimised arguments. |
$failure | ?\Throwable | NULL | The assertion or exception reported by the failing run. |
$skips | int | 0 | Number of runs discarded via Assume::that() before the failure. |
$shrinkTrials | int | 0 | Total number of shrink candidates tried (accepted and rejected). |
Methods
toArray()
php
toArray(): arrayMachine-readable representation suitable for reporters and serialization.
toJson()
php
toJson(bool $pretty = false): stringtoExamplesCode()
php
toExamplesCode(string $methodName = 'propertyExamples'): string