classFileFixtureProvider
class FileFixtureProvider
extends Base
Faker provider that generates fixtures from local DDL files.
Methods§
public function __construct(
Generator $faker,
string $ddlPath,
?TypeMapperInterface $typeMapper = null,
?HydratorInterface $hydrator = null,
string $dialect = PlatformFactory::DRIVER_MYSQL,
)Parameters
$faker | Generator | |
$ddlPath | string | |
$typeMapper | ?TypeMapperInterface | |
$hydrator | ?HydratorInterface | |
$dialect | string | SQL dialect ('mysql' or 'sqlite') |
Calls 7
- class-const PlatformFactory::DRIVER_MYSQL() line 35
- static-call
Base::__construct()line 37 - static-call PlatformFactory::createTypeMapper() line 39
- static-call PlatformFactory::createSchemaParser() line 40
- new FixtureGenerator line 42
- method-call DdlDirectory::loadSchemas() line 43
- new DdlDirectory line 43
public function fixture<T of object>(
string $tableName,
array<string, mixed> $overrides = [],
class-string<T>|null $className = null,
): ($className is null ? array<string, mixed> : T)Generate a fixture from a DDL file.
Parameters
$tableName | string | Table name (e.g., "users") |
$overrides | array<string, mixed> | Override values |
$className | class-string<T>|null | Deserialization target class |
Returns
($className is null ? array<string, mixed> : T)Throws
RuntimeExceptionTest cases 7
FileFixtureProviderTest::testFixtureGeneratesDataForLoadedTablecallsFileFixtureProviderTest::testFixtureWithHydrationcallsFileFixtureProviderTest::testFixtureWithMixedCaseTableNamecallsFileFixtureProviderTest::testFixtureWithOverridescallsFileFixtureProviderTest::testRegisterSchemacallsFileFixtureProviderTest::testRegisterSchemaWithMixedCaseFixturecallsFileFixtureProviderTest::testThrowsExceptionForNonExistentTablecalls
Calls 3
- function-call
strtolowerline 61 - new
RuntimeExceptionline 64 - method-call FixtureGenerator::generate() line 67
public function hasTable(string $tableName): boolCheck if a table schema is loaded.
Parameters
$tableName | string |
Returns
boolTest cases 8
FileFixtureProviderTest::testHandlesCommentOnlySqlFilecallsFileFixtureProviderTest::testHandlesCommentsInSqlFilescallsFileFixtureProviderTest::testHandlesEmptySqlFilecallsFileFixtureProviderTest::testHasTableReturnsFalseForNonExistentcallsFileFixtureProviderTest::testLoadsSchemasFromDirectorycallsFileFixtureProviderTest::testRegisterSchemacallsFileFixtureProviderTest::testSkipsInvalidSqlFilescallsFileFixtureProviderTest::testTableNameIsCaseInsensitivecalls
Calls 1
- function-call
strtolowerline 75
public function getTableNames(): list<string>Get list of available table names.
Returns
list<string>Test cases 1
Calls 1
- function-call
array_keysline 85
public function registerSchema(string $createTableSql): voidManually register a schema.
Parameters
$createTableSql | string |
Test cases 2
Calls 2
- method-call FixtureGenerator::getSchemaParser() line 93
- function-call
strtolowerline 94
public function getFixtureGenerator(): FixtureGeneratorGet the underlying fixture generator.
Returns
Test cases 1
Private surface 2§
Implementation details, listed for orientation only.
private FixtureGenerator $fixtureGeneratorprivate array<string, TableSchema> $schemas = []Test cases 17§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 17
FileFixtureProviderTest::testFixtureGeneratesDataForLoadedTablecallsFileFixtureProviderTest::testFixtureWithHydrationcallsFileFixtureProviderTest::testFixtureWithMixedCaseTableNamecallsFileFixtureProviderTest::testFixtureWithOverridescallsFileFixtureProviderTest::testGetFixtureGeneratorcallsFileFixtureProviderTest::testGetTableNamescallsFileFixtureProviderTest::testHandlesCommentOnlySqlFilecallsFileFixtureProviderTest::testHandlesCommentsInSqlFilescallsFileFixtureProviderTest::testHandlesEmptySqlFilecallsFileFixtureProviderTest::testHasTableReturnsFalseForNonExistentcallsFileFixtureProviderTest::testLoadsSchemasFromDirectorycallsFileFixtureProviderTest::testRegisterSchemacallsFileFixtureProviderTest::testRegisterSchemaWithMixedCaseFixturecallsFileFixtureProviderTest::testSkipsInvalidSqlFilescallsFileFixtureProviderTest::testTableNameIsCaseInsensitivecallsFileFixtureProviderTest::testThrowsExceptionForNonExistentDirectorycallsFileFixtureProviderTest::testThrowsExceptionForNonExistentTablecalls