classGenerationRun
final class GenerationRun<TValue>
The rows produced while one plan is being walked, and what was learnt about them on the way.
Whether a table reads back as a list is decided by how the walk reached it, not by the relation on its own: the table a plan is about is one row even when something else references it.
Methods§
public function __construct(private array<string, RowSpec> $specs)Parameters
$specs | array<string, RowSpec> |
public function claim(list<string> $tables): voidTake responsibility for a group of tables, so a later pass does not start a second walk into the middle of it.
Parameters
$tables | list<string> |
Test cases 5
GenerationRunTest::testAClaimedTableThatWasNeverReachedIsNotAListcallsGenerationRunTest::testClaimingATableStopsASecondWalkStartingcallsGenerationRunTest::testClaimingDoesNotUndoWhatTheWalkAlreadyLearntcallsGenerationRunTest::testHasVisitedDistinguishesNewAndClaimedTablescallsGenerationRunTest::testReachedReachingATableAsAListStickscalls
Called from 1
public function reached(string $table, bool $asList): voidNote that the walk arrived at a table, and how.
Parameters
$table | string | |
$asList | bool |
Test cases 3
public function hasVisited(string $table): boolReports whether the current generation walk has reached or claimed a table.
Parameters
$table | string |
Returns
boolTest cases 2
Called from 1
public function wasAskedFor(string $table): boolWhether the caller said anything about this table.
Parameters
$table | string |
Returns
boolTest cases 1
public function specFor(string $table): RowSpecReturns the explicit row request or an unspecified request for this table.
Parameters
$table | string |
Returns
Test cases 1
Called from 3
- method-call SqlFixture\Fixture\Generation\RowMaterializer::materialize() packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:47
- method-call SqlFixture\Fixture\Generation\RowMaterializer::toChildren() packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:158
- method-call SqlFixture\Fixture\PlanGenerator::generate() packages/sql-fixture/src/Fixture/PlanGenerator.php:56
Calls 1
- static-call RowSpec::unspecified() line 80
public function record(
TableSchema $schema,
array<string, TValue> $row,
list<string> $referencedColumns = [],
): array<string, TValue|int>Keep a row, standing in for the keys a database would have assigned where a relation needs to read them.
Only the columns something references are filled. A row nothing points at reads back the way fixture() has always returned one, with the auto-increment column absent because the database supplies it.
Parameters
$schema | TableSchema | |
$row | array<string, TValue> | |
$referencedColumns | list<string> | Columns a relation reads off this table |
Returns
array<string, TValue|int>Test cases 9
GenerationRunTest::testAKeyARelationReadsIsStoodInForcallsGenerationRunTest::testAKeyNothingReadsIsLeftToTheDatabasecallsGenerationRunTest::testClaimingDoesNotUndoWhatTheWalkAlreadyLearntcallsGenerationRunTest::testEveryReferencedColumnIsConsideredNotJustTheFirstcallsGenerationRunTest::testLastRowReturnsTheMostRecentRecordedValuescallsGenerationRunTest::testOnlyAutoIncrementColumnsAreStoodInForcallsGenerationRunTest::testRecordKeepsAKeyTheCallerSuppliedcallsGenerationRunTest::testRecordReturnsTheWholeRowcallsGenerationRunTest::testToSetATableReachedOnlyAsASingleRowReadsBackAsOnecalls
Called from 1
Calls 3
- method-call TableSchema::getColumn() line 98
- function-call
array_key_existsline 100 - function-call
countline 104
public function lastRow(string $table): array<string, TValue|int>The row most recently kept for a table, which is the one a relation walked into it will read its key from.
Parameters
$table | string |
Returns
array<string, TValue|int>Test cases 3
Called from 1
Calls 1
- function-call
countline 122
public function toSet(FixturePlan $plan): FixtureSetThe rows gathered, arranged the way the plan reads back.
Parameters
$plan | FixturePlan |
Returns
Test cases 8
RowMaterializerTest::testMaterializeLinksEveryChildToTheGeneratedParentcallsRowMaterializerTest::testMaterializeParentDoesNotWalkBackAlongTheArrivalRelationcallsRowMaterializerTest::testToChildrenCopiesTheExistingParentKeycallsGenerationRunTest::testAClaimedTableThatWasNeverReachedIsNotAListcallsGenerationRunTest::testATableThatGeneratedNothingReadsBackAsNullcallsGenerationRunTest::testClaimingDoesNotUndoWhatTheWalkAlreadyLearntcallsGenerationRunTest::testReachedReachingATableAsAListStickscallsGenerationRunTest::testToSetATableReachedOnlyAsASingleRowReadsBackAsOnecalls
Called from 1
Calls 1
- new FixtureSet line 138
Private surface 3§
Implementation details, listed for orientation only.
private array<string, list<array<string, TValue|int>>> $rows = []private array<string, bool> $visited = []private array<string, RowSpec> $specsTest cases 28§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 16
GenerationRunTest::testAClaimedTableThatWasNeverReachedIsNotAListcallsGenerationRunTest::testAKeyARelationReadsIsStoodInForcallsGenerationRunTest::testAKeyNothingReadsIsLeftToTheDatabasecallsGenerationRunTest::testATableThatGeneratedNothingReadsBackAsNullcallsGenerationRunTest::testClaimingATableStopsASecondWalkStartingcallsGenerationRunTest::testClaimingDoesNotUndoWhatTheWalkAlreadyLearntcallsGenerationRunTest::testEveryReferencedColumnIsConsideredNotJustTheFirstcallsGenerationRunTest::testHasVisitedDistinguishesNewAndClaimedTablescallsGenerationRunTest::testLastRowReturnsTheMostRecentRecordedValuescallsGenerationRunTest::testOnlyAutoIncrementColumnsAreStoodInForcallsGenerationRunTest::testReachedReachingATableAsAListStickscallsGenerationRunTest::testRecordKeepsAKeyTheCallerSuppliedcallsGenerationRunTest::testRecordReturnsTheWholeRowcallsGenerationRunTest::testSpecForFallsBackToUnspecifiedcallsGenerationRunTest::testToSetATableReachedOnlyAsASingleRowReadsBackAsOnecallsGenerationRunTest::testWasAskedForReportsWhatTheCallerMentionedcalls
Other tests reaching this symbol 12
PostgreSqlEndToEndTestcallsSqliteIntegrationTestcallsRowMaterializerTest::testMaterializeLinksEveryChildToTheGeneratedParentcallsRowMaterializerTest::testMaterializeParentDoesNotWalkBackAlongTheArrivalRelationcallsRowMaterializerTest::testMaterializeRowPreservesExplicitKeyscallsRowMaterializerTest::testToChildrenCopiesTheExistingParentKeycallsRowMaterializerTest::testToParentProjectsGeneratedKeyscallsPlanGeneratorTestcallsFixtureProviderTestcallsConstructorHydrationTestcallsPropertyHydrationTestcallsSqlSchemaProviderTestcalls
Relations§
Instantiated in 1
Method calls 10
- method-call SqlFixture\Fixture\Generation\RowMaterializer::materialize() packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:44
- method-call SqlFixture\Fixture\Generation\RowMaterializer::materialize() packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:47
- method-call SqlFixture\Fixture\Generation\RowMaterializer::materializeParent() packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:68
- method-call SqlFixture\Fixture\Generation\RowMaterializer::materializeRow() packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:97
- method-call SqlFixture\Fixture\Generation\RowMaterializer::toParent() packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:133
- method-call SqlFixture\Fixture\Generation\RowMaterializer::toChildren() packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:158
- method-call SqlFixture\Fixture\PlanGenerator::generate() packages/sql-fixture/src/Fixture/PlanGenerator.php:51
- method-call SqlFixture\Fixture\PlanGenerator::generate() packages/sql-fixture/src/Fixture/PlanGenerator.php:55
- method-call SqlFixture\Fixture\PlanGenerator::generate() packages/sql-fixture/src/Fixture/PlanGenerator.php:56
- method-call SqlFixture\Fixture\PlanGenerator::generate() packages/sql-fixture/src/Fixture/PlanGenerator.php:59
Type declarations 5
- type SqlFixture\Fixture\Generation\RowMaterializer packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:42
- type SqlFixture\Fixture\Generation\RowMaterializer packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:64
- type SqlFixture\Fixture\Generation\RowMaterializer packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:82
- type SqlFixture\Fixture\Generation\RowMaterializer packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:127
- type SqlFixture\Fixture\Generation\RowMaterializer packages/sql-fixture/src/Fixture/Generation/RowMaterializer.php:150