/
cake_test_menu.php
121 lines (114 loc) · 2.71 KB
/
cake_test_menu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
/**
* CakeTestMenu Generates HTML based menus for CakePHP's built in test suite.
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.cake.tests.lib
* @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
class CakeTestMenu {
/**
* Prints a list of test cases
*
* @return void
* @access public
*/
function testCaseList() {
$class = CakeTestMenu::getTestManager();
echo call_user_func(array($class, 'getTestCaseList'));
}
/**
* Prints a list of group tests
*
* @return void
* @access public
*/
function groupTestList() {
$class = CakeTestMenu::getTestManager();
echo call_user_func(array($class, 'getGroupTestList'));
}
/**
* Gets the correct test manager for the chosen output.
*
* @return void
*/
function getTestManager() {
switch (CAKE_TEST_OUTPUT) {
case CAKE_TEST_OUTPUT_HTML:
return 'HtmlTestManager';
case CAKE_TEST_OUTPUT_TEXT:
default:
return 'TextTestManager';
}
}
/**
* Includes the Testsuite Header
*
* @return void
* @access public
*/
function testHeader() {
switch (CAKE_TEST_OUTPUT) {
case CAKE_TEST_OUTPUT_HTML:
ob_start();
if (!class_exists('dispatcher')) {
require CAKE . 'dispatcher.php';
}
$dispatch =& new Dispatcher();
$dispatch->baseUrl();
define('BASE', $dispatch->webroot);
$baseUrl = BASE;
$characterSet = 'charset=utf-8';
include CAKE_TESTS_LIB . 'header.php';
break;
case CAKE_TEST_OUTPUT_TEXT:
default:
header('content-type: text/plain');
break;
}
}
/**
* Provides the left hand navigation for the testsuite
*
* @return void
* @access public
*/
function testSuiteHeader() {
switch (CAKE_TEST_OUTPUT) {
case CAKE_TEST_OUTPUT_HTML:
ob_start();
$groups = $_SERVER['PHP_SELF'] . '?show=groups';
$cases = $_SERVER['PHP_SELF'] . '?show=cases';
$plugins = App::objects('plugin');
include CAKE_TESTS_LIB . 'content.php';
break;
}
}
/**
* Provides the testsuite footer text
*
* @return void
* @access public
*/
function footer() {
switch ( CAKE_TEST_OUTPUT) {
case CAKE_TEST_OUTPUT_HTML:
ob_start();
$baseUrl = BASE;
include CAKE_TESTS_LIB . 'footer.php';
break;
}
}
}
?>