mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-12 20:49:50 +00:00
Merge branch '1.3' of github.com:cakephp/cakephp1x into 1.3
This commit is contained in:
commit
827c65a767
2 changed files with 41 additions and 40 deletions
|
@ -224,12 +224,12 @@ class CakeTestSuiteDispatcher {
|
|||
*/
|
||||
function _runGroupTest() {
|
||||
$Reporter =& CakeTestSuiteDispatcher::getReporter();
|
||||
if ($this->params['codeCoverage']) {
|
||||
CodeCoverageManager::init($this->params['group'], $Reporter);
|
||||
}
|
||||
if ('all' == $this->params['group']) {
|
||||
$this->Manager->runAllTests($Reporter);
|
||||
} else {
|
||||
if ($this->params['codeCoverage']) {
|
||||
CodeCoverageManager::init($this->params['group'], $Reporter);
|
||||
}
|
||||
$this->Manager->runGroupTest(ucfirst($this->params['group']), $Reporter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ class CodeCoverageManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Stops/pauses code coverage collection. Does not clean the
|
||||
* Stops/pauses code coverage collection. Does not clean the
|
||||
* code coverage memory. Use clean() to clear code coverage memory
|
||||
*
|
||||
* @return void
|
||||
|
@ -159,7 +159,7 @@ class CodeCoverageManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Stops the current code coverage analyzation and dumps a nice report
|
||||
* Stops the current code coverage analyzation and dumps a nice report
|
||||
* depending on the reporter that was passed to start()
|
||||
*
|
||||
* @return void
|
||||
|
@ -530,49 +530,50 @@ class CodeCoverageManager {
|
|||
$manager = CodeCoverageManager::getInstance();
|
||||
$testManager =& new TestManager();
|
||||
|
||||
$path = TESTS . 'groups';
|
||||
|
||||
$path = TESTS;
|
||||
if (!$isApp) {
|
||||
$path = ROOT . DS . 'cake' . DS . 'tests' . DS . 'groups';
|
||||
$path = ROOT . DS . 'cake' . DS . 'tests';
|
||||
}
|
||||
|
||||
if (!!$manager->pluginTest) {
|
||||
$path = APP . 'plugins' . DS . $manager->pluginTest . DS . 'tests' . DS . 'groups';
|
||||
|
||||
$pluginPaths = App::path('plugins');
|
||||
foreach ($pluginPaths as $pluginPath) {
|
||||
$tmpPath = $pluginPath . $manager->pluginTest . DS . 'tests' . DS. 'groups';
|
||||
if (file_exists($tmpPath)) {
|
||||
$path = $tmpPath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$path .= DS . $groupFile . $testManager->_groupExtension;
|
||||
|
||||
if (!file_exists($path)) {
|
||||
trigger_error(__('This group file does not exist!', true));
|
||||
return array();
|
||||
$path = App::pluginPath($manager->pluginTest) . DS . 'tests';
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$groupContent = file_get_contents($path);
|
||||
$ds = '\s*\.\s*DS\s*\.\s*';
|
||||
$pluginTest = 'APP\.\'plugins\'' . $ds . '\'' . $manager->pluginTest . '\'' . $ds . '\'tests\'' . $ds . '\'cases\'';
|
||||
$pattern = '/\s*TestManager::addTestFile\(\s*\$this,\s*(' . $pluginTest . '|APP_TEST_CASES|CORE_TEST_CASES)' . $ds . '(.*?)\)/i';
|
||||
preg_match_all($pattern, $groupContent, $matches);
|
||||
if ($groupFile == 'all') {
|
||||
$files = array_keys($testManager->getTestCaseList());
|
||||
foreach ($files as $file) {
|
||||
$file = str_replace(DS . 'tests' . DS . 'cases' . DS, DS, $file);
|
||||
$file = str_replace('.test.php', '.php', $file);
|
||||
$file = str_replace(DS . DS, DS, $file);
|
||||
$result[] = $file;
|
||||
}
|
||||
} else {
|
||||
$path .= DS . 'groups' . DS . $groupFile . $testManager->_groupExtension;
|
||||
if (!file_exists($path)) {
|
||||
trigger_error(__('This group file does not exist!', true));
|
||||
return array();
|
||||
}
|
||||
|
||||
foreach ($matches[2] as $file) {
|
||||
$patterns = array(
|
||||
'/\s*\.\s*DS\s*\.\s*/',
|
||||
'/\s*APP_TEST_CASES\s*/',
|
||||
'/\s*CORE_TEST_CASES\s*/',
|
||||
);
|
||||
$result = array();
|
||||
$groupContent = file_get_contents($path);
|
||||
$ds = '\s*\.\s*DS\s*\.\s*';
|
||||
$pluginTest = 'APP\.\'plugins\'' . $ds . '\'' . $manager->pluginTest . '\'' . $ds . '\'tests\'' . $ds . '\'cases\'';
|
||||
$pluginTest .= '|App::pluginPath\(\'' . $manager->pluginTest . '\'\)' . $ds . '\'tests\'' . $ds . '\'cases\'';
|
||||
$pattern = '/\s*TestManager::addTestFile\(\s*\$this,\s*(' . $pluginTest . '|APP_TEST_CASES|CORE_TEST_CASES)' . $ds . '(.*?)\)/i';
|
||||
preg_match_all($pattern, $groupContent, $matches);
|
||||
|
||||
$replacements = array(DS, '', '');
|
||||
$file = preg_replace($patterns, $replacements, $file);
|
||||
$file = str_replace("'", '', $file);
|
||||
$result[] = $manager->__testObjectFileFromCaseFile($file, $isApp) . '.php';
|
||||
foreach ($matches[2] as $file) {
|
||||
$patterns = array(
|
||||
'/\s*\.\s*DS\s*\.\s*/',
|
||||
'/\s*APP_TEST_CASES\s*/',
|
||||
'/\s*CORE_TEST_CASES\s*/',
|
||||
);
|
||||
|
||||
$replacements = array(DS, '', '');
|
||||
$file = preg_replace($patterns, $replacements, $file);
|
||||
$file = str_replace("'", '', $file);
|
||||
$result[] = $manager->__testObjectFileFromCaseFile($file, $isApp) . '.php';
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue