mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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
This commit is contained in:
parent
ed2b697999
commit
d4a4105616
8 changed files with 945 additions and 0 deletions
231
app/webroot/test.php
Normal file
231
app/webroot/test.php
Normal file
|
@ -0,0 +1,231 @@
|
||||||
|
<?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
|
||||||
|
*/
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
set_time_limit(600);
|
||||||
|
ini_set('memory_limit','128M');
|
||||||
|
class CakeDummyTestClass{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined('DS')) {
|
||||||
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
|
}
|
||||||
|
if (!defined('ROOT')) {
|
||||||
|
//define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
|
||||||
|
define('ROOT', dirname(dirname(dirname(dirname(__FILE__)))).DS);
|
||||||
|
}
|
||||||
|
if (!defined('APP_DIR')) {
|
||||||
|
//define('APP_DIR', 'DIRECTORY NAME OF APPLICATION';
|
||||||
|
define ('APP_DIR', basename(dirname(dirname(dirname(__FILE__)))).DS);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This only needs to be changed if the cake installed libs are located
|
||||||
|
* outside of the distributed directory structure.
|
||||||
|
*/
|
||||||
|
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||||
|
//define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
|
||||||
|
define('CAKE_CORE_INCLUDE_PATH', ROOT);
|
||||||
|
}
|
||||||
|
if (!defined('WEBROOT_DIR')) {
|
||||||
|
define ('WEBROOT_DIR', basename(dirname(dirname(__FILE__))));
|
||||||
|
}
|
||||||
|
define('WWW_ROOT', dirname(dirname(__FILE__)));
|
||||||
|
|
||||||
|
if (!defined('CORE_PATH')) {
|
||||||
|
if (function_exists('ini_set')) {
|
||||||
|
ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path'));
|
||||||
|
define('APP_PATH', null);
|
||||||
|
define('CORE_PATH', null);
|
||||||
|
} else {
|
||||||
|
define('APP_PATH', ROOT . DS . APP_DIR . DS);
|
||||||
|
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once APP_PATH . 'core.php';
|
||||||
|
if(DEBUG < 1) {
|
||||||
|
die('Invalid url.');
|
||||||
|
}
|
||||||
|
require_once 'cake' . DS . 'bootstrap.php';
|
||||||
|
require_once 'cake' . DS . 'basics.php';
|
||||||
|
require_once 'cake' . DS . 'config' . DS . 'paths.php';
|
||||||
|
require_once 'cake' . DS . 'tests' . DS . 'lib' . DS . 'test_manager.php';
|
||||||
|
vendor('simpletest' . DS . 'reporter');
|
||||||
|
|
||||||
|
if (!isset($_SERVER['SERVER_NAME'])) {
|
||||||
|
$_SERVER['SERVER_NAME'] = '';
|
||||||
|
}
|
||||||
|
if (empty( $_GET['output'])) {
|
||||||
|
$_GET['output'] = 'html';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined('BASE_URL')){
|
||||||
|
$dispatch =& new Dispatcher();
|
||||||
|
define('BASE_URL', $dispatch->baseUrl());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Used to determine output to display
|
||||||
|
*/
|
||||||
|
define('CAKE_TEST_OUTPUT_HTML',1);
|
||||||
|
define('CAKE_TEST_OUTPUT_TEXT',2);
|
||||||
|
|
||||||
|
if(isset($_GET['output']) && $_GET['output'] == 'html') {
|
||||||
|
define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_HTML);
|
||||||
|
} else {
|
||||||
|
define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_TEXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
function &CakeTestsGetReporter() {
|
||||||
|
static $Reporter = NULL;
|
||||||
|
if (!$Reporter) {
|
||||||
|
switch (CAKE_TEST_OUTPUT) {
|
||||||
|
case CAKE_TEST_OUTPUT_HTML:
|
||||||
|
require_once TESTS . 'lib'.DS.'cake_reporter.php';
|
||||||
|
$Reporter = new CakeHtmlReporter();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$Reporter = new TextReporter();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $Reporter;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CakePHPTestRunMore() {
|
||||||
|
switch (CAKE_TEST_OUTPUT) {
|
||||||
|
case CAKE_TEST_OUTPUT_HTML:
|
||||||
|
echo "<p><a href='" . $_SERVER['PHP_SELF'] . "'>Run more tests</a></p>\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function CakePHPTestCaseList() {
|
||||||
|
switch (CAKE_TEST_OUTPUT) {
|
||||||
|
case CAKE_TEST_OUTPUT_HTML:
|
||||||
|
if (isset($_GET['app'])) {
|
||||||
|
echo HtmlTestManager::getTestCaseList(APP_TEST_CASES);
|
||||||
|
} else {
|
||||||
|
echo HtmlTestManager::getTestCaseList(CORE_TEST_CASES);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CAKE_TEST_OUTPUT_TEXT:
|
||||||
|
default:
|
||||||
|
if (isset($_GET['app'])) {
|
||||||
|
echo TextTestManager::getTestCaseList(APP_TEST_CASES);
|
||||||
|
} else {
|
||||||
|
echo TextTestManager::getTestCaseList(CORE_TEST_CASES);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function CakePHPTestGroupTestList() {
|
||||||
|
switch (CAKE_TEST_OUTPUT) {
|
||||||
|
case CAKE_TEST_OUTPUT_HTML:
|
||||||
|
if (isset($_GET['app'])) {
|
||||||
|
echo HtmlTestManager::getGroupTestList(APP_TEST_GROUPS);
|
||||||
|
} else {
|
||||||
|
echo HtmlTestManager::getGroupTestList(CORE_TEST_GROUPS);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CAKE_TEST_OUTPUT_TEXT:
|
||||||
|
default:
|
||||||
|
if (isset($_GET['app'])) {
|
||||||
|
echo TextTestManager::getGroupTestList(APP_TEST_GROUPS);
|
||||||
|
} else {
|
||||||
|
echo TextTestManager::getGroupTestList(CORE_TEST_GROUPS);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function CakePHPTestHeader() {
|
||||||
|
switch (CAKE_TEST_OUTPUT) {
|
||||||
|
case CAKE_TEST_OUTPUT_HTML:
|
||||||
|
$baseUrl = BASE_URL;
|
||||||
|
include 'cake' . DS . 'tests' . DS . 'lib' . DS . 'header.php';
|
||||||
|
break;
|
||||||
|
case CAKE_TEST_OUTPUT_TEXT:
|
||||||
|
default:
|
||||||
|
header(' content-type: text/plain');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function CakePHPTestSuiteHeader() {
|
||||||
|
switch (CAKE_TEST_OUTPUT) {
|
||||||
|
case CAKE_TEST_OUTPUT_HTML:
|
||||||
|
$groups = $_SERVER['PHP_SELF'].'?show=groups';
|
||||||
|
$cases = $_SERVER['PHP_SELF'].'?show=cases';
|
||||||
|
include 'cake' . DS . 'tests' . DS . 'lib' . DS . 'content.php';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function CakePHPTestSuiteFooter() {
|
||||||
|
switch ( CAKE_TEST_OUTPUT) {
|
||||||
|
case CAKE_TEST_OUTPUT_HTML:
|
||||||
|
include 'cake' . DS . 'tests' . DS . 'lib' . DS . 'footer.php';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['group'])) {
|
||||||
|
if ('all' == $_GET['group']) {
|
||||||
|
TestManager::runAllTests(CakeTestsGetReporter());
|
||||||
|
} else {
|
||||||
|
if (isset($_GET['app'])) {
|
||||||
|
TestManager::runGroupTest(ucfirst($_GET['group']), APP_TEST_GROUPS, CakeTestsGetReporter());
|
||||||
|
} else {
|
||||||
|
TestManager::runGroupTest(ucfirst($_GET['group']), CORE_TEST_GROUPS, CakeTestsGetReporter());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CakePHPTestRunMore();
|
||||||
|
CakePHPTestSuiteFooter();
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['case'])) {
|
||||||
|
TestManager::runTestCase($_GET['case'], CakeTestsGetReporter());
|
||||||
|
CakePHPTestRunMore();
|
||||||
|
CakePHPTestSuiteFooter();
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
CakePHPTestHeader();
|
||||||
|
CakePHPTestSuiteHeader();
|
||||||
|
|
||||||
|
if (isset($_GET['show']) && $_GET['show'] == 'cases') {
|
||||||
|
CakePHPTestCaseList();
|
||||||
|
} else {
|
||||||
|
CakePHPTestGroupTestList();
|
||||||
|
}
|
||||||
|
CakePHPTestSuiteFooter();
|
||||||
|
?>
|
90
cake/tests/lib/cake_reporter.php
Normal file
90
cake/tests/lib/cake_reporter.php
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
<?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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
41
cake/tests/lib/cake_web_test_case.php
Normal file
41
cake/tests/lib/cake_web_test_case.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?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.lib
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
SimpleTestOptions::ignore('CakeWebTestCase');
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.lib
|
||||||
|
*/
|
||||||
|
class CakeWebTestCase extends WebTestCase {
|
||||||
|
}
|
||||||
|
?>
|
111
cake/tests/lib/cli_reporter.php
Normal file
111
cake/tests/lib/cli_reporter.php
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
<?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
|
||||||
|
*/
|
||||||
|
if (! defined('ST_FAILDETAIL_SEPARATOR')) {
|
||||||
|
define('ST_FAILDETAIL_SEPARATOR', "->");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! defined('ST_FAILS_RETURN_CODE')) {
|
||||||
|
define('ST_FAILS_RETURN_CODE', 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version_compare(phpversion(), '4.3.0', '<') ||
|
||||||
|
php_sapi_name() == 'cgi') {
|
||||||
|
define('STDOUT', fopen('php://stdout', 'w'));
|
||||||
|
define('STDERR', fopen('php://stderr', 'w'));
|
||||||
|
register_shutdown_function(
|
||||||
|
create_function('', 'fclose(STDOUT); fclose(STDERR); return true;'));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Minimal command line test displayer. Writes fail details to STDERR. Returns 0
|
||||||
|
* to the shell if all tests pass, ST_FAILS_RETURN_CODE if any test fails.
|
||||||
|
*
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.libs
|
||||||
|
*/
|
||||||
|
class CLIReporter extends SimpleReporter {
|
||||||
|
var $faildetail_separator = ST_FAILDETAIL_SEPARATOR;
|
||||||
|
|
||||||
|
function CLIReporter($faildetail_separator = NULL) {
|
||||||
|
$this->SimpleReporter();
|
||||||
|
if (! is_null($faildetail_separator)) {
|
||||||
|
$this->setFailDetailSeparator($faildetail_separator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setFailDetailSeparator($separator) {
|
||||||
|
$this->faildetail_separator = $separator;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return a formatted faildetail for printing.
|
||||||
|
*/
|
||||||
|
function &_paintTestFailDetail(&$message) {
|
||||||
|
$buffer = '';
|
||||||
|
$faildetail = $this->getTestList();
|
||||||
|
array_shift($faildetail);
|
||||||
|
$buffer .= implode($this->faildetail_separator, $faildetail);
|
||||||
|
$buffer .= $this->faildetail_separator . "$message\n";
|
||||||
|
return $buffer;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Paint fail faildetail to STDERR.
|
||||||
|
*/
|
||||||
|
function paintFail($message) {
|
||||||
|
parent::paintFail($message);
|
||||||
|
fwrite(STDERR, 'FAIL' . $this->faildetail_separator . $this->_paintTestFailDetail($message));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Paint exception faildetail to STDERR.
|
||||||
|
*/
|
||||||
|
function paintException($message) {
|
||||||
|
parent::paintException($message);
|
||||||
|
fwrite(STDERR, 'EXCEPTION' . $this->faildetail_separator . $this->_paintTestFailDetail($message));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Paint a footer with test case name, timestamp, counts of fails and exceptions.
|
||||||
|
*/
|
||||||
|
function paintFooter($test_name) {
|
||||||
|
$buffer = $this->getTestCaseProgress() . '/' . $this->getTestCaseCount() . ' test cases complete: ';
|
||||||
|
|
||||||
|
if (0 < ($this->getFailCount() + $this->getExceptionCount())) {
|
||||||
|
$buffer .= $this->getPassCount() . " passes";
|
||||||
|
if (0 < $this->getFailCount()) {
|
||||||
|
$buffer .= ", " . $this->getFailCount() . " fails";
|
||||||
|
}
|
||||||
|
if (0 < $this->getExceptionCount()) {
|
||||||
|
$buffer .= ", " . $this->getExceptionCount() . " exceptions";
|
||||||
|
}
|
||||||
|
$buffer .= ".\n";
|
||||||
|
fwrite(STDOUT, $buffer);
|
||||||
|
exit(ST_FAILS_RETURN_CODE);
|
||||||
|
} else {
|
||||||
|
fwrite(STDOUT, $buffer . $this->getPassCount() . " passes.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
40
cake/tests/lib/content.php
Normal file
40
cake/tests/lib/content.php
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?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.lib
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<div id="wrapper">
|
||||||
|
<div id="content">
|
||||||
|
<h1>CakePHP(tm) Test Suite v 1.2.0.0</h1>
|
||||||
|
<ul>
|
||||||
|
<li><a href='<?php echo $groups;?>'>Core Test Groups</a></li>
|
||||||
|
<li><a href='<?php echo $cases;?>'>Core Test Cases</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<li><a href='<?php echo $groups;?>&app=true'>App Test Groups</a></li>
|
||||||
|
<li><a href='<?php echo $cases;?>&app=true'>App Test Cases</a></li>
|
||||||
|
</ul>
|
42
cake/tests/lib/footer.php
Normal file
42
cake/tests/lib/footer.php
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?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.lib
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="footer">
|
||||||
|
<p>
|
||||||
|
<a href="https://trac.cakephp.org/wiki/Developement/TestSuite">CakePHP(tm) Test Suite </a> ::
|
||||||
|
<a href="http://www.cakefoundation.org/"> © 2005-2007, Cake Software Foundation, Inc.</a></p>
|
||||||
|
<p>
|
||||||
|
<!--PLEASE USE ONE OF THE POWERED BY CAKEPHP LOGO-->
|
||||||
|
<a href="http://www.cakephp.org/" target="_new">
|
||||||
|
<img src="<?php echo $baseUrl; ?>/img/cake.power.png" alt="CakePHP(tm) :: Rapid Development Framework" height = "15" width = "80" /></a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
37
cake/tests/lib/header.php
Normal file
37
cake/tests/lib/header.php
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?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.lib
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv='content-Type' content='text/html; charset=iso-8859-1' />
|
||||||
|
<title>CakePHP(tm) Test Suite v 1.2.0.0</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="<?php echo $baseUrl; ?>/css/cake.generic.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
353
cake/tests/lib/test_manager.php
Normal file
353
cake/tests/lib/test_manager.php
Normal file
|
@ -0,0 +1,353 @@
|
||||||
|
<?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.lib
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
define ('CORE_TEST_CASES', CAKE_CORE_INCLUDE_PATH .'cake' . DS . 'tests' .DS. 'cases');
|
||||||
|
define ('CORE_TEST_GROUPS', CAKE_CORE_INCLUDE_PATH .'cake' . DS . 'tests' .DS. 'groups');
|
||||||
|
define ('APP_TEST_CASES', ROOT . APP_DIR . 'tests' .DS. 'cases');
|
||||||
|
define ('APP_TEST_GROUPS', ROOT . APP_DIR . 'tests' .DS. 'groups');
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.lib
|
||||||
|
*/
|
||||||
|
class TestManager {
|
||||||
|
var $_testExtension = '.test.php';
|
||||||
|
var $_groupExtension = '.group.php';
|
||||||
|
var $usersAppTest = false;
|
||||||
|
|
||||||
|
function TestManager() {
|
||||||
|
$this->_installSimpleTest();
|
||||||
|
if (isset($_GET['app'])) {
|
||||||
|
$this->usersAppTest = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _installSimpleTest() {
|
||||||
|
vendor('simpletest'.DS.'unit_tester', 'simpletest'.DS.'web_tester', 'simpletest'.DS.'mock_objects');
|
||||||
|
require_once(LIB_TESTS.'cake_web_test_case.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
function runAllTests(&$reporter) {
|
||||||
|
$manager =& new TestManager();
|
||||||
|
|
||||||
|
if(!empty($manager->usersAppTest)) {
|
||||||
|
$testCasePath = APP_TEST_CASES . DIRECTORY_SEPARATOR;
|
||||||
|
} else {
|
||||||
|
$testCasePath = CORE_TEST_CASES . DIRECTORY_SEPARATOR;
|
||||||
|
}
|
||||||
|
$testCases =& $manager->_getTestFileList($testCasePath);
|
||||||
|
$test =& new GroupTest('All Core Tests');
|
||||||
|
|
||||||
|
if (isset($_GET['app'])) {
|
||||||
|
$test =& new GroupTest('All App Tests');
|
||||||
|
} else {
|
||||||
|
$test =& new GroupTest('All Core Tests');
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($testCases as $testCase) {
|
||||||
|
$test->addTestFile($testCase);
|
||||||
|
}
|
||||||
|
$test->run($reporter);
|
||||||
|
}
|
||||||
|
|
||||||
|
function runTestCase($testCaseFile, &$reporter) {
|
||||||
|
$manager =& new TestManager();
|
||||||
|
|
||||||
|
if(!empty($manager->usersAppTest)) {
|
||||||
|
$testCaseFileWithPath = APP_TEST_CASES . DIRECTORY_SEPARATOR . $testCaseFile;
|
||||||
|
} else {
|
||||||
|
$testCaseFileWithPath = CORE_TEST_CASES . DIRECTORY_SEPARATOR . $testCaseFile;
|
||||||
|
}
|
||||||
|
if (! file_exists($testCaseFileWithPath)) {
|
||||||
|
trigger_error("Test case {$testCaseFile} cannot be found", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
$test =& new GroupTest("Individual test case: " . $testCaseFile);
|
||||||
|
$test->addTestFile($testCaseFileWithPath);
|
||||||
|
$test->run($reporter);
|
||||||
|
}
|
||||||
|
|
||||||
|
function runGroupTest($groupTestName, $groupTestDirectory, &$reporter) {
|
||||||
|
$manager =& new TestManager();
|
||||||
|
$filePath = $groupTestDirectory . DIRECTORY_SEPARATOR .
|
||||||
|
strtolower($groupTestName) . $manager->_groupExtension;
|
||||||
|
|
||||||
|
if (! file_exists($filePath)) {
|
||||||
|
trigger_error("Group test {$groupTestName} cannot be found at {$filePath}", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once $filePath;
|
||||||
|
$test =& new GroupTest($groupTestName . ' group test');
|
||||||
|
|
||||||
|
foreach ($manager->_getGroupTestClassNames($filePath) as $groupTest) {
|
||||||
|
$test->addTestCase(new $groupTest());
|
||||||
|
}
|
||||||
|
$test->run($reporter);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addTestCasesFromDirectory(&$groupTest, $directory = '.') {
|
||||||
|
$manager =& new TestManager();
|
||||||
|
$testCases =& $manager->_getTestFileList($directory);
|
||||||
|
foreach ($testCases as $testCase) {
|
||||||
|
$groupTest->addTestFile($testCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function &getTestCaseList($directory = '.') {
|
||||||
|
$manager =& new TestManager();
|
||||||
|
$return = $manager->_getTestCaseList($directory);
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &_getTestCaseList($directory = '.') {
|
||||||
|
$fileList =& $this->_getTestFileList($directory);
|
||||||
|
$testCases = array();
|
||||||
|
foreach ($fileList as $testCaseFile) {
|
||||||
|
$testCases[$testCaseFile] = str_replace($directory . DS, '', $testCaseFile);
|
||||||
|
}
|
||||||
|
return $testCases;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &_getTestFileList($directory = '.') {
|
||||||
|
$return = $this->_getRecursiveFileList($directory, array(&$this, '_isTestCaseFile'));
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &getGroupTestList($directory = '.') {
|
||||||
|
$manager =& new TestManager();
|
||||||
|
$return = $manager->_getTestGroupList($directory);
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &_getTestGroupFileList($directory = '.') {
|
||||||
|
$return = $this->_getRecursiveFileList($directory, array(&$this, '_isTestGroupFile'));
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &_getTestGroupList($directory = '.') {
|
||||||
|
$fileList =& $this->_getTestGroupFileList($directory);
|
||||||
|
$groupTests = array();
|
||||||
|
|
||||||
|
foreach ($fileList as $groupTestFile) {
|
||||||
|
$groupTests[$groupTestFile] = str_replace($this->_groupExtension, '', basename($groupTestFile));
|
||||||
|
}
|
||||||
|
sort($groupTests);
|
||||||
|
return $groupTests;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &_getGroupTestClassNames($groupTestFile) {
|
||||||
|
$file = implode("\n", file($groupTestFile));
|
||||||
|
preg_match("~lass\s+?(.*)\s+?extends GroupTest~", $file, $matches);
|
||||||
|
if (! empty($matches)) {
|
||||||
|
unset($matches[0]);
|
||||||
|
return $matches;
|
||||||
|
} else {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function &_getRecursiveFileList($directory = '.', $fileTestFunction) {
|
||||||
|
$dh = opendir($directory);
|
||||||
|
if (! is_resource($dh)) {
|
||||||
|
trigger_error("Couldn't open {$directory}", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fileList = array();
|
||||||
|
while ($file = readdir($dh)) {
|
||||||
|
$filePath = $directory . DIRECTORY_SEPARATOR . $file;
|
||||||
|
if (0 === strpos($file, '.')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_dir($filePath)) {
|
||||||
|
$fileList = array_merge($fileList, $this->_getRecursiveFileList($filePath, $fileTestFunction));
|
||||||
|
}
|
||||||
|
if ($fileTestFunction[0]->$fileTestFunction[1]($file)) {
|
||||||
|
$fileList[] = $filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($dh);
|
||||||
|
return $fileList;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _isTestCaseFile($file) {
|
||||||
|
return $this->_hasExpectedExtension($file, $this->_testExtension);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _isTestGroupFile($file) {
|
||||||
|
return $this->_hasExpectedExtension($file, $this->_groupExtension);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _hasExpectedExtension($file, $extension) {
|
||||||
|
return $extension == strtolower(substr($file, (0 - strlen($extension))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.lib
|
||||||
|
*/
|
||||||
|
class CliTestManager extends TestManager {
|
||||||
|
|
||||||
|
function &getGroupTestList($directory = '.') {
|
||||||
|
$manager =& new CliTestManager();
|
||||||
|
$groupTests =& $manager->_getTestGroupList($directory);
|
||||||
|
$buffer = "Available Group Test:\n";
|
||||||
|
|
||||||
|
foreach ($groupTests as $groupTest) {
|
||||||
|
$buffer .= " " . $groupTest . "\n";
|
||||||
|
}
|
||||||
|
return $buffer . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
function &getTestCaseList($directory = '.') {
|
||||||
|
$manager =& new CliTestManager();
|
||||||
|
$testCases =& $manager->_getTestCaseList($directory);
|
||||||
|
$buffer = "Available Test Cases:\n";
|
||||||
|
|
||||||
|
foreach ($testCases as $testCaseFile => $testCase) {
|
||||||
|
$buffer .= " " . $testCaseFile . "\n";
|
||||||
|
}
|
||||||
|
return $buffer . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.lib
|
||||||
|
*/
|
||||||
|
class TextTestManager extends TestManager {
|
||||||
|
var $_url;
|
||||||
|
|
||||||
|
function TextTestManager() {
|
||||||
|
$this->_url = $_SERVER['PHP_SELF'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBaseURL() {
|
||||||
|
return $this->_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &getGroupTestList($directory = '.') {
|
||||||
|
$manager =& new TextTestManager();
|
||||||
|
$groupTests =& $manager->_getTestGroupList($directory);
|
||||||
|
|
||||||
|
if (1 > count($groupTests)) {
|
||||||
|
$noGroups = "No test groups set up!\n";
|
||||||
|
return $noGroups;
|
||||||
|
}
|
||||||
|
$buffer = "Available test groups:\n";
|
||||||
|
$buffer .= $manager->getBaseURL() . "?group=all All tests<\n";
|
||||||
|
|
||||||
|
foreach ($groupTests as $groupTest) {
|
||||||
|
$buffer .= "<li><a href='" . $manager->getBaseURL() . "?group={$groupTest}'>" . $groupTest . "&output=txt"."</a></li>\n";
|
||||||
|
}
|
||||||
|
return $buffer . "</ul>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
function &getTestCaseList($directory = '.') {
|
||||||
|
$manager =& new TextTestManager();
|
||||||
|
$testCases =& $manager->_getTestCaseList($directory);
|
||||||
|
|
||||||
|
if (1 > count($testCases)) {
|
||||||
|
$noTestCases = "No test cases set up!";
|
||||||
|
return $noTestCases;
|
||||||
|
}
|
||||||
|
$buffer = "Available test cases:\n";
|
||||||
|
|
||||||
|
foreach ($testCases as $testCaseFile => $testCase) {
|
||||||
|
$buffer .= $_SERVER['SERVER_NAME']. $manager->getBaseURL()."?case=" . $testCase . "&output=txt"."\n";
|
||||||
|
}
|
||||||
|
return $buffer . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Short description for class.
|
||||||
|
*
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.cake.tests.lib
|
||||||
|
*/
|
||||||
|
class HtmlTestManager extends TestManager {
|
||||||
|
var $_url;
|
||||||
|
|
||||||
|
function HtmlTestManager() {
|
||||||
|
$this->_url = $_SERVER['PHP_SELF'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBaseURL() {
|
||||||
|
return $this->_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &getGroupTestList($directory = '.') {
|
||||||
|
$userApp = '';
|
||||||
|
if (isset($_GET['app'])) {
|
||||||
|
$userApp = '&app=true';
|
||||||
|
}
|
||||||
|
$manager =& new HtmlTestManager();
|
||||||
|
$groupTests =& $manager->_getTestGroupList($directory);
|
||||||
|
|
||||||
|
if (isset($_GET['app'])){
|
||||||
|
$buffer = "<p>Available App Test Groups:</p>\n<ul>";
|
||||||
|
} else {
|
||||||
|
$buffer = "<p>Available Core Test Groups:</p>\n<ul>";
|
||||||
|
}
|
||||||
|
$buffer .= "<li><a href='" . $manager->getBaseURL() . "?group=all$userApp'>All tests</a></li>\n";
|
||||||
|
|
||||||
|
foreach ($groupTests as $groupTest) {
|
||||||
|
$buffer .= "<li><a href='" . $manager->getBaseURL() . "?group={$groupTest}" . "{$userApp}'>" . $groupTest . "</a></li>\n";
|
||||||
|
}
|
||||||
|
$buffer .= "</ul>\n";
|
||||||
|
return $buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
function &getTestCaseList($directory = '.') {
|
||||||
|
$userApp = '';
|
||||||
|
if (isset($_GET['app'])) {
|
||||||
|
$userApp = '&app=true';
|
||||||
|
}
|
||||||
|
$manager =& new HtmlTestManager();
|
||||||
|
$testCases =& $manager->_getTestCaseList($directory);
|
||||||
|
|
||||||
|
if (1 > count($testCases)) {
|
||||||
|
$noTestCases = "<p>No test cases set up!</p>";
|
||||||
|
return $noTestCases;
|
||||||
|
}
|
||||||
|
if (isset($_GET['app'])) {
|
||||||
|
$buffer = "<p>Available App Test Cases:</p>\n<ul>";
|
||||||
|
} else {
|
||||||
|
$buffer = "<p>Available Core Test Cases:</p>\n<ul>";
|
||||||
|
}
|
||||||
|
foreach ($testCases as $testCaseFile => $testCase) {
|
||||||
|
$buffer .= "<li><a href='" . $manager->getBaseURL() . "?case=" . urlencode($testCase) . $userApp ."'>" . $testCase . "</a></li>\n";
|
||||||
|
}
|
||||||
|
$buffer .= "</ul>\n";
|
||||||
|
return $buffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in a new issue