mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Moving a require.
Adding some doc blocks, and making the loader not double append test case suffixes.
This commit is contained in:
parent
08fba9b280
commit
f84046c802
2 changed files with 27 additions and 6 deletions
|
@ -2,6 +2,13 @@
|
|||
|
||||
class CakeTestLoader implements PHPUnit_Runner_TestSuiteLoader {
|
||||
|
||||
/**
|
||||
* Load a file and find the first test case / suite in that file.
|
||||
*
|
||||
* @param string $filePath
|
||||
* @param string $params
|
||||
* @return ReflectionClass
|
||||
*/
|
||||
public function load($filePath, $params = '') {
|
||||
$file = $this->_resolveTestFile($filePath, $params);
|
||||
|
||||
|
@ -51,6 +58,12 @@ class CakeTestLoader implements PHPUnit_Runner_TestSuiteLoader {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload method.
|
||||
*
|
||||
* @param ReflectionClass $aClass
|
||||
* @return void
|
||||
*/
|
||||
public function reload(ReflectionClass $aClass) {
|
||||
return $aClass;
|
||||
}
|
||||
|
@ -61,10 +74,17 @@ class CakeTestLoader implements PHPUnit_Runner_TestSuiteLoader {
|
|||
* @return void
|
||||
*/
|
||||
protected function _resolveTestFile($filePath, $params) {
|
||||
$basePath = $this->_basePath($params);
|
||||
return $basePath . DS . $filePath . '.test.php';
|
||||
$basePath = $this->_basePath($params) . DS . $filePath;
|
||||
$ending = '.test.php';
|
||||
return (strpos($basePath, $ending) === (strlen($basePath) - strlen($ending))) ? $basePath : $basePath . $ending;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the base path to a set of tests based on the parameters.
|
||||
*
|
||||
* @param array $params
|
||||
* @return string The base path.
|
||||
*/
|
||||
protected function _basePath($params) {
|
||||
$result = null;
|
||||
if (!empty($params['core'])) {
|
||||
|
@ -77,4 +97,5 @@ class CakeTestLoader implements PHPUnit_Runner_TestSuiteLoader {
|
|||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,6 +86,8 @@ class CakeTestSuiteDispatcher {
|
|||
$this->_checkPHPUnit();
|
||||
$this->_parseParams();
|
||||
|
||||
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_suite_command.php';
|
||||
|
||||
if ($this->params['case']) {
|
||||
$value = $this->_runTestCase();
|
||||
} else {
|
||||
|
@ -244,8 +246,6 @@ class CakeTestSuiteDispatcher {
|
|||
* @return void
|
||||
*/
|
||||
function _runTestCase() {
|
||||
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_suite_command.php';
|
||||
|
||||
$commandArgs = array(
|
||||
'case' => $this->params['case'],
|
||||
'core' =>$this->params['core'],
|
||||
|
|
Loading…
Reference in a new issue