Menu

[r9]: / index.php  Maximize  Restore  History

Download this file

233 lines (203 with data), 7.5 kB

  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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?php
/**
* Copyright (c) 2009 Radu Gasler <miezuit@gmail.com>
*
* This file is free software: you may copy, redistribute and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 2 of the License, or (at your
* option) any later version.
*
* This file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*
* Dynamic test runner for PHPUnit
*
* This script does not use templates, since it should depend only
* on PHPUnit and the presence of testcase files.
*
* $Id: index.php 2 2009-03-06 11:11:06Z miezuit $
*
* $Rev: 2 $
*
* $LastChangedBy: miezuit $
*
* $LastChangedDate: 2009-03-06 13:11:06 +0200 (V, 06 mar. 2009) $
*
* @author Radu Gasler <miezuit@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GPL License
* @version 0.1
*/
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);
require_once 'config.php';
require_once 'functions.php';
require_once 'lib/FolderParser.php';
if(defined('PHPUNIT_DIR')) {
set_include_path(get_include_path() . PATH_SEPARATOR . PHPUNIT_DIR);
}
// Definitions:
define('RUN_SELECTED_LABEL', 'Run selected');
define('SELECT_ALL_LABEL', 'Select All');
define('CLEAR_ALL_LABEL', 'Clear All');
define('RESET_TESTER_LABEL', 'Reload Tests');
// start the session
session_start();
// reset tester
if(isset($_REQUEST['reset']) && ('true' === $_REQUEST['reset'])) {
session_destroy();
session_start();
// we will not run any suites in this case
unset($_REQUEST['runSuites']);
}
// create the folderParser object
if(!isset($_SESSION['folderParser'])) {
$_SESSION['folderParser'] = new FolderParser(ROOT_DIR, $exclude);
}
$folderParser = $_SESSION['folderParser'];
// Process the request:
$runSuites = array();
$testCase = null;
if (isset($_REQUEST['runSuites']) && is_array($_REQUEST['runSuites'])) {
$runSuites = $_REQUEST['runSuites'];
}
if (isset($_REQUEST['keepOpen'])) {
$keepOpen = trim($_REQUEST['keepOpen']);
} else {
$keepOpen = '';
}
$keepOpen = explode(' ', $keepOpen);
// if is set code coverage
if (isset($_REQUEST['coverage']) && 'true' === $_REQUEST['coverage']) {
// get the group name and the file name
$suite = $runSuites[0];
// set the file name
$file = $folderParser->getSuitePath($suite);
// set the class name
$className = getClassName($file);
// set the output dir for the code coverage
$relativePath = str_replace(ROOT_DIR . '/', '', $file);
$codeCoveragePath = str_replace(TEST_SUFFIX . '.php', '', $relativePath);
$codeCoverageTarget = str_replace(TEST_SUFFIX, '', $className) . '.php.html';
$codeCoverageDir = CODE_COVERAGE_DIR . '/' . $codeCoveragePath;
$command = PHPUNIT . " --coverage-html $codeCoverageDir $className $file";
//echo $command; die();
// run the code coverage
exec($command);
// redirect to the code coverage dir
if (isAjax()){
echo file_get_contents(basename(CODE_COVERAGE_DIR) . "/$codeCoveragePath/" . PRECEDE_TESTS.$codeCoverageTarget);
}else{
header(sprintf("Location: " . basename(CODE_COVERAGE_DIR) . "/$codeCoveragePath/" . PRECEDE_TESTS.$codeCoverageTarget));
}
// echo('Loading...');
exit(0);
}
if (isAjax()) {
// action can be: 'START', 'CONTINUE' or 'STOP'
if (isset($_GET['action'])) {
switch($_GET['action'])
{
case 'START':
if(0 == initializeSuites()) {
printf('0'); // no tests to run
}
break;
case 'CONTINUE':
list($testClass, $testName, $testResult) = runCurrentTestCase();
incrementSuite();
printStatus($testClass, $testName, $testResult);
break;
case 'STOP':
stopTestsAndDisplay();
break;
}
}
} else {
?>
<!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>
<title>Test Suites</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link href="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3Bcss%2Fcontainer.css%26quot%3B%2520rel%3D%26quot%3Bstylesheet%26quot%3B%2520type%3D%26quot%3Btext%2Fcss%26quot%3B%2520%2F%26gt%3B%253C%2Fspan">
<link href="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3Bcss%2Fcoveragestyle.css%26quot%3B%2520rel%3D%26quot%3Bstylesheet%26quot%3B%2520type%3D%26quot%3Btext%2Fcss%26quot%3B%2520%2F%26gt%3B%253C%2Fspan">
<link href="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3Bcss%2Fstyle.css%26quot%3B%2520rel%3D%26quot%3Bstylesheet%26quot%3B%2520type%3D%26quot%3Btext%2Fcss%26quot%3B%2520%2F%26gt%3B%253C%2Fspan">
<link href="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3Bcss%2FcontextMenu.css%26quot%3B%2520rel%3D%26quot%3Bstylesheet%26quot%3B%2520type%3D%26quot%3Btext%2Fcss%26quot%3B%2520%2F%26gt%3B%253C%2Fspan">
<script src="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3Bjs%2Fjquery-1.2.6.js%26quot%3B%2520type%3D%26quot%3Btext%2Fjavascript%26quot%3B%26gt%3B%26lt%3B%2Fscript%26gt%3B%253C%2Fspan">
<script src="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3Bjs%2Fjquery.contextMenu.js%26quot%3B%2520type%3D%26quot%3Btext%2Fjavascript%26quot%3B%26gt%3B%26lt%3B%2Fscript%26gt%3B%253C%2Fspan">
<script src="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3Bjs%2Ffunctions.js%26quot%3B%2520type%3D%26quot%3Btext%2Fjavascript%26quot%3B%26gt%3B%26lt%3B%2Fscript%26gt%3B%253C%2Fspan">
<script src="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3Bjs%2Fyahoo-dom-event.js%26quot%3B%2520type%3D%26quot%3Btext%2Fjavascript%26quot%3B%26gt%3B%26lt%3B%2Fscript%26gt%3B%253C%2Fspan">
<script src="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3Bjs%2Fcontainer-min.js%26quot%3B%2520type%3D%26quot%3Btext%2Fjavascript%26quot%3B%26gt%3B%26lt%3B%2Fscript%26gt%3B%253C%2Fspan">
<script>
var useAjax = <?php echo USE_AJAX ? 'true' : 'false' ?>;
$(document).ready(onDocumentLoad);
</script>
</head>
<body>
<!-- Context menu -->
<ul id="myContextMenu" class="contextMenu">
<li class="menuRun">
<a href="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3B%23menuRun%26quot%3B%26gt%3B%253C%2Fspan"><?php echo RUN_SELECTED_LABEL; ?></a>
</li>
<li class="menuReload">
<a href="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3B%23menuReload%26quot%3B%26gt%3B%253C%2Fspan"><?php echo RESET_TESTER_LABEL; ?></a>
</li>
</ul>
<!-- Main menu and form -->
<div id="menu">
<form id="menuForm" method="post" action="/?originalUrl=https%3A%2F%2Fsourceforge.net%2F%26quot%3B.%2F%26quot%3B%26gt%3B%253C%2Fspan">
<?php
if($folderParser->getRootFolderId() !== 0) {
displayMenu($folderParser, $folderParser->getRootFolderId());
} else {
echo 'No tests found. Please check out your config file.<br /><br />';
}
?>
<input type="hidden" name="keepOpen" id="keepOpen" value="<?php echo $keepOpen ?>"/>
<input type="hidden" name="coverage" id="coverage" value="false" />
<input type="hidden" name="reset" id="reset" value="false" />
<div>
<input class="button" style="width: 80px;" type="button" name="action" id="submitForm" value="<?php echo RUN_SELECTED_LABEL ?>" onclick="runTests()" />
</div>
<p>
<input class="button" style="width: 80px;" type="button" name="action" id="resetButton" value="<?php echo RESET_TESTER_LABEL ?>" onclick="resetTester()" />
</p>
</form>
</div>
<!-- Test Results -->
<div id="status">
<div id="loaderContainer"><div id="loader"></div></div>
<table><tr><td><div id="runnedTest"></div></td><td><div id="testResult"></div></td></tr></table>
<input class="button" style="width: 80px;" type="button" name="action" value="Stop" onclick="forceStop()" />
<div id="buffer" style="display: none;"></div>
</div>
<div id="suites">
<?php
flush();
if (0 !== initializeSuites()) {
while($_SESSION['runnedTests'] < $_SESSION['testCount']) {
list($testClass, $testName) = runCurrentTestCase();
incrementSuite();
}
stopTestsAndDisplay();
}
?>
</div>
<div id="codeCoverage">
<button onclick="closeCoverage();return false;">Close</button>
<div id="subCodeCoverage"></div>
</div>
<div style="display:none;z-index: 155407;overflow:auto; background-color: red; position: absolute; top: 400px; width: 100%; height: 100%; opacity: 0.7; color:#000000"
id="teste">
aici facem testetle
</div>
</html>
<?php
}
/*EOF*/
MongoDB Logo MongoDB