Adding a params var to the TestManager to hold through the lifecicle of the object

This commit is contained in:
José Lorenzo Rodríguez 2010-07-06 23:19:37 -04:30
parent 5d8e27d97b
commit cdf52a890f

View file

@ -75,6 +75,13 @@ class TestManager {
*/
protected $_fixtureManager = null;
/**
* Params to configure test runner
*
* @var CakeFixtureManager
*/
public $params = array();
/**
* Constructor for the TestManager class
*
@ -82,6 +89,8 @@ class TestManager {
*/
public function __construct($params = array()) {
require_once(CAKE_TESTS_LIB . 'cake_test_case.php');
$this->params = $params;
if (isset($params['app'])) {
$this->appTest = true;
}
@ -130,14 +139,7 @@ class TestManager {
* @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);
}