Skip to content

Commit

Permalink
Fix issue when test suites have no tests.
Browse files Browse the repository at this point in the history
In this situation a fatal error would be raised as the type hint for
FixtureManager would be violated as PHPUnit passes a warning object to
test listeners.
  • Loading branch information
markstory committed Apr 4, 2014
1 parent 51bf876 commit 529eb4e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/TestSuite/Fixture/FixtureInjector.php
Expand Up @@ -130,8 +130,10 @@ public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time
*/
public function startTest(PHPUnit_Framework_Test $test) {
$test->fixtureManager = $this->_fixtureManager;
$this->_fixtureManager->fixturize($test);
$this->_fixtureManager->load($test);
if ($test instanceof TestCase) {
$this->_fixtureManager->fixturize($test);
$this->_fixtureManager->load($test);
}
}

/**
Expand All @@ -142,7 +144,9 @@ public function startTest(PHPUnit_Framework_Test $test) {
* @return void
*/
public function endTest(PHPUnit_Framework_Test $test, $time) {
$this->_fixtureManager->unload($test);
if ($test instanceof TestCase) {
$this->_fixtureManager->unload($test);
}
}

/**
Expand Down

0 comments on commit 529eb4e

Please sign in to comment.