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 RowGeneration $generator,
private Generator $faker,
)Initializes the collaborators and declared state for this object.
Parameters
$schemas | SchemaResolverInterface | |
$generator | RowGeneration | |
$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 50
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::testGenerateAllRelationsInTheSelectedBranchcallsPlanGeneratorTest::testGenerateChildTablesSelectedPerPaymentcallsPlanGeneratorTest::testGenerateCompositeChoiceKeyscallsPlanGeneratorTest::testGenerateConflictingChildKeysAreRejectedcallsPlanGeneratorTest::testGenerateConflictingInverseDiscriminatorIsRejectedcallsPlanGeneratorTest::testGenerateConflictingParentKeysAreRejectedcallsPlanGeneratorTest::testGenerateExplicitReferencesWithoutInventingParentscallsPlanGeneratorTest::testGenerateFallbackAndNullBranchescallsPlanGeneratorTest::testGenerateInverseEquivalentCasesOncePerChildcallsPlanGeneratorTest::testGenerateInversePolymorphicChildrencallsPlanGeneratorTest::testGenerateInverseSubtypeParentcallsPlanGeneratorTest::testGenerateMixedChoiceRowscallsPlanGeneratorTest::testGenerateOptionalParentsWithNullReferencescallsPlanGeneratorTest::testGeneratePartialCompositeOverridesAreCarriedToTheParentcallsPlanGeneratorTest::testGeneratePolymorphicJunctionRowscallsPlanGeneratorTest::testGenerateRepeatedRolesFailWithoutUnboundedRecursioncallsPlanGeneratorTest::testGenerateSeededCaseSelectionIsReproduciblecallsPlanGeneratorTest::testGenerateTheTableThePlanIsAboutGetsOneRowcallsPlanGeneratorTest::testGenerateUnknownDiscriminatorColumnsAreRejectedcallsPlanGeneratorTest::testGenerateUnknownDiscriminatorReportsItsColumncallsPlanGeneratorTest::testKeysAreStoodInForEveryColumnARelationReadscallsPlanGeneratorTest::testOneSetOfValuesAppliesToEveryGeneratedRowcallsPlanGeneratorTest::testOverridesMayBeGivenAsTableOverridescallsPlanGeneratorTest::testTablesThatStandAloneAreGeneratedToocallsPlanGeneratorTest::testTheSubjectHonoursACountItWasGivencallsPlanGeneratorTest::testTheSubjectIsOneRowEvenWhenSomethingReferencesItcalls
Called from 1
Calls 13
- method-call PlanSchemaValidator::validate() line 45
- new PlanSchemaValidator line 45
- new GenerationRun line 47
- method-call OverrideSpecs::specs() line 47
- new OverrideSpecs line 47
- method-call GenerationRun::hasVisited() line 50
- method-call GenerationRun::claim() line 54
- method-call ConnectedTables::connectedTo() line 54
- new ConnectedTables line 54
- method-call RowMaterializer::materialize() line 55
- new RowMaterializer line 55
- method-call GenerationRun::specFor() line 55
- method-call GenerationRun::toSet() line 58
Private surface 3§
Implementation details, listed for orientation only.
private SchemaResolverInterface $schemasprivate RowGeneration $generatorprivate Generator $fakerTest cases 54§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 50
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::testGenerateAllRelationsInTheSelectedBranchcallsPlanGeneratorTest::testGenerateChildTablesSelectedPerPaymentcallsPlanGeneratorTest::testGenerateCompositeChoiceKeyscallsPlanGeneratorTest::testGenerateConflictingChildKeysAreRejectedcallsPlanGeneratorTest::testGenerateConflictingInverseDiscriminatorIsRejectedcallsPlanGeneratorTest::testGenerateConflictingParentKeysAreRejectedcallsPlanGeneratorTest::testGenerateExplicitReferencesWithoutInventingParentscallsPlanGeneratorTest::testGenerateFallbackAndNullBranchescallsPlanGeneratorTest::testGenerateInverseEquivalentCasesOncePerChildcallsPlanGeneratorTest::testGenerateInversePolymorphicChildrencallsPlanGeneratorTest::testGenerateInverseSubtypeParentcallsPlanGeneratorTest::testGenerateMixedChoiceRowscallsPlanGeneratorTest::testGenerateOptionalParentsWithNullReferencescallsPlanGeneratorTest::testGeneratePartialCompositeOverridesAreCarriedToTheParentcallsPlanGeneratorTest::testGeneratePolymorphicJunctionRowscallsPlanGeneratorTest::testGenerateRepeatedRolesFailWithoutUnboundedRecursioncallsPlanGeneratorTest::testGenerateSeededCaseSelectionIsReproduciblecallsPlanGeneratorTest::testGenerateTheTableThePlanIsAboutGetsOneRowcallsPlanGeneratorTest::testGenerateUnknownDiscriminatorColumnsAreRejectedcallsPlanGeneratorTest::testGenerateUnknownDiscriminatorReportsItsColumncallsPlanGeneratorTest::testKeysAreStoodInForEveryColumnARelationReadscallsPlanGeneratorTest::testOneSetOfValuesAppliesToEveryGeneratedRowcallsPlanGeneratorTest::testOverridesMayBeGivenAsTableOverridescallsPlanGeneratorTest::testTablesThatStandAloneAreGeneratedToocallsPlanGeneratorTest::testTheSubjectHonoursACountItWasGivencallsPlanGeneratorTest::testTheSubjectIsOneRowEvenWhenSomethingReferencesItcalls
Other tests reaching this symbol 4
PostgreSqlEndToEndTestcallsSqliteIntegrationTestcallsFixtureProviderTestcallsSqlSchemaProviderTestcalls