StubbedEnvironmentReader
The isolated-replay counterpart to RecordingEnvironmentReader: never reads a real environment variable, answering every call from an injected EffectLedger matched on the bare variable name.
A variable with no matching recorded effect throws rather than fabricating a value or falling through to the real getenv() — inventing a value would fabricate a passing test, the same rule StubbedCache/StubbedPdo/StubbedHttpTransport follow. A variable that WAS recorded as unset (false) replays as false, not an exception — that is itself the recorded, correct answer.
Synopsis
Section titled “Synopsis”final class StubbedEnvironmentReader implements EnvironmentReaderInterface
| Implements | EnvironmentReaderInterface |
| Source | Replay/StubbedEnvironmentReader.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(EffectLedger $ledger): mixed
| Parameter | Type | Description |
|---|---|---|
$ledger | EffectLedger |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
| [`get(string $name): string | false`](#get) |
public function get(string $name): string|false
The value of environment variable $name, or false when it is unset.
| Parameter | Type | Description |
|---|---|---|
$name | string |
Returns string``|``false