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\DatabaseFixtureProvider::fixture() packages/sql-fixture/src/DatabaseFixtureProvider.php:73
- method-call SqlFixture\FileFixtureProvider::fixture() packages/sql-fixture/src/FileFixtureProvider.php:67
- method-call SqlFixture\FixtureProvider::fixture() packages/sql-fixture/src/FixtureProvider.php:79
Calls 5
- method-call OverrideValidator::assertOverridesFitSchema() line 53
- new OverrideValidator line 53
- function-call
array_key_existsline 60 - method-call TypeMapperInterface::generate() line 69
- method-call HydratorInterface::hydrate() line 76
public function getSchemaParser(): SchemaParserInterfaceGet the schema parser instance.
Returns
Test cases 2
Called from 1
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 57§
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 46
CreateTableTarget::__invokecallsPostgreSqlEndToEndTestcallsSqliteIntegrationTestcallsDatabaseFixtureProviderTestcallsFileFixtureProviderTestcallsRowMaterializerTest::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::testGenerateTheTableThePlanIsAboutGetsOneRowcallsPlanGeneratorTest::testKeysAreStoodInForEveryColumnARelationReadscallsPlanGeneratorTest::testOneSetOfValuesAppliesToEveryGeneratedRowcallsPlanGeneratorTest::testOverridesMayBeGivenAsTableOverridescallsPlanGeneratorTest::testTablesThatStandAloneAreGeneratedToocallsPlanGeneratorTest::testTheSubjectHonoursACountItWasGivencallsPlanGeneratorTest::testTheSubjectIsOneRowEvenWhenSomethingReferencesItcallsRowGenerationTest::testGenerateAppliesExplicitValuesAndOmitsGeneratedColumnscallsFixtureProviderTestcallsConstructorHydrationTestcallsPropertyHydrationTestcallsSqlSchemaProviderTestcalls
Relations§
Instantiated in 3
- new SqlFixture\DatabaseFixtureProvider::__construct() packages/sql-fixture/src/DatabaseFixtureProvider.php:55
- new SqlFixture\FileFixtureProvider::__construct() packages/sql-fixture/src/FileFixtureProvider.php:42
- new SqlFixture\FixtureProvider::__construct() packages/sql-fixture/src/FixtureProvider.php:59
Method calls 4
- method-call SqlFixture\DatabaseFixtureProvider::fixture() packages/sql-fixture/src/DatabaseFixtureProvider.php:73
- method-call SqlFixture\FileFixtureProvider::fixture() packages/sql-fixture/src/FileFixtureProvider.php:67
- method-call SqlFixture\FileFixtureProvider::registerSchema() packages/sql-fixture/src/FileFixtureProvider.php:93
- method-call SqlFixture\FixtureProvider::fixture() packages/sql-fixture/src/FixtureProvider.php:79
Type declarations 8
- type SqlFixture\DatabaseFixtureProvider packages/sql-fixture/src/DatabaseFixtureProvider.php:30
- type SqlFixture\DatabaseFixtureProvider packages/sql-fixture/src/DatabaseFixtureProvider.php:87
- type SqlFixture\FileFixtureProvider packages/sql-fixture/src/FileFixtureProvider.php:20
- type SqlFixture\FileFixtureProvider packages/sql-fixture/src/FileFixtureProvider.php:100
- type SqlFixture\Fixture\PlanGenerator packages/sql-fixture/src/Fixture/PlanGenerator.php:34
- type SqlFixture\FixtureProvider packages/sql-fixture/src/FixtureProvider.php:36
- type SqlFixture\FixtureProvider packages/sql-fixture/src/FixtureProvider.php:117
- type SqlFixture\Provider\SqlSchemaProvider packages/sql-fixture/src/Provider/SqlSchemaProvider.php:48