Skip to content

Commit

Permalink
Removing unused methods and documenting fixtures property
Browse files Browse the repository at this point in the history
  • Loading branch information
José Lorenzo Rodríguez Urdaneta authored and José Lorenzo Rodríguez Urdaneta committed Jun 11, 2010
1 parent fb23b98 commit bfb023f
Showing 1 changed file with 8 additions and 49 deletions.
57 changes: 8 additions & 49 deletions cake/tests/lib/cake_test_case.php
Expand Up @@ -32,14 +32,6 @@
*/
class CakeTestCase extends PHPUnit_Framework_TestCase {

/**
* Methods used internally.
*
* @var array
* @access public
*/
public $methods = array('start', 'end', 'startcase', 'endcase', 'starttest', 'endtest');

/**
* By default, all fixtures attached to this class will be truncated and reloaded after each test.
* Set this to false to handle manually
Expand All @@ -58,12 +50,15 @@ class CakeTestCase extends PHPUnit_Framework_TestCase {
public $dropTables = true;

/**
* savedGetData property
* The fixtures to be loaded in this test case. Fixtures are referenced using a dot notation:
* - fixture_name : A fixtures that can be found in the main app folder and is named FixtureNameFixture
* - core.fixture_name : A fixtures that can be found in the cake core folder and is named FixtureNameFixture
* - plugin.plugin_name.fixture_name : A fixtures that can be found in the plugin "plugin_name" folder and is named FixtureNameFixture
*
* @var array
* @access private
* @access public
*/
private $__savedGetData = array();
private $fixtures = array();

/**
* Runs the test case and collects the results in a TestResult object.
Expand All @@ -85,24 +80,6 @@ public function run(PHPUnit_Framework_TestResult $result = NULL) {
return $result;
}

/**
* Called when a test case (group of methods) is about to start (to be overriden when needed.)
*
* @param string $method Test method about to get executed.
* @return void
*/
public function startCase() {
}

/**
* Called when a test case (group of methods) has been executed (to be overriden when needed.)
*
* @param string $method Test method about that was executed.
* @return void
*/
public function endCase() {
}

/**
* Called when a test case method is about to start (to be overriden when needed.)
*
Expand Down Expand Up @@ -143,9 +120,7 @@ public function skipIf($shouldSkip, $message = '') {
*/
protected function assertPreConditions() {
parent::assertPreConditions();
if (!in_array(strtolower($this->getName()), $this->methods)) {
$this->startTest($this->getName());
}
$this->startTest($this->getName());
}

/**
Expand All @@ -156,23 +131,7 @@ protected function assertPreConditions() {
*/
protected function assertPostConditions() {
parent::assertPostConditions();
if (!in_array(strtolower($this->getName()), $this->methods)) {
$this->endTest($this->getName());
}
}

/**
* Gets a list of test names. Normally that will be all internal methods that start with the
* name "test". This method should be overridden if you want a different rule.
*
* @return array List of test names.
*/
public function getTests() {
return array_merge(
array('start', 'startCase'),
array_diff(parent::getTests(), array('testAction')),
array('endCase', 'end')
);
$this->endTest($this->getName());
}

/**
Expand Down

0 comments on commit bfb023f

Please sign in to comment.