Skip to content

Commit

Permalink
Only running the fixturemanager shutdow on the wrapper testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 28, 2014
1 parent e6f81d3 commit 456f0f2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/TestSuite/Fixture/FixtureInjector.php
Expand Up @@ -35,13 +35,21 @@ class FixtureInjector implements PHPUnit_Framework_TestListener {
*/
protected $_fixtureManager;

/**
* Holds a reference to the conainer test suite
*
* @var \PHPUnit_Framework_TestSuite
*/
protected $_first;

/**
* Constructor. Save internally the reference to the passed fixture manager
*
* @param \Cake\TestSuite\Fixture\FixtureManager $manager
*/
public function __construct(FixtureManager $manager) {
$this->_fixtureManager = $manager;
$this->_fixtureManager->shutdown();
}

/**
Expand All @@ -52,6 +60,9 @@ public function __construct(FixtureManager $manager) {
* @return void
*/
public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
if (empty($this->_first)) {
$this->_first = $suite;
}
}

/**
Expand All @@ -62,6 +73,9 @@ public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
* @return void
*/
public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {
if ($this->_first === $suite) {
$this->_fixtureManager->shutdown();
}
}

/**
Expand Down

0 comments on commit 456f0f2

Please sign in to comment.