Adding paintDocumentFooter and paintDocumentHeader to CakeBaseReporter and CakeHtmlReporter.

Refactoring case list and group lists to use reporter methods.
This commit is contained in:
Mark Story 2010-01-06 22:52:04 -05:00
parent c01276a470
commit 4c0d90c502
3 changed files with 40 additions and 2 deletions

View file

@ -136,7 +136,11 @@ class CakeTestSuiteDispatcher {
* @return void * @return void
*/ */
function _testCaseList() { function _testCaseList() {
$Reporter =& $this->getReporter();
$Reporter->paintDocumentHeader();
$Reporter->paintTestMenu();
CakeTestMenu::testCaseList(); CakeTestMenu::testCaseList();
$Reporter->paintDocumentEnd();
} }
/** /**
@ -145,7 +149,11 @@ class CakeTestSuiteDispatcher {
* @return void * @return void
*/ */
function _groupTestList() { function _groupTestList() {
$Reporter =& $this->getReporter();
$Reporter->paintDocumentHeader();
$Reporter->paintTestMenu();
CakeTestMenu::groupTestList(); CakeTestMenu::groupTestList();
$Reporter->paintDocumentEnd();
} }
/** /**

View file

@ -110,5 +110,25 @@ class CakeBaseReporter extends SimpleReporter {
} }
/**
* paints the header of the response from the test suite.
* Used to paint things like head elements in an html page.
*
* @return void
*/
function paintDocumentHeader() {
}
/**
* paints the end of the response from the test suite.
* Used to paint things like </body> in an html page.
*
* @return void
*/
function paintDocumentFooter() {
}
} }
?> ?>

View file

@ -177,8 +177,7 @@ class CakeHtmlReporter extends SimpleReporter {
} }
echo $this->_paintLinks(); echo $this->_paintLinks();
echo '</div>'; echo '</div>';
$baseDir = $this->params['baseDir']; $this->paintDocumentEnd();
include CAKE_TESTS_LIB . 'templates' . DS . 'footer.php';
} }
/** /**
@ -211,6 +210,7 @@ class CakeHtmlReporter extends SimpleReporter {
echo "<p><a href='" . RUN_TEST_LINK . $show . "'>Run more tests</a> | <a href='" . RUN_TEST_LINK . $query . "&show_passes=1'>Show Passes</a> | \n"; echo "<p><a href='" . RUN_TEST_LINK . $show . "'>Run more tests</a> | <a href='" . RUN_TEST_LINK . $query . "&show_passes=1'>Show Passes</a> | \n";
echo " <a href='" . RUN_TEST_LINK . $query . "&amp;code_coverage=true'>Analyze Code Coverage</a></p>\n"; echo " <a href='" . RUN_TEST_LINK . $query . "&amp;code_coverage=true'>Analyze Code Coverage</a></p>\n";
} }
/** /**
* Convert an array of parameters into a query string url * Convert an array of parameters into a query string url
* *
@ -227,6 +227,16 @@ class CakeHtmlReporter extends SimpleReporter {
return $out; return $out;
} }
/**
* paints the end of the document html.
*
* @return void
*/
function paintDocumentEnd() {
$baseDir = $this->params['baseDir'];
include CAKE_TESTS_LIB . 'templates' . DS . 'footer.php';
}
/** /**
* Paints the test failure with a breadcrumbs * Paints the test failure with a breadcrumbs
* trail of the nesting test suites below the * trail of the nesting test suites below the