PageRenderTime 43ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/www/app/webroot/test.php

https://github.com/jasoneh/SMS-Can-
PHP | 188 lines | 115 code | 16 blank | 57 comment | 35 complexity | 71586856c852ef933c69e5592d2ed1d8 MD5 | raw file
  1. <?php
  2. /* SVN FILE: $Id$ */
  3. /**
  4. * Short description for file.
  5. *
  6. * Long description for file
  7. *
  8. * PHP versions 4 and 5
  9. *
  10. * CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
  11. * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
  12. *
  13. * Licensed under The Open Group Test Suite License
  14. * Redistributions of files must retain the above copyright notice.
  15. *
  16. * @filesource
  17. * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
  18. * @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
  19. * @package cake
  20. * @subpackage cake.cake.tests.libs
  21. * @since CakePHP(tm) v 1.2.0.4433
  22. * @version $Revision$
  23. * @modifiedby $LastChangedBy$
  24. * @lastmodified $Date$
  25. * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
  26. */
  27. /**
  28. * PHP 5.3 raises many notices in bootstrap.
  29. */
  30. if (!defined('E_DEPRECATED')) {
  31. define('E_DEPRECATED', 8192);
  32. }
  33. error_reporting(E_ALL & ~E_DEPRECATED);
  34. set_time_limit(0);
  35. ini_set('memory_limit','128M');
  36. ini_set('display_errors', 1);
  37. /**
  38. * Use the DS to separate the directories in other defines
  39. */
  40. if (!defined('DS')) {
  41. define('DS', DIRECTORY_SEPARATOR);
  42. }
  43. /**
  44. * These defines should only be edited if you have cake installed in
  45. * a directory layout other than the way it is distributed.
  46. * When using custom settings be sure to use the DS and do not add a trailing DS.
  47. */
  48. /**
  49. * The full path to the directory which holds "app", WITHOUT a trailing DS.
  50. *
  51. */
  52. if (!defined('ROOT')) {
  53. define('ROOT', dirname(dirname(dirname(__FILE__))));
  54. }
  55. /**
  56. * The actual directory name for the "app".
  57. *
  58. */
  59. if (!defined('APP_DIR')) {
  60. define('APP_DIR', basename(dirname(dirname(__FILE__))));
  61. }
  62. /**
  63. * The absolute path to the "cake" directory, WITHOUT a trailing DS.
  64. *
  65. */
  66. if (!defined('CAKE_CORE_INCLUDE_PATH')) {
  67. define('CAKE_CORE_INCLUDE_PATH', ROOT);
  68. }
  69. /**
  70. * Editing below this line should not be necessary.
  71. * Change at your own risk.
  72. *
  73. */
  74. if (!defined('WEBROOT_DIR')) {
  75. define('WEBROOT_DIR', basename(dirname(__FILE__)));
  76. }
  77. if (!defined('WWW_ROOT')) {
  78. define('WWW_ROOT', dirname(__FILE__) . DS);
  79. }
  80. if (!defined('CORE_PATH')) {
  81. 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'))) {
  82. define('APP_PATH', null);
  83. define('CORE_PATH', null);
  84. } else {
  85. define('APP_PATH', ROOT . DS . APP_DIR . DS);
  86. define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
  87. }
  88. }
  89. if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {
  90. trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
  91. }
  92. $corePath = App::core('cake');
  93. if (isset($corePath[0])) {
  94. define('TEST_CAKE_CORE_INCLUDE_PATH', rtrim($corePath[0], DS) . DS);
  95. } else {
  96. define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH);
  97. }
  98. require_once CAKE_TESTS_LIB . 'test_manager.php';
  99. if (Configure::read('debug') < 1) {
  100. die(__('Debug setting does not allow access to this url.', true));
  101. }
  102. if (!isset($_SERVER['SERVER_NAME'])) {
  103. $_SERVER['SERVER_NAME'] = '';
  104. }
  105. if (empty( $_GET['output'])) {
  106. $_GET['output'] = 'html';
  107. }
  108. /**
  109. *
  110. * Used to determine output to display
  111. */
  112. define('CAKE_TEST_OUTPUT_HTML', 1);
  113. define('CAKE_TEST_OUTPUT_TEXT', 2);
  114. if (isset($_GET['output']) && $_GET['output'] == 'html') {
  115. define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_HTML);
  116. } else {
  117. Debugger::output('txt');
  118. define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_TEXT);
  119. }
  120. if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) {
  121. CakePHPTestHeader();
  122. include CAKE_TESTS_LIB . 'simpletest.php';
  123. CakePHPTestSuiteFooter();
  124. exit();
  125. }
  126. $analyzeCodeCoverage = false;
  127. if (isset($_GET['code_coverage'])) {
  128. $analyzeCodeCoverage = true;
  129. require_once CAKE_TESTS_LIB . 'code_coverage_manager.php';
  130. if (!extension_loaded('xdebug')) {
  131. CakePHPTestHeader();
  132. include CAKE_TESTS_LIB . 'xdebug.php';
  133. CakePHPTestSuiteFooter();
  134. exit();
  135. }
  136. }
  137. CakePHPTestHeader();
  138. CakePHPTestSuiteHeader();
  139. define('RUN_TEST_LINK', $_SERVER['PHP_SELF']);
  140. if (isset($_GET['group'])) {
  141. if ('all' == $_GET['group']) {
  142. TestManager::runAllTests(CakeTestsGetReporter());
  143. } else {
  144. if ($analyzeCodeCoverage) {
  145. CodeCoverageManager::start($_GET['group'], CakeTestsGetReporter());
  146. }
  147. TestManager::runGroupTest(ucfirst($_GET['group']), CakeTestsGetReporter());
  148. if ($analyzeCodeCoverage) {
  149. CodeCoverageManager::report();
  150. }
  151. }
  152. CakePHPTestRunMore();
  153. CakePHPTestAnalyzeCodeCoverage();
  154. } elseif (isset($_GET['case'])) {
  155. if ($analyzeCodeCoverage) {
  156. CodeCoverageManager::start($_GET['case'], CakeTestsGetReporter());
  157. }
  158. TestManager::runTestCase($_GET['case'], CakeTestsGetReporter());
  159. if ($analyzeCodeCoverage) {
  160. CodeCoverageManager::report();
  161. }
  162. CakePHPTestRunMore();
  163. CakePHPTestAnalyzeCodeCoverage();
  164. } elseif (isset($_GET['show']) && $_GET['show'] == 'cases') {
  165. CakePHPTestCaseList();
  166. } else {
  167. CakePHPTestGroupTestList();
  168. }
  169. CakePHPTestSuiteFooter();
  170. $output = ob_get_clean();
  171. echo $output;
  172. ?>