2 /* SVN FILE: $Id: test.php 6527 2008-03-09 04:07:56Z gwoo $ */
4 * Short description for file.
6 * Long description for file
10 * CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
11 * Copyright 2005-2008, Cake Software Foundation, Inc.
12 * 1785 E. Sahara Avenue, Suite 490-204
13 * Las Vegas, Nevada 89104
15 * Licensed under The Open Group Test Suite License
16 * Redistributions of files must retain the above copyright notice.
19 * @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
20 * @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
22 * @subpackage cake.cake.tests.libs
23 * @since CakePHP(tm) v 1.2.0.4433
24 * @version $Revision: 6527 $
25 * @modifiedby $LastChangedBy: gwoo $
26 * @lastmodified $Date: 2008-03-09 02:07:56 -0200 (dom, 09 mar 2008) $
27 * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
29 error_reporting(E_ALL
);
31 ini_set('memory_limit','128M');
33 define('DS', DIRECTORY_SEPARATOR
);
35 if (!defined('ROOT')) {
36 define('ROOT', dirname(dirname(dirname(__FILE__
))));
38 if (!defined('APP_DIR')) {
39 define('APP_DIR', basename(dirname(dirname(__FILE__
))));
41 if (!defined('CAKE_CORE_INCLUDE_PATH')) {
42 define('CAKE_CORE_INCLUDE_PATH', ROOT
);
44 if (!defined('WEBROOT_DIR')) {
45 define('WEBROOT_DIR', basename(dirname(__FILE__
)));
47 if (!defined('WWW_ROOT')) {
48 define('WWW_ROOT', dirname(__FILE__
) . DS
);
50 if (!defined('CORE_PATH')) {
51 if (function_exists('ini_set')) {
52 ini_set('include_path', CAKE_CORE_INCLUDE_PATH
. PATH_SEPARATOR
. ROOT
. DS
. APP_DIR
. DS
. PATH_SEPARATOR
. ini_get('include_path'));
53 define('APP_PATH', null);
54 define('CORE_PATH', null);
56 define('APP_PATH', ROOT
. DS
. APP_DIR
. DS
);
57 define('CORE_PATH', CAKE_CORE_INCLUDE_PATH
. DS
);
61 ini_set('display_errors', 1);
62 if (!include(CORE_PATH
. 'cake' . DS
. 'bootstrap.php')) {
63 trigger_error("Can't find CakePHP core. Check the value of CAKE_CORE_INCLUDE_PATH in app/webroot/test.php. It should point to the directory containing your " . DS
. "cake core directory and your " . DS
. "vendors root directory.", E_USER_ERROR
);
66 $corePath = Configure
::corePaths('cake');
67 if (isset($corePath[0])) {
68 define('TEST_CAKE_CORE_INCLUDE_PATH', rtrim($corePath[0], DS
) . DS
);
70 define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH
);
72 require_once CAKE_TESTS_LIB
. 'test_manager.php';
74 if (Configure
::read('debug') < 1) {
75 die(__('Debug setting does not allow access to this url.', true));
78 if (!isset($_SERVER['SERVER_NAME'])) {
79 $_SERVER['SERVER_NAME'] = '';
81 if (empty( $_GET['output'])) {
82 $_GET['output'] = 'html';
86 * Used to determine output to display
88 define('CAKE_TEST_OUTPUT_HTML', 1);
89 define('CAKE_TEST_OUTPUT_TEXT', 2);
91 if (isset($_GET['output']) && $_GET['output'] == 'html') {
92 define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_HTML
);
94 Debugger
::output('txt');
95 define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_TEXT
);
98 if (!App
::import('Vendor', 'simpletest' . DS
. 'reporter')) {
100 include CAKE_TESTS_LIB
. 'simpletest.php';
101 CakePHPTestSuiteFooter();
106 CakePHPTestSuiteHeader();
107 define('RUN_TEST_LINK', $_SERVER['PHP_SELF']);
109 if (isset($_GET['group'])) {
110 if ('all' == $_GET['group']) {
111 TestManager
::runAllTests(CakeTestsGetReporter());
113 TestManager
::runGroupTest(ucfirst($_GET['group']), CakeTestsGetReporter());
115 CakePHPTestRunMore();
116 } elseif (isset($_GET['case'])) {
117 TestManager
::runTestCase($_GET['case'], CakeTestsGetReporter());
118 CakePHPTestRunMore();
119 }elseif (isset($_GET['show']) && $_GET['show'] == 'cases') {
120 CakePHPTestCaseList();
122 CakePHPTestGroupTestList();
124 CakePHPTestSuiteFooter();