StringArbitrary
Rasuvaeff\PropertyTesting\Arbitrary\StringArbitrary
Class — Package: property-testing-core — Source — Version: v0.1.0-12-g86ead85
Implements: ArbitraryInterface
Generates random strings and shrinks them by length toward the empty string, then character-by-character toward 'a'.
Two alphabets are available: an ASCII printable subset (32..126) and the full Unicode space via Arbitrary\mb_chr(). Length is chosen uniformly within an inclusive range.
Constructor
php
__construct(
int $minLength = 0,
int $maxLength = 100,
bool $unicode = false,
)| Parameter | Type | Default | Description |
|---|---|---|---|
$minLength | int | 0 | |
$maxLength | int | 100 | |
$unicode | bool | false | When true, characters are drawn from the full Unicode codepoint space (U+0001..U+10FFFF, excluding surrogates); otherwise ASCII printable. |
Methods
generate()
php
generate(Random $random): ShrinkableProduce 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.