mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Doing some tweaks to CakeTestSuiteDispatcher to make CLI testing easier.
This commit is contained in:
parent
3ebbaf106c
commit
0baab93929
1 changed files with 34 additions and 13 deletions
|
@ -68,6 +68,13 @@ class CakeTestSuiteDispatcher {
|
||||||
*/
|
*/
|
||||||
protected $_baseDir;
|
protected $_baseDir;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* boolean to set auto parsing of params.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $_paramsParsed = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reporter instance used for the request
|
* reporter instance used for the request
|
||||||
*
|
*
|
||||||
|
@ -96,13 +103,14 @@ class CakeTestSuiteDispatcher {
|
||||||
$this->_parseParams();
|
$this->_parseParams();
|
||||||
|
|
||||||
if ($this->params['case']) {
|
if ($this->params['case']) {
|
||||||
$this->_runTestCase();
|
$value = $this->_runTestCase();
|
||||||
} else {
|
} else {
|
||||||
$this->_testCaseList();
|
$value = $this->_testCaseList();
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = ob_get_clean();
|
$output = ob_get_clean();
|
||||||
echo $output;
|
echo $output;
|
||||||
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -202,23 +210,36 @@ class CakeTestSuiteDispatcher {
|
||||||
return self::$_Reporter;
|
return self::$_Reporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the params, calling this will bypass the auto parameter parsing.
|
||||||
|
*
|
||||||
|
* @param array $params Array of parameters for the dispatcher
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setParams($params) {
|
||||||
|
$this->params = $params;
|
||||||
|
$this->_paramsParsed = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse url params into a 'request'
|
* Parse url params into a 'request'
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function _parseParams() {
|
function _parseParams() {
|
||||||
if (!isset($_SERVER['SERVER_NAME'])) {
|
if (!$this->_paramsParsed) {
|
||||||
$_SERVER['SERVER_NAME'] = '';
|
if (!isset($_SERVER['SERVER_NAME'])) {
|
||||||
}
|
$_SERVER['SERVER_NAME'] = '';
|
||||||
foreach ($this->params as $key => $value) {
|
}
|
||||||
if (isset($_GET[$key])) {
|
foreach ($this->params as $key => $value) {
|
||||||
$this->params[$key] = $_GET[$key];
|
if (isset($_GET[$key])) {
|
||||||
|
$this->params[$key] = $_GET[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($_GET['code_coverage'])) {
|
||||||
|
$this->params['codeCoverage'] = true;
|
||||||
|
$this->_checkXdebug();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (isset($_GET['code_coverage'])) {
|
|
||||||
$this->params['codeCoverage'] = true;
|
|
||||||
$this->_checkXdebug();
|
|
||||||
}
|
}
|
||||||
$this->params['baseUrl'] = $this->_baseUrl;
|
$this->params['baseUrl'] = $this->_baseUrl;
|
||||||
$this->params['baseDir'] = $this->_baseDir;
|
$this->params['baseDir'] = $this->_baseDir;
|
||||||
|
@ -232,6 +253,6 @@ class CakeTestSuiteDispatcher {
|
||||||
*/
|
*/
|
||||||
function _runTestCase() {
|
function _runTestCase() {
|
||||||
$Reporter = CakeTestSuiteDispatcher::getReporter();
|
$Reporter = CakeTestSuiteDispatcher::getReporter();
|
||||||
$this->Manager->runTestCase($this->params['case'], $Reporter, $this->params['codeCoverage']);
|
return $this->Manager->runTestCase($this->params['case'], $Reporter, $this->params['codeCoverage']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue