Skip to content

EnvironmentOverrides ​

Rasuvaeff\PropertyTesting\Runner\EnvironmentOverrides

Class — Package: property-testing-core — Source — Version: v1.0.0-1-g88fdee2

The values of the PROPERTY_* environment variables, parsed.

The adapters read the environment — the engine never does — and every one of them has to turn the same strings into the same values with the same refusals, or PROPERTY_RUNS=abc would mean one thing under Testo and another under PHPUnit. Each parser takes the raw value as getenv() hands it over (false when unset) and answers with the parsed value, or null when the variable is unset or empty and the caller's own default applies.

php
$runs = EnvironmentOverrides::runs(getenv('PROPERTY_RUNS')) ?? $attribute->runs;

Methods ​

runs() ​

php
static runs(string|false $value): ?int

PROPERTY_RUNS: a positive integer.

  • $value — The variable's value as getenv() reports it; false when unset.

Throws:

  • InvalidArgumentException — When the value is not a positive integer within range.

count() ​

php
static count(string $variable, string|false $value): ?int

A count variable such as PROPERTY_SEARCH_RUNS: a non-negative integer, where 0 means "none" and is a valid way to switch a phase off from the environment.

  • $variable — The variable's name, for the message.
  • $value — The variable's value as getenv() reports it; false when unset.

Throws:

  • InvalidArgumentException — When the value is not a non-negative integer within range.

seed() ​

php
static seed(string|false $value): ?int

PROPERTY_SEED: an integer. A value past the integer range would saturate to PHP_INT_MAX under a cast, and a replay under "the same" seed would then be a different run.

  • $value — The variable's value as getenv() reports it; false when unset.

Throws:

  • InvalidArgumentException — When the value is not an integer within range.

phases() ​

php
static phases(string|false $value): ?array

PROPERTY_PHASES: a comma-separated list of phase names, case-insensitive (examples,corpus is the fast pull-request gate). An unknown name is an error rather than a skipped stage — a run that silently performed fewer stages would report green having checked less.

  • $value — The variable's value as getenv() reports it; false when unset.

Throws:

  • InvalidArgumentException — When a name is not a phase.

edgeCases() ​

php
static edgeCases(string|false $value): ?Runner\EdgeCases

PROPERTY_EDGE_CASES: mixin or none, case-insensitive. An unknown value is an error rather than a silent fallback — a suite that quietly kept the bias it was told to drop would spend the discard budget it was trying to save.

  • $value — The variable's value as getenv() reports it; false when unset.

Throws:

  • InvalidArgumentException — When the value is neither mixin nor none.

flag() ​

php
static flag(string|false $value): ?bool

A switch such as PROPERTY_DERANDOMIZE or PROPERTY_VERBOSE: unset and empty mean "not given" (null); 0, false, off and no mean off (case-insensitively, surrounding whitespace ignored); anything else on.

  • $value — The variable's value as getenv() reports it; false when unset.

The written-out spellings are here because a shell exports words as readily as digits, and PROPERTY_VERBOSE=false turning verbose output on is a bug report waiting to happen — the value says off in every language the reader knows.

string() ​

php
static string(string|false $value): ?string

A free-form value such as PROPERTY_PATH or PROPERTY_DB: the string, or null when unset or empty.

  • $value — The variable's value as getenv() reports it; false when unset.