From cdf52a890fb1972b73db178abf325e4a7cef3079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lorenzo=20Rodr=C3=ADguez?= Date: Tue, 6 Jul 2010 23:19:37 -0430 Subject: [PATCH] Adding a params var to the TestManager to hold through the lifecicle of the object --- cake/tests/lib/test_manager.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cake/tests/lib/test_manager.php b/cake/tests/lib/test_manager.php index 527402e31b5..1b1ffdc0fe9 100644 --- a/cake/tests/lib/test_manager.php +++ b/cake/tests/lib/test_manager.php @@ -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 @@ 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); }