classFixtureGenerator
final class FixtureGenerator
implements RowGeneration
Generates row data and optionally hydrates it into a consumer object.
Methods§
public function __construct(
private Generator $faker,
?TypeMapperInterface $typeMapper = null,
?HydratorInterface $hydrator = null,
?SchemaParserInterface $schemaParser = null,
)Initializes the collaborators and declared state for this object.
Parameters
$faker | Generator | |
$typeMapper | ?TypeMapperInterface | |
$hydrator | ?HydratorInterface | |
$schemaParser | ?SchemaParserInterface |
Calls 3
public function generate<T of object>(
TableSchema $schema,
array<mixed> $overrides = [],
class-string<T>|null $className = null,
): ($className is null ? array<string, mixed> : T)Generate fixture data from a parsed schema.
Parameters
$schema | TableSchema | Parsed table schema |
$overrides | array<mixed> | Override values |
$className | class-string<T>|null | Deserialization target class |
Returns
($className is null ? array<string, mixed> : T)Test cases 9
CreateTableTarget::__invokecallsRowGenerationTest::testGenerateAppliesExplicitValuesAndOmitsGeneratedColumnscallsFixtureGeneratorTest::testAnOverrideForAnAutoIncrementColumnIsStillAllowedcallsFixtureGeneratorTest::testGenerateSkipsAutoIncrementcallsFixtureGeneratorTest::testGenerateSkipsGeneratedColumnscallsFixtureGeneratorTest::testGenerateWithHydrationcallsFixtureGeneratorTest::testGenerateWithOverridescallsFixtureGeneratorTest::testGenerateWithSchemacallsFixtureGeneratorTest::testNullIsAcceptedForANullableColumncalls
Called from 3
- method-call SqlFixture\Provider\DatabaseFixtureProvider::fixture() packages/sql-fixture/src/Provider/DatabaseFixtureProvider.php:88
- method-call SqlFixture\Provider\FileFixtureProvider::fixture() packages/sql-fixture/src/Provider/FileFixtureProvider.php:81
- method-call SqlFixture\Provider\FixtureProvider::fixture() packages/sql-fixture/src/Provider/FixtureProvider.php:97
Calls 2
- method-call RowGenerator::generate() line 54
- new RowGenerator line 54
public function getSchemaParser(): SchemaParserInterfaceGet the schema parser instance.
Returns
Test cases 2
public function getTypeMapper(): TypeMapperInterfaceGet the type mapper instance.
Returns
Test cases 2
public function getHydrator(): HydratorInterfaceGet the hydrator instance.
Returns
Test cases 2
Private surface 4§
Implementation details, listed for orientation only.
private TypeMapperInterface $typeMapperprivate HydratorInterface $hydratorprivate SchemaParserInterface $schemaParserprivate Generator $fakerTest cases 77§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 11
FixtureGeneratorTest::testAnOverrideForAnAutoIncrementColumnIsStillAllowedcallsFixtureGeneratorTest::testConfigureWithCustomDependenciescallsFixtureGeneratorTest::testGenerateSkipsAutoIncrementcallsFixtureGeneratorTest::testGenerateSkipsGeneratedColumnscallsFixtureGeneratorTest::testGenerateWithHydrationcallsFixtureGeneratorTest::testGenerateWithOverridescallsFixtureGeneratorTest::testGenerateWithSchemacallsFixtureGeneratorTest::testGetHydratorcallsFixtureGeneratorTest::testGetSchemaParsercallsFixtureGeneratorTest::testGetTypeMappercallsFixtureGeneratorTest::testNullIsAcceptedForANullableColumncalls
Other tests reaching this symbol 66
CreateTableTarget::__invokecallsPostgreSqlEndToEndTestcallsSqliteIntegrationTestcallsRowMaterializerTest::testMaterializeBoundsAnOptionalSelfRelationAfterAnotherTablecallsRowMaterializerTest::testMaterializeLinksEveryChildToTheGeneratedParentcallsRowMaterializerTest::testMaterializeParentDoesNotWalkBackAlongTheArrivalRelationcallsRowMaterializerTest::testMaterializeRowPreservesExplicitKeyscallsRowMaterializerTest::testToChildrenCopiesTheExistingParentKeycallsRowMaterializerTest::testToParentProjectsGeneratedKeyscallsPlanGeneratorTest::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::testTheSubjectIsOneRowEvenWhenSomethingReferencesItcallsRowGenerationTest::testGenerateAppliesExplicitValuesAndOmitsGeneratedColumnscallsConstructorHydrationTestcallsPropertyHydrationTestcallsDatabaseFixtureProviderTestcallsFileFixtureProviderTestcallsFixtureProviderTestcallsSqlSchemaProviderTestcalls
Relations§
Instantiated in 3
- new SqlFixture\Provider\DatabaseFixtureProvider::__construct() packages/sql-fixture/src/Provider/DatabaseFixtureProvider.php:70
- new SqlFixture\Provider\FileFixtureProvider::__construct() packages/sql-fixture/src/Provider/FileFixtureProvider.php:56
- new SqlFixture\Provider\FixtureProvider::__construct() packages/sql-fixture/src/Provider/FixtureProvider.php:75
Method calls 4
- method-call SqlFixture\Provider\DatabaseFixtureProvider::fixture() packages/sql-fixture/src/Provider/DatabaseFixtureProvider.php:88
- method-call SqlFixture\Provider\FileFixtureProvider::fixture() packages/sql-fixture/src/Provider/FileFixtureProvider.php:81
- method-call SqlFixture\Provider\FileFixtureProvider::registerSchema() packages/sql-fixture/src/Provider/FileFixtureProvider.php:107
- method-call SqlFixture\Provider\FixtureProvider::fixture() packages/sql-fixture/src/Provider/FixtureProvider.php:97
Type declarations 7
- type SqlFixture\Provider\DatabaseFixtureProvider packages/sql-fixture/src/Provider/DatabaseFixtureProvider.php:36
- type SqlFixture\Provider\DatabaseFixtureProvider packages/sql-fixture/src/Provider/DatabaseFixtureProvider.php:102
- type SqlFixture\Provider\FileFixtureProvider packages/sql-fixture/src/Provider/FileFixtureProvider.php:25
- type SqlFixture\Provider\FileFixtureProvider packages/sql-fixture/src/Provider/FileFixtureProvider.php:114
- type SqlFixture\Provider\FixtureProvider packages/sql-fixture/src/Provider/FixtureProvider.php:45
- type SqlFixture\Provider\FixtureProvider packages/sql-fixture/src/Provider/FixtureProvider.php:135
- type SqlFixture\Provider\SqlSchemaProvider packages/sql-fixture/src/Provider/SqlSchemaProvider.php:51