Skip to content

Commit

Permalink
Adding a params var to the TestManager to hold through the lifecicle …
Browse files Browse the repository at this point in the history
…of the object
  • Loading branch information
lorenzo committed Jul 7, 2010
1 parent 5d8e27d commit cdf52a8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions cake/tests/lib/test_manager.php
Expand Up @@ -75,13 +75,22 @@ class TestManager {
*/
protected $_fixtureManager = null;

/**
* Params to configure test runner
*
* @var CakeFixtureManager
*/
public $params = array();

/**
* Constructor for the TestManager class
*
* @return void
*/
public function __construct($params = array()) {
require_once(CAKE_TESTS_LIB . 'cake_test_case.php');

$this->params = $params;
if (isset($params['app'])) {
$this->appTest = true;
}
Expand Down Expand Up @@ -130,14 +139,7 @@ public function runAllTests(&$reporter) {
* @return mixed Result of test case being run.
*/
public function runTestCase($testCaseFile, PHPUnit_Framework_TestListener $reporter, $codeCoverage = false) {
$testCaseFileWithPath = $this->_getTestsPath($reporter->params) . DS . $testCaseFile;

if (!file_exists($testCaseFileWithPath) || strpos($testCaseFileWithPath, '..')) {
throw new InvalidArgumentException(sprintf(__('Unable to load test file %s'), htmlentities($testCaseFile)));
}

$testSuite = $this->getTestSuite(sprintf(__('Individual test case: %s', true), $testCaseFile));
$testSuite->addTestFile($testCaseFileWithPath);
$this->loadCase($testCaseFile);
return $this->run($reporter, $codeCoverage);
}

Expand Down

0 comments on commit cdf52a8

Please sign in to comment.