diff --git a/cake/tests/lib/cake_fixture_manager.php b/cake/tests/lib/cake_fixture_manager.php index 53852f397..05d21a5fd 100644 --- a/cake/tests/lib/cake_fixture_manager.php +++ b/cake/tests/lib/cake_fixture_manager.php @@ -1,13 +1,60 @@ fixtures) || !empty($this->_processed[get_class($test)])) { $test->db = $this->_db; @@ -25,6 +72,11 @@ class CakeFixtureManager { $this->_processed[get_class($test)] = true; } +/** + * Initializes this class with a DataSource object to use as default for all fixtures + * + * @return void + */ protected function _initDb() { if ($this->_initialized) { return; @@ -57,6 +109,12 @@ class CakeFixtureManager { $this->_initialized = true; } +/** + * Looks for fixture files and instantiates the classes accordingly + * + * @param array $fixtures the fixture names to load using the notation {type}.{name} + * @return void + */ protected function _loadFixtures($fixtures) { foreach ($fixtures as $index => $fixture) { $fixtureFile = null; @@ -108,6 +166,14 @@ class CakeFixtureManager { } } +/** + * Runs the drop and create commands on the fixtures if necessary + * + * @param CakeTestFixture $fixture the fixture object to create + * @param DataSource $db the datasource instance to use + * @param boolean $drop whether drop the fixture if it is already created or not + * @return void + */ protected function _setupTable($fixture, $db = null, $drop = true) { if (!empty($fixture->created)) { return; @@ -132,6 +198,12 @@ class CakeFixtureManager { } } +/** + * Crates the fixtures tables and inserts data on them + * + * @param CakeTestCase $test the test to inspect for fixture loading + * @return void + */ public function load(CakeTestCase $test) { if (empty($test->fixtures)) { return; @@ -150,6 +222,12 @@ class CakeFixtureManager { } } +/** + * Trucantes the fixtures tables + * + * @param CakeTestCase $test the test to inspect for fixture unloading + * @return void + */ public function unload(CakeTestCase $test) { if (empty($test->fixtures)) { return; @@ -168,6 +246,13 @@ class CakeFixtureManager { } } +/** + * Trucantes the fixtures tables + * + * @param CakeTestCase $test the test to inspect for fixture unloading + * @return void + * @throws UnexpectedValueException if $name is not a previously loaded class + */ public function loadSingle($name, $db = null) { $name .= 'Fixture'; if (isset($this->_fixtureMap[$name])) { @@ -182,6 +267,11 @@ class CakeFixtureManager { } } +/** + * Drop all fixture tables loaded by this class + * + * @return void + */ public function shutDown() { foreach ($this->_loaded as $fixture) { if (!empty($fixture->created)) {