A factory class to manage the life cycle of test fixtures
bool
Is the test runner being run with --debug
enabled. When true, fixture SQL will also be logged.
arrayCake\Datasource\FixtureInterface>
Holds the fixture classes that where instantiated indexed by class name
bool
Was this instance already initialized?
array<string, arrayCake\Datasource\FixtureInterface>>
A map of connection names and the fixture currently in it.
arrayCake\Datasource\FixtureInterface>
Holds the fixture classes that where instantiated
array<string, bool>
List of TestCase class name that have been processed
Add aliases for all non test prefixed connections.
Get the unique list of connections that a set of fixtures contains.
Initializes this class with a DataSource object to use as default for all fixtures
Looks for fixture files and instantiates the classes accordingly
Run a function on each connection and collection of fixtures.
Runs the drop and create commands on the fixtures if necessary.
Check whether a fixture has been inserted in a given connection name.
Modify the debug mode.
Drop all fixture tables loaded by this class
Truncates the fixtures tables
_aliasConnections(): void
Add aliases for all non test prefixed connections.
This allows models to use the test connections without a pile of configuration work.
void
_fixtureConnections(array<string> $fixtures): array
Get the unique list of connections that a set of fixtures contains.
array<string>
$fixtures The array of fixtures a list of connections is needed from.
array
_initDb(): void
Initializes this class with a DataSource object to use as default for all fixtures
void
_loadFixtures(Cake\TestSuite\TestCase $test): void
Looks for fixture files and instantiates the classes accordingly
Cake\TestSuite\TestCase
$test The test suite to load fixtures for.
void
UnexpectedValueException
_runOperation(array<string> $fixtures, callable $operation): void
Run a function on each connection and collection of fixtures.
array<string>
$fixtures A list of fixtures to operate on.
callable
$operation The operation to run on each connection + fixture set.
void
_setupTable(Cake\Datasource\FixtureInterface $fixture, Cake\Datasource\ConnectionInterface $db, array<string> $sources, bool $drop = true): void
Runs the drop and create commands on the fixtures if necessary.
Cake\Datasource\FixtureInterface
$fixture the fixture object to create
Cake\Datasource\ConnectionInterface
$db The Connection object instance to use
array<string>
$sources The existing tables in the datasource.
bool
$drop optional whether drop the fixture if it is already created or not
void
fixturize(Cake\TestSuite\TestCase $test): void
Cake\TestSuite\TestCase
$test Test case
void
getInserted(): array<string>
array<string>
isFixtureSetup(string $connection, Cake\Datasource\FixtureInterface $fixture): bool
Check whether a fixture has been inserted in a given connection name.
string
$connection The connection name.
Cake\Datasource\FixtureInterface
$fixture The fixture to check.
bool
load(Cake\TestSuite\TestCase $test): void
Cake\TestSuite\TestCase
$test Test case
void
RuntimeException
loadSingle(string $name, Cake\Datasource\ConnectionInterface|null $connection = null, bool $dropTables = true): void
string
$name Name
Cake\Datasource\ConnectionInterface|null
$connection optional Connection
bool
$dropTables optional Drop all tables prior to loading schema files
void
UnexpectedValueException
loaded(): Cake\Datasource\FixtureInterface[]
Cake\Datasource\FixtureInterface[]
setDebug(bool $debug): void
Modify the debug mode.
bool
$debug Whether fixture debug mode is enabled.
void
shutDown(): void
Drop all fixture tables loaded by this class
void
unload(Cake\TestSuite\TestCase $test): void
Truncates the fixtures tables
Cake\TestSuite\TestCase
$test The test to inspect for fixture unloading.
void
Is the test runner being run with --debug
enabled. When true, fixture SQL will also be logged.
bool
Holds the fixture classes that where instantiated indexed by class name
arrayCake\Datasource\FixtureInterface>
Was this instance already initialized?
bool
A map of connection names and the fixture currently in it.
array<string, arrayCake\Datasource\FixtureInterface>>
Holds the fixture classes that where instantiated
arrayCake\Datasource\FixtureInterface>
List of TestCase class name that have been processed
array<string, bool>
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.TestSuite.Fixture.FixtureManager.html