cakephp2-php8/cake/tests/lib/cake_reporter.php
phpnut d4a4105616 Adding test suite to the core.
Creating directories for application level testing

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4433 3807eeeb-6ff5-0310-8944-8be069107fe0
2007-02-04 01:05:51 +00:00

90 lines
No EOL
3.1 KiB
PHP

<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2007, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.cake.tests.libs
* @since CakePHP(tm) v 1.2.0.4433
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* Short description for class.
*
* @package cake
* @subpackage cake.cake.tests.lib
*/
class CakeHtmlReporter extends HtmlReporter {
/**
* Does nothing yet. The first output will
* be sent on the first test start. For use
* by a web browser.
* @access public
*/
function CakeHtmlReporter($characterSet = 'ISO-8859-1') {
parent::HtmlReporter($characterSet);
}
/**
* Paints the top of the web page setting the
* title to the name of the starting test.
* @param string $test_name Name class of test.
* @access public
*/
function paintHeader($testName) {
$this->sendNoCacheHeaders();
$baseUrl = BASE_URL;
print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
print "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
print "<head>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $this->_character_set . "\" />\n";
print "<title>CakePHP(tm) Test Suite v 1.2.0.0 :: $testName</title>\n";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"$baseUrl/css/cake.generic.css\" />\n";
print "<style type=\"text/css\">\n";
print $this->_getCss() . "\n";
print "</style>\n";
print "</head>\n<body>\n";
print "<div id=\"wrapper\">\n";
print "<div id=\"content\">\n";
print "<h1>CakePHP(tm) Test Suite v 1.2.0.0</h1>\n";
print "<h2>$testName</h2>\n";
flush();
}
/**
* Paints the end of the test with a summary of
* the passes and failures.
* @param string $test_name Name class of test.
* @access public
*
*/
function paintFooter($testName) {
$colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green");
print "<div style=\"";
print "padding: 8px; margin-top: 1em; background-color: $colour; color: white;";
print "\">";
print $this->getTestCaseProgress() . "/" . $this->getTestCaseCount();
print " test cases complete:\n";
print "<strong>" . $this->getPassCount() . "</strong> passes, ";
print "<strong>" . $this->getFailCount() . "</strong> fails and ";
print "<strong>" . $this->getExceptionCount() . "</strong> exceptions.";
print "</div>\n";
}
}
?>