Navigation Menu

Skip to content

Commit

Permalink
Remiving fixture handling code from TestCase and removing compat methods
Browse files Browse the repository at this point in the history
Now that we use phpunit directly both in the core and userland, we can
completely remove the fixture handling code out of the TestCase class.
Also removed some methods that were there for compatibility with
SimpleTest
  • Loading branch information
lorenzo committed Mar 20, 2014
1 parent 6ad59a4 commit 8893188
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 61 deletions.
2 changes: 2 additions & 0 deletions src/TestSuite/Fixture/FixtureInjector.php
Expand Up @@ -124,6 +124,7 @@ public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time
* @return void
*/
public function startTest(PHPUnit_Framework_Test $test) {
$this->_fixtureManager->load($test);
}

/**
Expand All @@ -134,6 +135,7 @@ public function startTest(PHPUnit_Framework_Test $test) {
* @return void
*/
public function endTest(PHPUnit_Framework_Test $test, $time) {
$this->_fixtureManager->unload($test);
}

/**
Expand Down
61 changes: 0 additions & 61 deletions src/TestSuite/TestCase.php
Expand Up @@ -69,43 +69,6 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
*/
protected $_pathRestore = array();

/**
* Runs the test case and collects the results in a TestResult object.
* If no TestResult object is passed a new one will be created.
* This method is run for each test method in this class
*
* @param \PHPUnit_Framework_TestResult $result
* @return \PHPUnit_Framework_TestResult
*/
public function run(\PHPUnit_Framework_TestResult $result = null) {
if (!empty($this->fixtureManager)) {
$this->fixtureManager->load($this);
}
$result = parent::run($result);
if (!empty($this->fixtureManager)) {
$this->fixtureManager->unload($this);
}
return $result;
}

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

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

/**
* Overrides SimpleTestCase::skipIf to provide a boolean return value
*
Expand Down Expand Up @@ -164,30 +127,6 @@ public static function date($format = 'Y-m-d H:i:s') {
return TestSuiteDispatcher::date($format);
}

// @codingStandardsIgnoreStart PHPUnit overrides don't match CakePHP

/**
* Announces the start of a test.
*
* @return void
*/
protected function assertPreConditions() {
parent::assertPreConditions();
$this->startTest($this->getName());
}

/**
* Announces the end of a test.
*
* @return void
*/
protected function assertPostConditions() {
parent::assertPostConditions();
$this->endTest($this->getName());
}

// @codingStandardsIgnoreEnd

/**
* Chooses which fixtures to load for a given test
*
Expand Down

0 comments on commit 8893188

Please sign in to comment.