A factory class to manage the life cycle of test fixtures
bool
Is the test runner being run with --debug
enabled.
\Cake\Datasource\FixtureInterface[]
Holds the fixture classes that where instantiated indexed by class name
bool
Was this instance already initialized?
array
A map of connection names and the fixture currently in it.
\Cake\Datasource\FixtureInterface[]
Holds the fixture classes that where instantiated
array
List of TestCase class name that have been processed
Initializes this class with a DataSource object to use as default for all fixtures
Check whether or not a fixture has been inserted in a given connection name.
_aliasConnections()
Add aliases for all non test prefixed connections.
This allows models to use the test connections without a pile of configuration work.
_fixtureConnections(array $fixtures)
Get the unique list of connections that a set of fixtures contains.
string[]
$fixtures The array of fixtures a list of connections is needed from.
array
An array of connection names.
_initDb()
Initializes this class with a DataSource object to use as default for all fixtures
_loadFixtures(\Cake\TestSuite\TestCase $test)
Looks for fixture files and instantiates the classes accordingly
\Cake\TestSuite\TestCase
$test The test suite to load fixtures for.
UnexpectedValueException
_runOperation(array $fixtures, callable $operation)
Run a function on each connection and collection of fixtures.
string[]
$fixtures A list of fixtures to operate on.
callable
$operation The operation to run on each connection + fixture set.
_setupTable(\Cake\Datasource\FixtureInterface $fixture, \Cake\Datasource\ConnectionInterface $db, array $sources, bool $drop)
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
string[]
$sources The existing tables in the datasource.
bool
$drop optional whether drop the fixture if it is already created or not
fixturize(\Cake\TestSuite\TestCase $test)
Inspects the test to look for unloaded fixtures and loads them
\Cake\TestSuite\TestCase
$test The test case to inspect.
isFixtureSetup(string $connection, \Cake\Datasource\FixtureInterface $fixture)
Check whether or not 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)
Creates the fixtures tables and inserts data on them.
\Cake\TestSuite\TestCase
$test The test to inspect for fixture loading.
Cake\Core\Exception\Exception
RuntimeException
loadSingle(string $name, ?\Cake\Datasource\ConnectionInterface $db, bool $dropTables)
Creates a single fixture table and loads data into it.
string
$name of the fixture
\Cake\Datasource\ConnectionInterface|null
$db optional Connection instance or null to get a Connection from the fixture.
bool
$dropTables optional Whether or not tables should be dropped and re-created.
UnexpectedValueException
loaded()
Get the loaded fixtures.
\Cake\Datasource\FixtureInterface[]
setDebug(bool $debug)
Modify the debug mode.
bool
$debug Whether or not fixture debug mode is enabled.
shutDown()
Drop all fixture tables loaded by this class
unload(\Cake\TestSuite\TestCase $test)
Truncates the fixtures tables
\Cake\TestSuite\TestCase
$test The test to inspect for fixture unloading.
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
\Cake\Datasource\FixtureInterface[]
Was this instance already initialized?
bool
A map of connection names and the fixture currently in it.
array
Holds the fixture classes that where instantiated
\Cake\Datasource\FixtureInterface[]
List of TestCase class name that have been processed
array
© 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.1/class-Cake.TestSuite.Fixture.FixtureManager.html