classPlanGenerator
final class PlanGenerator
Generates the rows a plan describes, keeping related rows consistent.
The walk starts at the table the plan is about and follows relations outwards, once per connected group of tables. Starting anywhere else changes the answer: a plan written order.id < order_detail.order_id, order.customer_id > customer.id has customer as its only dependency-free table, and beginning there would make order a collection hanging off it rather than the one row the plan is about.
Direction decides count. Walking to a child asks how many, walking to a parent asks for the one row being referenced. Both carry the collection-ness of where they came from, so a table reached through a list is a list however many rows it happens to have.
Methods§
public function __construct(
private SchemaResolverInterface $schemas,
private FixtureGenerator $generator,
private Generator $faker,
)Initializes the collaborators and declared state for this object.
Parameters
$schemas | SchemaResolverInterface | |
$generator | FixtureGenerator | |
$faker | Generator |
public function generate(
FixturePlan $plan,
array<string, int|array<mixed>|TableOverrides> $overrides = [],
): FixtureSetParameters
$plan | FixturePlan | |
$overrides | array<string, int|array<mixed>|TableOverrides> | Table name => what to override |
Returns
Throws
GeneratedColumnReferenceException If a relation references a generated columnUnknownPlanColumnException If a relation names a column the table lacksTest cases 31
PlanGeneratorTest::testACompositeRelationCarriesEveryColumncallsPlanGeneratorTest::testACountOfZeroGeneratesNoRowscallsPlanGeneratorTest::testAListGivesOneRowPerEntrycallsPlanGeneratorTest::testAnOptionalChildMayGenerateNoneAtAllcallsPlanGeneratorTest::testAnOptionalOneToOneAskedForNoneIsNullcallsPlanGeneratorTest::testAnOptionalParentIsGeneratedWhenTheCallerAsksForItcallsPlanGeneratorTest::testAnOptionalParentNobodyAskedForIsLeftOutcallsPlanGeneratorTest::testAnUnboundedChildCountCanExceedItsMinimumcallsPlanGeneratorTest::testAnUnknownTableIsReportedcallsPlanGeneratorTest::testAnUnmentionedChildIsStillGeneratedcallsPlanGeneratorTest::testAOneToOneChildIsASingleRowcallsPlanGeneratorTest::testAOneToOneChildIsGeneratedExactlyOncecallsPlanGeneratorTest::testAOneToOneChildIsNeverGeneratedMoreThanOncecallsPlanGeneratorTest::testAParentIsGeneratedAndLinkedTocallsPlanGeneratorTest::testAPlanNamingAColumnTheTableLacksIsRejectedBeforeGeneratingcallsPlanGeneratorTest::testARequiredChildNeverGeneratesNonecallsPlanGeneratorTest::testARequiredParentIsGeneratedWhetherOrNotItWasAskedForcallsPlanGeneratorTest::testARowCarriesBothItsInheritedKeyAndItsOwnParentKeycallsPlanGeneratorTest::testATableReachableOnlyBackwardsAlongARelationIsStillPartOfTheWalkcallsPlanGeneratorTest::testChildRowsCarryTheParentKeycallsPlanGeneratorTest::testEntriesComeBackInTheOrderThePlanNamesThemcallsPlanGeneratorTest::testEveryChildOfAListGetsItsOwnParentcallsPlanGeneratorTest::testEveryOtherRelationOfAParentIsStillFollowedcallsPlanGeneratorTest::testFixingTheLinkingColumnLeavesTheParentAlonecallsPlanGeneratorTest::testGenerateTheTableThePlanIsAboutGetsOneRowcallsPlanGeneratorTest::testKeysAreStoodInForEveryColumnARelationReadscallsPlanGeneratorTest::testOneSetOfValuesAppliesToEveryGeneratedRowcallsPlanGeneratorTest::testOverridesMayBeGivenAsTableOverridescallsPlanGeneratorTest::testTablesThatStandAloneAreGeneratedToocallsPlanGeneratorTest::testTheSubjectHonoursACountItWasGivencallsPlanGeneratorTest::testTheSubjectIsOneRowEvenWhenSomethingReferencesItcalls
Called from 1
Calls 13
- method-call PlanSchemaValidator::validate() line 46
- new PlanSchemaValidator line 46
- new GenerationRun line 48
- method-call OverrideSpecs::specs() line 48
- new OverrideSpecs line 48
- method-call GenerationRun::hasVisited() line 51
- method-call GenerationRun::claim() line 55
- method-call ConnectedTables::connectedTo() line 55
- new ConnectedTables line 55
- method-call RowMaterializer::materialize() line 56
- new RowMaterializer line 56
- method-call GenerationRun::specFor() line 56
- method-call GenerationRun::toSet() line 59
Private surface 3§
Implementation details, listed for orientation only.
private SchemaResolverInterface $schemasprivate FixtureGenerator $generatorprivate Generator $fakerTest cases 35§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 31
PlanGeneratorTest::testACompositeRelationCarriesEveryColumncallsPlanGeneratorTest::testACountOfZeroGeneratesNoRowscallsPlanGeneratorTest::testAListGivesOneRowPerEntrycallsPlanGeneratorTest::testAnOptionalChildMayGenerateNoneAtAllcallsPlanGeneratorTest::testAnOptionalOneToOneAskedForNoneIsNullcallsPlanGeneratorTest::testAnOptionalParentIsGeneratedWhenTheCallerAsksForItcallsPlanGeneratorTest::testAnOptionalParentNobodyAskedForIsLeftOutcallsPlanGeneratorTest::testAnUnboundedChildCountCanExceedItsMinimumcallsPlanGeneratorTest::testAnUnknownTableIsReportedcallsPlanGeneratorTest::testAnUnmentionedChildIsStillGeneratedcallsPlanGeneratorTest::testAOneToOneChildIsASingleRowcallsPlanGeneratorTest::testAOneToOneChildIsGeneratedExactlyOncecallsPlanGeneratorTest::testAOneToOneChildIsNeverGeneratedMoreThanOncecallsPlanGeneratorTest::testAParentIsGeneratedAndLinkedTocallsPlanGeneratorTest::testAPlanNamingAColumnTheTableLacksIsRejectedBeforeGeneratingcallsPlanGeneratorTest::testARequiredChildNeverGeneratesNonecallsPlanGeneratorTest::testARequiredParentIsGeneratedWhetherOrNotItWasAskedForcallsPlanGeneratorTest::testARowCarriesBothItsInheritedKeyAndItsOwnParentKeycallsPlanGeneratorTest::testATableReachableOnlyBackwardsAlongARelationIsStillPartOfTheWalkcallsPlanGeneratorTest::testChildRowsCarryTheParentKeycallsPlanGeneratorTest::testEntriesComeBackInTheOrderThePlanNamesThemcallsPlanGeneratorTest::testEveryChildOfAListGetsItsOwnParentcallsPlanGeneratorTest::testEveryOtherRelationOfAParentIsStillFollowedcallsPlanGeneratorTest::testFixingTheLinkingColumnLeavesTheParentAlonecallsPlanGeneratorTest::testGenerateTheTableThePlanIsAboutGetsOneRowcallsPlanGeneratorTest::testKeysAreStoodInForEveryColumnARelationReadscallsPlanGeneratorTest::testOneSetOfValuesAppliesToEveryGeneratedRowcallsPlanGeneratorTest::testOverridesMayBeGivenAsTableOverridescallsPlanGeneratorTest::testTablesThatStandAloneAreGeneratedToocallsPlanGeneratorTest::testTheSubjectHonoursACountItWasGivencallsPlanGeneratorTest::testTheSubjectIsOneRowEvenWhenSomethingReferencesItcalls
Other tests reaching this symbol 4
PostgreSqlEndToEndTestcallsSqliteIntegrationTestcallsFixtureProviderTestcallsSqlSchemaProviderTestcalls