classFixtureSet
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
$rows | array<string, list<array<string, TValue>>> | |
$lists | array<string, bool> | Table => reads back as a list |
$order | list<string> | Table names in the order the plan names them |
public function get(int|string $table): array<string, mixed>|list<array<string, mixed>>|nullParameters
$table | int|string |
Returns
array<string, mixed>|list<array<string, mixed>>|nullTest cases 1
Called from 3
- method-call SqlFixture\Fixture\FixtureSet::toArray() packages/sql-fixture/src/Fixture/FixtureSet.php:100
- method-call SqlFixture\Fixture\FixtureSet::offsetGet() packages/sql-fixture/src/Fixture/FixtureSet.php:119
- method-call SqlFixture\Fixture\FixtureSet::getIterator() packages/sql-fixture/src/Fixture/FixtureSet.php:146
Calls 2
- function-call
is_intline 50 - method-call FixtureSet::rows() line 52
public function row(int|string $table): array<string, mixed>|nullThe single row generated for a table.
Parameters
$table | int|string |
Returns
array<string, mixed>|nullThrows
OutOfBoundsException If the table holds a list rather than one rowTest cases 4
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
$table | int|string |
Returns
list<array<string, mixed>>Test cases 3
Called from 1
Calls 1
- function-call
is_intline 82
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
- method-call FixtureSet::get() line 100
public function offsetExists(mixed $offset): boolpublic function offsetGet(mixed $offset): ?arrayReads the generated entry at this name or position.
Parameters
$offset | mixed |
Returns
?arrayCalls 1
- method-call FixtureSet::get() line 119
public function offsetSet(mixed $offset, mixed $value): voidRejects modification of the immutable fixture set.
Parameters
$offset | mixed | |
$value | mixed |
Throws
LogicExceptionCalls 1
- new
LogicExceptionline 128
public function offsetUnset(mixed $offset): voidRejects removal from the immutable fixture set.
Parameters
$offset | mixed |
Throws
LogicExceptionCalls 1
- new
LogicExceptionline 137
public function getIterator(): TraversableIterates table entries in the order declared by the fixture plan.
Returns
TraversableCalls 1
- method-call FixtureSet::get() line 146
public function count(): intReturns the number of tables represented by this fixture set.
Returns
intCalls 1
- function-call
countline 155
Private surface 3§
Implementation details, listed for orientation only.
private array<string, list<array<string, TValue>>> $rowsprivate array<string, bool> $listsprivate list<string> $orderTest cases 28§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 19
FixtureSetTest::testAnUnknownTableIsNotTreatedAsAListcallsFixtureSetTest::testAnUnknownTableReadsBackAsNothingcallsFixtureSetTest::testAPositionPastTheEndReadsAsNothingcallsFixtureSetTest::testATableHoldingAListReadsBackAsAListcallsFixtureSetTest::testCountsTheTablesNotTheRowscallsFixtureSetTest::testGetIteratorPreservesPlanOrdercallsFixtureSetTest::testGetReadsTheEntryWhicheverShapeItHascallsFixtureSetTest::testIteratesInThePlansOrdercallsFixtureSetTest::testOffsetExistsTracksNamesAndPositionscallsFixtureSetTest::testOffsetGetSupportsListAssignmentcallsFixtureSetTest::testOffsetSetRejectsMutationcallsFixtureSetTest::testOffsetUnsetRejectsRemovalcallsFixtureSetTest::testReadsByPositionInThePlansOrdercallsFixtureSetTest::testReadsByTableNamecallsFixtureSetTest::testRowIsNullWhereNothingWasGeneratedcallsFixtureSetTest::testRowRefusesATableHoldingAListcallsFixtureSetTest::testRowsAlwaysReturnsAListcallsFixtureSetTest::testTablesReportsWhichTablesItHoldscallsFixtureSetTest::testToArrayKeepsEveryTablecalls
Other tests reaching this symbol 9
PostgreSqlEndToEndTestcallsSqliteIntegrationTestcallsRowMaterializerTestcallsGenerationRunTestcallsPlanGeneratorTestcallsFixtureProviderTestcallsConstructorHydrationTestcallsPropertyHydrationTestcallsSqlSchemaProviderTestcalls