Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removing unnecessary TestManager subclasses

  • Loading branch information...
commit f567d9aacc74929107d340050ef22255361ef726 1 parent 88f58df
@markstory markstory authored
View
8 cake/tests/lib/cake_test_suite_dispatcher.php
@@ -46,7 +46,7 @@ class CakeTestSuiteDispatcher {
*
* @var string
*/
- var $_managerClass;
+ var $_managerClass = 'TestManager';
/**
* The Instance of the Manager being used.
@@ -162,12 +162,6 @@ function _groupTestList() {
* @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();
}
View
189 cake/tests/lib/test_manager.php
@@ -449,193 +449,4 @@ function &getTestCaseList() {
}
}
-/**
- * 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;
- }
-}
?>
Please sign in to comment.
Something went wrong with that request. Please try again.