A Test Factory is used to setup the infrastructure for a tests, based on a
specific repository implementation to test.
Properties
Database type (sqlite, mysql, ...).
|
protected static string $db
|
Data source name.
|
protected static string $dsn
|
Root dir for IO operations.
|
protected static string $ioRootDir
|
|
protected mixed $repositoryReference = 'ibexa.api.repository'
|
If the DB schema has already been initialized.
|
protected static bool $schemaInitialized = false
|
Service container.
|
protected static ServiceContainer $serviceContainer
|
Methods
Creates a new setup factory.
|
public static getCacheDir() : string
|
Return values
string
Tags
-
Deprecated
-
Returns a config value for $configKey.
|
public getConfigValue(string $configKey) : mixed
|
Parameters
Name |
Type |
Default value |
Description |
$configKey
|
string
|
-
|
-
|
Tags
-
Throws
-
Exception
if $configKey could not be found.
Get the Database name.
Return values
string
Returns a repository specific ID manager.
|
public getIdManager() : IdManager
|
Return values
IdManager
|
public static getInstallationDir() : string
|
Return values
string
Tags
-
Deprecated
-
Returns a configured repository for testing.
|
public getRepository([bool $initializeFromScratch = true ]) : Repository
|
Parameters
Name |
Type |
Default value |
Description |
$initializeFromScratch
|
bool
|
true
|
if the back end should be initialized
from scratch or re-used
|
Return values
Repository
Returns the service container used for initialization of the repository.
|
public getServiceContainer() : ServiceContainer
|
Return values
ServiceContainer
Insert the database data.
|
public insertData() : void
|
Tags
-
Throws
-
DBALException
|
protected cleanupVarDir(mixed $sourceDir) : mixed
|
Parameters
Name |
Type |
Default value |
Description |
$sourceDir
|
mixed
|
-
|
-
|
CLears internal in memory caches after inserting data circumventing the
API.
|
protected clearInternalCaches() : mixed
|
This is intended to be used from external repository in order to
enable container customization.
|
protected externalBuildContainer(ContainerBuilder $containerBuilder) : mixed
|
Parameters
Name |
Type |
Default value |
Description |
$containerBuilder
|
ContainerBuilder
|
-
|
-
|
|
protected getInitialDataFixture() : Fixture
|
Return values
Fixture
|
protected getInitialVarDir() : string
|
Return values
string
Initializes the database schema.
|
protected initializeSchema() : void
|
Tags
-
Throws
-
ConnectionException