mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Removing unnecessary TestManager subclasses
This commit is contained in:
parent
88f58dfbe8
commit
f567d9aacc
2 changed files with 1 additions and 196 deletions
|
@ -46,7 +46,7 @@ class CakeTestSuiteDispatcher {
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
var $_managerClass;
|
||||
var $_managerClass = 'TestManager';
|
||||
|
||||
/**
|
||||
* The Instance of the Manager being used.
|
||||
|
@ -162,12 +162,6 @@ class CakeTestSuiteDispatcher {
|
|||
* @static
|
||||
*/
|
||||
function &getManager() {
|
||||
$className = ucwords($this->params['output']) . 'TestManager';
|
||||
if (class_exists($className)) {
|
||||
$this->_managerClass = $className;
|
||||
} else {
|
||||
$this->_managerClass = 'TextTestManager';
|
||||
}
|
||||
if (empty($this->Manager)) {
|
||||
$this->Manager = new $this->_managerClass();
|
||||
}
|
||||
|
|
|
@ -449,193 +449,4 @@ class CliTestManager extends TestManager {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The TextTestManager ensures that the list of available tests is printed as a list of urls in a text-friendly format
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.tests.lib
|
||||
*/
|
||||
class TextTestManager extends TestManager {
|
||||
var $_url;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function TextTestManager() {
|
||||
parent::TestManager();
|
||||
$this->_url = $_SERVER['PHP_SELF'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base url
|
||||
*
|
||||
* @return string The base URL for link building.
|
||||
* @access public
|
||||
*/
|
||||
function getBaseURL() {
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of available group tests in a text-friendly format
|
||||
*
|
||||
* @return string A link list for group tests.
|
||||
* @access public
|
||||
*/
|
||||
function &getGroupTestList() {
|
||||
$manager =& new TextTestManager();
|
||||
$groupTests =& $manager->_getTestGroupList($manager->_getTestsPath('groups'));
|
||||
|
||||
$buffer = "Core Test Groups:\n";
|
||||
$urlExtra = '';
|
||||
if ($manager->appTest) {
|
||||
$buffer = "App Test Groups:\n";
|
||||
$urlExtra = '&app=true';
|
||||
} else if ($manager->pluginTest) {
|
||||
$buffer = Inflector::humanize($manager->pluginTest) . " Test Groups:\n";
|
||||
$urlExtra = '&plugin=' . $manager->pluginTest;
|
||||
}
|
||||
|
||||
$buffer .= "All tests\n" . $_SERVER['SERVER_NAME'] . $manager->getBaseURL() . "?group=all&output=txt{$urlExtra}\n";
|
||||
|
||||
foreach ((array)$groupTests as $groupTest) {
|
||||
$buffer .= $_SERVER['SERVER_NAME'] . $manager->getBaseURL() . "?group=" . $groupTest . "&output=text{$urlExtra}\n";
|
||||
}
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of available test cases in a text-friendly format
|
||||
*
|
||||
* @param string A link list for test cases.
|
||||
* @access public
|
||||
*/
|
||||
function &getTestCaseList() {
|
||||
$manager =& new TextTestManager();
|
||||
$testCases =& $manager->_getTestCaseList($manager->_getTestsPath());
|
||||
|
||||
$buffer = "Core Test Cases:\n";
|
||||
$urlExtra = '';
|
||||
if ($manager->appTest) {
|
||||
$buffer = "App Test Cases:\n";
|
||||
$urlExtra = '&app=true';
|
||||
} else if ($manager->pluginTest) {
|
||||
$buffer = Inflector::humanize($manager->pluginTest) . " Test Cases:\n";
|
||||
$urlExtra = '&plugin=' . $manager->pluginTest;
|
||||
}
|
||||
|
||||
if (1 > count($testCases)) {
|
||||
$buffer .= "EMPTY";
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
foreach ($testCases as $testCaseFile => $testCase) {
|
||||
$buffer .= $_SERVER['SERVER_NAME']. $manager->getBaseURL()."?case=" . $testCase . "&output=text"."\n";
|
||||
}
|
||||
|
||||
$buffer .= "\n";
|
||||
return $buffer;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The HtmlTestManager provides the foundation for the web-based CakePHP testsuite.
|
||||
* It prints the different lists of tests and provides the interface for CodeCoverage, etc.
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.tests.lib
|
||||
*/
|
||||
class HtmlTestManager extends TestManager {
|
||||
var $_url;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function HtmlTestManager() {
|
||||
parent::TestManager();
|
||||
$this->_url = $_SERVER['PHP_SELF'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current base url
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function getBaseURL() {
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the links to the available group tests
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function &getGroupTestList() {
|
||||
$manager =& new HtmlTestManager();
|
||||
$urlExtra = '';
|
||||
$groupTests =& $manager->_getTestGroupList($manager->_getTestsPath('groups'));
|
||||
|
||||
$buffer = "<h3>Core Test Groups:</h3>\n<ul>";
|
||||
$urlExtra = null;
|
||||
if ($manager->appTest) {
|
||||
$buffer = "<h3>App Test Groups:</h3>\n<ul>";
|
||||
$urlExtra = '&app=true';
|
||||
} else if ($manager->pluginTest) {
|
||||
$buffer = "<h3>" . Inflector::humanize($manager->pluginTest) . " Test Groups:</h3>\n<ul>";
|
||||
$urlExtra = '&plugin=' . $manager->pluginTest;
|
||||
}
|
||||
|
||||
$buffer .= "<li><a href='" . $manager->getBaseURL() . "?group=all$urlExtra'>All tests</a></li>\n";
|
||||
|
||||
foreach ($groupTests as $groupTest) {
|
||||
$buffer .= "<li><a href='" . $manager->getBaseURL() . "?group={$groupTest}" . "{$urlExtra}'>" . $groupTest . "</a></li>\n";
|
||||
}
|
||||
$buffer .= "</ul>\n";
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the links to the available test cases
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function &getTestCaseList() {
|
||||
$urlExtra = '';
|
||||
$manager =& new HtmlTestManager();
|
||||
$testCases =& $manager->_getTestCaseList($manager->_getTestsPath());
|
||||
|
||||
$buffer = "<h3>Core Test Cases:</h3>\n<ul>";
|
||||
$urlExtra = null;
|
||||
if ($manager->appTest) {
|
||||
$buffer = "<h3>App Test Cases:</h3>\n<ul>";
|
||||
$urlExtra = '&app=true';
|
||||
} else if ($manager->pluginTest) {
|
||||
$buffer = "<h3>" . Inflector::humanize($manager->pluginTest) . " Test Cases:</h3>\n<ul>";
|
||||
$urlExtra = '&plugin=' . $manager->pluginTest;
|
||||
}
|
||||
|
||||
if (1 > count($testCases)) {
|
||||
$buffer .= "<strong>EMPTY</strong>";
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
foreach ($testCases as $testCaseFile => $testCase) {
|
||||
$title = explode(strpos($testCase, '\\') ? '\\' : '/', str_replace('.test.php', '', $testCase));
|
||||
$title[count($title) - 1] = Inflector::camelize($title[count($title) - 1]);
|
||||
$title = implode(' / ', $title);
|
||||
|
||||
$buffer .= "<li><a href='" . $manager->getBaseURL() . "?case=" . urlencode($testCase) . $urlExtra ."'>" . $title . "</a></li>\n";
|
||||
}
|
||||
$buffer .= "</ul>\n";
|
||||
return $buffer;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in a new issue