Class CakeFixtureManager
A factory class to manage the life cycle of test fixtures
Copyright: Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/TestSuite/Fixture/CakeFixtureManager.php
Properties summary
-
$_db
protectedDefault datasource to use -
$_fixtureMap
protectedarray
Holds the fixture classes that where instantiated indexed by class name -
$_initialized
protectedboolean
Was this class already initialized? -
$_loaded
protectedarray
Holds the fixture classes that where instantiated
Method Summary
-
_initDb() protected
Initializes this class with a DataSource object to use as default for all fixtures -
_loadFixtures() protected
Looks for fixture files and instantiates the classes accordingly -
_setupTable() protected
Runs the drop and create commands on the fixtures if necessary. -
fixturize() public
Inspects the test to look for unloaded fixtures and loads them -
load() public
Crates the fixtures tables and inserts data on them -
loadSingle() public
Truncates the fixtures tables -
shutDown() public
Drop all fixture tables loaded by this class -
unload() public
Truncates the fixtures tables
Method Detail
_initDb() protected ¶
_initDb( )
Initializes this class with a DataSource object to use as default for all fixtures
_loadFixtures() 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}
_setupTable() 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
fixturize() public ¶
fixturize( CakeTestCase
$test )
Inspects the test to look for unloaded fixtures and loads them
Parameters
-
CakeTestCase
$test - the test case to inspect
load() public ¶
load( CakeTestCase
$test )
Crates the fixtures tables and inserts data on them
Parameters
-
CakeTestCase
$test - the test to inspect for fixture loading
loadSingle() public ¶
loadSingle( CakeTestCase
$name , $db = null )
Truncates the fixtures tables
Parameters
-
CakeTestCase
$name - $test the test to inspect for fixture unloading
- $db optional null
Throws
if $name is not a previously loaded class
unload() public ¶
unload( CakeTestCase
$test )
Truncates the fixtures tables
Parameters
-
CakeTestCase
$test - the test to inspect for fixture unloading
Properties detail
$_fixtureMap ¶
Holds the fixture classes that where instantiated indexed by class name
array()