Class CakeFixtureManager
A factory class to manage the life cycle of test fixtures
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Located at Cake/TestSuite/Fixture/CakeFixtureManager.php
Method Detail
_initDbsource protected
_initDb( )
Initializes this class with a DataSource object to use as default for all fixtures
_loadFixturessource protected
_loadFixtures( array $fixtures )
Looks for fixture files and instantiates the classes accordingly
Parameters
- array
$fixtures
- the fixture names to load using the notation {type}.{name}
Throws
UnexpectedValueException
when a referenced fixture does not exist.
_parseFixturePathsource protected
_parseFixturePath( string $fixturePath )
Parse the fixture path included in test cases, to get the fixture class name, and the real fixture path including sub-directories
Parameters
- string
$fixturePath
- the fixture path to parse
Returns
array
containing fixture class name and optional additional path
_setupTablesource protected
_setupTable( CakeTestFixture $fixture , DataSource $db null , boolean $drop true )
Runs the drop and create commands on the fixtures if necessary.
Parameters
-
CakeTestFixture
$fixture
- the fixture object to create
-
DataSource
$db
optional null - the datasource instance to use
- boolean
$drop
optional true - whether drop the fixture if it is already created or not
fixturizesource public
fixturize( CakeTestCase $test )
Inspects the test to look for unloaded fixtures and loads them
Parameters
-
CakeTestCase
$test
- the test case to inspect
loadsource public
load( CakeTestCase $test )
Creates the fixtures tables and inserts data on them.
Parameters
-
CakeTestCase
$test
- the test to inspect for fixture loading
loadSinglesource public
loadSingle( string $name , DataSource $db null , boolean $dropTables true )
Creates a single fixture table and loads data into it.
Parameters
- string
$name
- of the fixture
-
DataSource
$db
optional null - DataSource instance or leave null to get DataSource from the fixture
- boolean
$dropTables
optional true - Whether or not tables should be dropped and re-created.
Throws
UnexpectedValueException
if $name is not a previously loaded class
shutDownsource public
shutDown( )
Drop all fixture tables loaded by this class
This will also close the session, as failing to do so will cause fatal errors with database sessions.
unloadsource public
unload( CakeTestCase $test )
Truncates the fixtures tables
Parameters
-
CakeTestCase
$test
- the test to inspect for fixture unloading
Properties summary
© 2005–2016 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.
http://api.cakephp.org/2.7/class-CakeFixtureManager.html