mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding a params var to the TestManager to hold through the lifecicle of the object
This commit is contained in:
parent
5d8e27d97b
commit
cdf52a890f
1 changed files with 10 additions and 8 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue