final class FixtureSet<TValue>
    implements ArrayAccess<int|string, array<string, mixed>|list<array<string, mixed>>|null>, IteratorAggregate<int, array<string, mixed>|list<array<string, mixed>>|null>, Countable

What a plan generated, one entry per table.

Entries can be read by position, which is the order the plan names its tables, or by table name:

[$order, $details] = $faker->fixtures(...); $details = $fixtures['order_detail'];

Rows are held as lists throughout and only presented as one row or many at the edge. Holding either shape in the same field would leave every reader, and every analyser, guessing which one it had.

Methods§

public function __construct(
    private array<string, list<array<string, TValue>>> $rows,
    private array<string, bool> $lists,
    private list<string> $order,
)

Parameters

$rowsarray<string, list<array<string, TValue>>>
$listsarray<string, bool>Table => reads back as a list
$orderlist<string>Table names in the order the plan names them
public function get(int|string $table): array<string, mixed>|list<array<string, mixed>>|null
public function row(int|string $table): array<string, mixed>|null

The single row generated for a table.

Parameters

$tableint|string

Returns

array<string, mixed>|null

Throws

OutOfBoundsException If the table holds a list rather than one row
Test cases 4
Calls 3
public function rows(int|string $table): list<array<string, mixed>>

The rows generated for a table, as a list even where there is only one.

Parameters

$tableint|string

Returns

list<array<string, mixed>>
Test cases 3
Called from 1
Calls 1
public function tables(): list<string>

Returns

list<string>
Test cases 1
public function toArray(): array<string, array<string, mixed>|list<array<string, mixed>>|null>

Returns

array<string, array<string, mixed>|list<array<string, mixed>>|null>
Test cases 2
Calls 1
public function offsetExists(mixed $offset): bool

Reports whether the plan contains an entry at this name or position.

Parameters

$offsetmixed

Returns

bool
Calls 2
public function offsetGet(mixed $offset): ?array

Reads the generated entry at this name or position.

Parameters

$offsetmixed

Returns

?array
Calls 1
public function offsetSet(mixed $offset, mixed $value): void

Rejects modification of the immutable fixture set.

Parameters

$offsetmixed
$valuemixed

Throws

LogicException
Calls 1
public function offsetUnset(mixed $offset): void

Rejects removal from the immutable fixture set.

Parameters

$offsetmixed

Throws

LogicException
Calls 1
public function getIterator(): Traversable

Iterates table entries in the order declared by the fixture plan.

Returns

Traversable
Calls 1
public function count(): int

Returns the number of tables represented by this fixture set.

Returns

int
Calls 1

Private surface 3§

Implementation details, listed for orientation only.

private array<string, list<array<string, TValue>>> $rows
private array<string, bool> $lists
private list<string> $order

Test cases 28§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 19
Other tests reaching this symbol 9

Relations§

Instantiated in 1
Type declarations 3