Skip to content

DateTimeArbitrary

Rasuvaeff\PropertyTesting\Arbitrary\DateTimeArbitrary

ClassPackage: property-testing-coreSourceVersion: v0.1.0-12-g86ead85

Implements: ArbitraryInterface

Generates UTC DateTimeImmutable values with a Unix timestamp drawn uniformly from an inclusive range, and shrinks toward the Unix epoch (1970-01-01T00:00:00Z), clamped to the configured range.

Constructor

php
__construct(
    ?DateTimeImmutable $min = NULL,
    ?DateTimeImmutable $max = NULL,
)
ParameterTypeDefaultDescription
$min?DateTimeImmutableNULL
$max?DateTimeImmutableNULL

Methods

generate()

php
generate(Random $random): Shrinkable

Produce one random value from this arbitrary's space, together with its shrink tree. Candidates must be ordered most aggressive first (typically toward a zero/empty/identity element) and every branch of the tree must be finite, so shrinking terminates.

Documentation inherited from ArbitraryInterface.