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
Location: Cake/TestSuite/Fixture/CakeFixtureManager.php
Properties summary
- 
			$_dbprotectedDefault datasource to use
- 
			$_fixtureMapprotectedarrayHolds the fixture classes that where instantiated indexed by class name
- 
			$_initializedprotectedbooleanWas this class already initialized?
- 
			$_loadedprotectedarrayHolds the fixture classes that where instantiated
Method Summary
- 
			_initDb() protectedInitializes this class with a DataSource object to use as default for all fixtures
- 
			_loadFixtures() protectedLooks for fixture files and instantiates the classes accordingly
- 
			_setupTable() protectedRuns the drop and create commands on the fixtures if necessary.
- 
			fixturize() publicInspects the test to look for unloaded fixtures and loads them
- 
			load() publicCreates the fixtures tables and inserts data on them.
- 
			loadSingle() publicCreates a single fixture table and loads data into it.
- 
			shutDown() publicDrop all fixture tables loaded by this class
- 
			unload() publicTruncates 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}
Throws
when a referenced fixture does not exist.
_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 )
		
Creates the fixtures tables and inserts data on them.
Parameters
- 
						CakeTestCase$test
- the test to inspect for fixture loading
loadSingle() 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
if $name is not a previously loaded class
shutDown() 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.
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()
			