From bdc84cd5d0ab34eedaf8699ccf436edeab519495 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sat, 9 Jan 2010 11:20:47 -0500 Subject: [PATCH] Renaming paintDocumentHeader to paintDocumentStart Renaming paintDocumentFooter to paintDocumentEnd Moving features from CakeTestMenu, HtmlTestManager, and TextTestManager into the appropriate Reporters. --- cake/tests/lib/cake_test_suite_dispatcher.php | 4 +- .../tests/lib/reporter/cake_base_reporter.php | 66 +++++++++++++- .../tests/lib/reporter/cake_html_reporter.php | 89 +++++++------------ .../tests/lib/reporter/cake_text_reporter.php | 40 ++++++++- 4 files changed, 132 insertions(+), 67 deletions(-) diff --git a/cake/tests/lib/cake_test_suite_dispatcher.php b/cake/tests/lib/cake_test_suite_dispatcher.php index 26b5068ba..52da314c7 100644 --- a/cake/tests/lib/cake_test_suite_dispatcher.php +++ b/cake/tests/lib/cake_test_suite_dispatcher.php @@ -137,7 +137,7 @@ class CakeTestSuiteDispatcher { */ function _testCaseList() { $Reporter =& $this->getReporter(); - $Reporter->paintDocumentHeader(); + $Reporter->paintDocumentStart(); $Reporter->paintTestMenu(); $Reporter->testCaseList(); $Reporter->paintDocumentEnd(); @@ -150,7 +150,7 @@ class CakeTestSuiteDispatcher { */ function _groupTestList() { $Reporter =& $this->getReporter(); - $Reporter->paintDocumentHeader(); + $Reporter->paintDocumentStart(); $Reporter->paintTestMenu(); $Reporter->groupTestList(); $Reporter->paintDocumentEnd(); diff --git a/cake/tests/lib/reporter/cake_base_reporter.php b/cake/tests/lib/reporter/cake_base_reporter.php index 89a7c5a08..0bedcc9b5 100644 --- a/cake/tests/lib/reporter/cake_base_reporter.php +++ b/cake/tests/lib/reporter/cake_base_reporter.php @@ -50,6 +50,42 @@ class CakeBaseReporter extends SimpleReporter { */ var $_timeDuration = 0; +/** + * Array of request parameters. Usually parsed GET params. + * + * @var array + */ + var $params = array(); + +/** + * Character set for the output of test reporting. + * + * @var string + * @access protected + */ + var $_characterSet; + +/** + * Does nothing yet. The first output will + * be sent on the first test start. + * + * ### Params + * + * - show_passes - Should passes be shown + * - plugin - Plugin test being run? + * - app - App test being run. + * - case - The case being run + * + * @param string $charset The character set to output with. Defaults to UTF-8 + * @param array $params Array of request parameters the reporter should use. See above. + * @access public + */ + function CakeBaseReporter($charset = 'utf-8', $params = array()) { + $this->SimpleReporter(); + $this->_characterSet = $charset; + $this->params = $params; + } + /** * Signals / Paints the beginning of a TestSuite executing. * Starts the timer for the TestSuite execution time. @@ -113,24 +149,46 @@ class CakeBaseReporter extends SimpleReporter { } /** - * paints the header of the response from the test suite. + * Paints the start of the response from the test suite. * Used to paint things like head elements in an html page. * * @return void */ - function paintDocumentHeader() { + function paintDocumentStart() { } /** - * paints the end of the response from the test suite. + * Paints the end of the response from the test suite. * Used to paint things like in an html page. * * @return void */ - function paintDocumentFooter() { + function paintDocumentEnd() { } +/** + * Paint a list of test sets, core, app, and plugin test sets + * available. + * + * @return void + */ + function paintTestMenu() { + + } + +/** + * Get the baseUrl if one is available. + * + * @return string The base url for the request. + */ + function baseUrl() { + if (!empty($_SERVER['PHP_SELF'])) { + return $_SERVER['PHP_SELF']; + } + return ''; + } + } ?> \ No newline at end of file diff --git a/cake/tests/lib/reporter/cake_html_reporter.php b/cake/tests/lib/reporter/cake_html_reporter.php index a1bdd8902..9c9cbbfdf 100644 --- a/cake/tests/lib/reporter/cake_html_reporter.php +++ b/cake/tests/lib/reporter/cake_html_reporter.php @@ -28,51 +28,6 @@ include_once dirname(__FILE__) . DS . 'cake_base_reporter.php'; */ class CakeHtmlReporter extends CakeBaseReporter { -/** - * Character set for the output of test reporting. - * - * @var string - * @access protected - */ - var $_character_set; -/** - * Toggle to show passes in output. - * - * @var boolean - * @access protected - */ - var $_show_passes = false; - -/** - * Array of request parameters. Usually parsed GET params. - * - * @var array - */ - var $params = array(); - -/** - * Does nothing yet. The first output will - * be sent on the first test start. For use - * by a web browser. - * - * ### Params - * - * - show_passes - Should passes be shown - * - plugin - Plugin test being run? - * - app - App test being run. - * - case - The case being run - * - * @param string $character_set The character set to output with. Defaults to ISO-8859-1 - * @param array $params Array of request parameters the reporter should use. See above. - * @access public - */ - function CakeHtmlReporter($character_set = 'ISO-8859-1', $params = array()) { - $this->SimpleReporter(); - $this->_character_set = !empty($character_set) ? $character_set : 'ISO-8859-1'; - $this->params = $params; - $this->_url = $_SERVER['PHP_SELF']; - } - /** * Paints the top of the web page setting the * title to the name of the starting test. @@ -83,18 +38,18 @@ class CakeHtmlReporter extends CakeBaseReporter { */ function paintHeader($testName) { $this->sendNoCacheHeaders(); - $this->paintDocumentHeader(); + $this->paintDocumentStart(); $this->paintTestMenu(); echo "

$testName

\n"; echo "\n"; echo $buffer; @@ -154,7 +107,27 @@ class CakeHtmlReporter extends CakeBaseReporter { * @return void */ function groupTestList() { - CakeTestMenu::groupTestList(); + $groupTests = parent::groupTestList(); + $app = $this->params['app']; + $plugin = $this->params['plugin']; + + $buffer = "

Core Test Groups:

\n