Integration fixture API
This reference lists integration fixture definitions, contexts, resources, and sensitive values.
These signatures are the public API.
FixtureResource
Namespace: Greenlight\IntegrationFixture
JSON-safe information exposed by one orchestrator-owned integration fixture.
Ordinary values and secrets are kept separate so debug output can redact
credentials. Secrets are strings and require an explicit reveal() call.
final readonly class FixtureResource
from()
Creates one resource from ordinary values and secrets.
Values can contain null, integers, booleans, finite floats, UTF-8 strings, lists, and maps. Map keys must be non-empty UTF-8 strings. Values can contain up to 16 nested lists or maps below the top-level map. Secrets must map non-empty UTF-8 string keys to UTF-8 string values.
public static function from(array $values = [], #[\SensitiveParameter] array $secrets = []): self
PHPDoc:
@param array<string, mixed> $values@param array<mixed> $secrets@throws \InvalidArgumentException when an input does not satisfy these requirements
empty()
public static function empty(): self
has()
public function has(string $key): bool
value()
public function value(string $key): mixed
PHPDoc:
@throws \OutOfBoundsException when no ordinary value has the key
string()
public function string(string $key): string
PHPDoc:
@throws \OutOfBoundsException when no ordinary value has the key@throws \UnexpectedValueException when the value is not a string
int()
public function int(string $key): int
PHPDoc:
@throws \OutOfBoundsException when no ordinary value has the key@throws \UnexpectedValueException when the value is not an integer
float()
public function float(string $key): float
PHPDoc:
@throws \OutOfBoundsException when no ordinary value has the key@throws \UnexpectedValueException when the value is not an integer or float
bool()
public function bool(string $key): bool
PHPDoc:
@throws \OutOfBoundsException when no ordinary value has the key@throws \UnexpectedValueException when the value is not a boolean
list()
public function list(string $key): array
PHPDoc:
@return list<mixed>@throws \OutOfBoundsException when no ordinary value has the key@throws \UnexpectedValueException when the value is not a list
map()
public function map(string $key): array
PHPDoc:
@return array<string, mixed>@throws \OutOfBoundsException when no ordinary value has the key@throws \UnexpectedValueException when the value is not a map
secret()
public function secret(string $key): SensitiveValue
PHPDoc:
@throws \OutOfBoundsException when no secret has the key
mergedWith()
public function mergedWith(self $channel): self
__debugInfo()
public function __debugInfo(): array
PHPDoc:
@return array{values: array<string, mixed>, secrets: array<string, string>}
IntegrationFixtureContext
Namespace: Greenlight\IntegrationFixture
Supplies orchestrator-side operations while Greenlight provisions one integration fixture.
interface IntegrationFixtureContext
runId()
public function runId(): string;
PHPDoc:
@return non-empty-string
configuredWorkers()
Returns the worker limit for the selected execution adapter. In-process execution returns one, including a fallback from process-pool execution.
public function configuredWorkers(): int;
PHPDoc:
@return positive-int
channels()
The channel numbers that can be live during this execution.
public function channels(): array;
PHPDoc:
@return non-empty-list<positive-int>
shard()
public function shard(): ?array;
PHPDoc:
@return array{int, int}|null one-based shard index and shard count
dependency()
Gets the shared resource or the resource for one channel.
public function dependency(string $id, ?int $channel = null): FixtureResource;
PHPDoc:
@throws \LogicException when the fixture does not declare the dependency@throws \OutOfBoundsException when the channel is not part of this run
defer()
Register cleanup immediately after the provisioner acquires a resource. This makes cleanup available if a later operation fails.
public function defer(\Closure $cleanup): void;
PHPDoc:
@param \Closure(): void $cleanup
expose()
Publishes shared data plus optional channel-specific overlays.
public function expose(FixtureResource $shared, array $channels = []): void;
PHPDoc:
@param array<int, FixtureResource> $channels keyed by channel number@throws \InvalidArgumentException when a channel is not part of this run@throws \LogicException when the provisioner publishes resources more than once
IntegrationFixtureDefinition
Namespace: Greenlight\IntegrationFixture
One orchestrator-owned integration fixture and its dependencies. IDs must remain string keys in PHP maps.
final readonly class IntegrationFixtureDefinition
$id
public string $id;
PHPDoc:
@var non-empty-string
$dependsOn
public array $dependsOn;
PHPDoc:
@var list<non-empty-string>
$provision
public \Closure $provision
__construct()
Creates one fixture definition.
Each ID must be a non-empty UTF-8 string that is not an integer string. Dependency IDs must be unique.
public function __construct(
string $id,
public \Closure $provision,
array $dependsOn = [],
)
PHPDoc:
@param \Closure(IntegrationFixtureContext): void $provision@param list<mixed> $dependsOn@throws \InvalidArgumentException when an ID does not satisfy these requirements
IntegrationResources
Namespace: Greenlight\IntegrationFixture
The integration fixtures visible to one worker channel.
A worker receives shared data merged with only its own channel data. This object does not contain data allocated only to other channels. Fixture IDs must remain string keys in PHP maps.
final readonly class IntegrationResources
__construct()
public function __construct(private array $fixtures = [])
PHPDoc:
@param array<non-empty-string, FixtureResource> $fixtures@throws \InvalidArgumentException when a key or value is invalid
empty()
public static function empty(): self
has()
public function has(string $id): bool
fixture()
public function fixture(string $id): FixtureResource
PHPDoc:
@throws \OutOfBoundsException when the fixture is not available
__debugInfo()
public function __debugInfo(): array
PHPDoc:
@return array{fixtures: array<non-empty-string, FixtureResource>}
SensitiveValue
Namespace: Greenlight\IntegrationFixture
A fixture value that code must reveal explicitly.
Object dumps and exports do not include the underlying value.
final readonly class SensitiveValue
__construct()
public function __construct(#[\SensitiveParameter] string $value)
reveal()
public function reveal(): string
__debugInfo()
public function __debugInfo(): array
PHPDoc:
@return array{value: string}