| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* PHPUnit
|
|
|
4 |
*
|
|
|
5 |
* Copyright (c) 2002-2010, Sebastian Bergmann <sb@sebastian-bergmann.de>.
|
|
|
6 |
* All rights reserved.
|
|
|
7 |
*
|
|
|
8 |
* Redistribution and use in source and binary forms, with or without
|
|
|
9 |
* modification, are permitted provided that the following conditions
|
|
|
10 |
* are met:
|
|
|
11 |
*
|
|
|
12 |
* * Redistributions of source code must retain the above copyright
|
|
|
13 |
* notice, this list of conditions and the following disclaimer.
|
|
|
14 |
*
|
|
|
15 |
* * Redistributions in binary form must reproduce the above copyright
|
|
|
16 |
* notice, this list of conditions and the following disclaimer in
|
|
|
17 |
* the documentation and/or other materials provided with the
|
|
|
18 |
* distribution.
|
|
|
19 |
*
|
|
|
20 |
* * Neither the name of Sebastian Bergmann nor the names of his
|
|
|
21 |
* contributors may be used to endorse or promote products derived
|
|
|
22 |
* from this software without specific prior written permission.
|
|
|
23 |
*
|
|
|
24 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
25 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
26 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
27 |
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
28 |
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
29 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
30 |
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
31 |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
32 |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
33 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
34 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
35 |
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
36 |
*
|
|
|
37 |
* @category Testing
|
|
|
38 |
* @package PHPUnit
|
|
|
39 |
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
|
|
40 |
* @copyright 2002-2010 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
|
|
41 |
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
|
|
42 |
* @link http://www.phpunit.de/
|
|
|
43 |
* @since File available since Release 2.0.0
|
|
|
44 |
*/
|
|
|
45 |
|
|
|
46 |
require_once 'PHPUnit/Framework.php';
|
|
|
47 |
require_once 'PHPUnit/Runner/BaseTestRunner.php';
|
|
|
48 |
require_once 'PHPUnit/Extensions/RepeatedTest.php';
|
|
|
49 |
require_once 'PHPUnit/Runner/StandardTestSuiteLoader.php';
|
|
|
50 |
require_once 'PHPUnit/Runner/Version.php';
|
|
|
51 |
require_once 'PHPUnit/TextUI/ResultPrinter.php';
|
|
|
52 |
require_once 'PHPUnit/Util/Configuration.php';
|
|
|
53 |
require_once 'PHPUnit/Util/PDO.php';
|
|
|
54 |
require_once 'PHPUnit/Util/Filesystem.php';
|
|
|
55 |
require_once 'PHPUnit/Util/Filter.php';
|
|
|
56 |
require_once 'PHPUnit/Util/Report.php';
|
|
|
57 |
|
|
|
58 |
PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
|
|
|
59 |
|
|
|
60 |
/**
|
|
|
61 |
* A TestRunner for the Command Line Interface (CLI)
|
|
|
62 |
* PHP SAPI Module.
|
|
|
63 |
*
|
|
|
64 |
* @category Testing
|
|
|
65 |
* @package PHPUnit
|
|
|
66 |
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
|
|
67 |
* @copyright 2002-2010 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
|
|
68 |
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
|
|
|
69 |
* @version Release: 3.4.15
|
|
|
70 |
* @link http://www.phpunit.de/
|
|
|
71 |
* @since Class available since Release 2.0.0
|
|
|
72 |
*/
|
|
|
73 |
class PHPUnit_TextUI_TestRunner extends PHPUnit_Runner_BaseTestRunner
|
|
|
74 |
{
|
|
|
75 |
const SUCCESS_EXIT = 0;
|
|
|
76 |
const FAILURE_EXIT = 1;
|
|
|
77 |
const EXCEPTION_EXIT = 2;
|
|
|
78 |
|
|
|
79 |
/**
|
|
|
80 |
* @var PHPUnit_Runner_TestSuiteLoader
|
|
|
81 |
*/
|
|
|
82 |
protected $loader = NULL;
|
|
|
83 |
|
|
|
84 |
/**
|
|
|
85 |
* @var PHPUnit_TextUI_ResultPrinter
|
|
|
86 |
*/
|
|
|
87 |
protected $printer = NULL;
|
|
|
88 |
|
|
|
89 |
/**
|
|
|
90 |
* @var boolean
|
|
|
91 |
*/
|
|
|
92 |
protected static $versionStringPrinted = FALSE;
|
|
|
93 |
|
|
|
94 |
/**
|
|
|
95 |
* @param PHPUnit_Runner_TestSuiteLoader $loader
|
|
|
96 |
* @since Method available since Release 3.4.0
|
|
|
97 |
*/
|
|
|
98 |
public function __construct(PHPUnit_Runner_TestSuiteLoader $loader = NULL)
|
|
|
99 |
{
|
|
|
100 |
$this->loader = $loader;
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
/**
|
|
|
104 |
* @param mixed $test
|
|
|
105 |
* @param array $arguments
|
|
|
106 |
* @throws InvalidArgumentException
|
|
|
107 |
*/
|
|
|
108 |
public static function run($test, array $arguments = array())
|
|
|
109 |
{
|
|
|
110 |
if ($test instanceof ReflectionClass) {
|
|
|
111 |
$test = new PHPUnit_Framework_TestSuite($test);
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
if ($test instanceof PHPUnit_Framework_Test) {
|
|
|
115 |
$aTestRunner = new PHPUnit_TextUI_TestRunner;
|
|
|
116 |
|
|
|
117 |
return $aTestRunner->doRun(
|
|
|
118 |
$test,
|
|
|
119 |
$arguments
|
|
|
120 |
);
|
|
|
121 |
} else {
|
|
|
122 |
throw new InvalidArgumentException(
|
|
|
123 |
'No test case or test suite found.'
|
|
|
124 |
);
|
|
|
125 |
}
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
/**
|
|
|
129 |
* Runs a single test and waits until the user types RETURN.
|
|
|
130 |
*
|
|
|
131 |
* @param PHPUnit_Framework_Test $suite
|
|
|
132 |
*/
|
|
|
133 |
public static function runAndWait(PHPUnit_Framework_Test $suite)
|
|
|
134 |
{
|
|
|
135 |
$aTestRunner = new PHPUnit_TextUI_TestRunner;
|
|
|
136 |
|
|
|
137 |
$aTestRunner->doRun(
|
|
|
138 |
$suite,
|
|
|
139 |
array(
|
|
|
140 |
'wait' => TRUE
|
|
|
141 |
)
|
|
|
142 |
);
|
|
|
143 |
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
/**
|
|
|
147 |
* @return PHPUnit_Framework_TestResult
|
|
|
148 |
*/
|
|
|
149 |
protected function createTestResult()
|
|
|
150 |
{
|
|
|
151 |
return new PHPUnit_Framework_TestResult;
|
|
|
152 |
}
|
|
|
153 |
|
|
|
154 |
/**
|
|
|
155 |
* @param PHPUnit_Framework_Test $suite
|
|
|
156 |
* @param array $arguments
|
|
|
157 |
* @return PHPUnit_Framework_TestResult
|
|
|
158 |
*/
|
|
|
159 |
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
|
|
|
160 |
{
|
|
|
161 |
$this->handleConfiguration($arguments);
|
|
|
162 |
|
|
|
163 |
if (isset($arguments['bootstrap'])) {
|
|
|
164 |
$bootstrap = PHPUnit_Util_Fileloader::load($arguments['bootstrap']);
|
|
|
165 |
|
|
|
166 |
if ($bootstrap) {
|
|
|
167 |
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $bootstrap;
|
|
|
168 |
}
|
|
|
169 |
}
|
|
|
170 |
|
|
|
171 |
if ($arguments['backupGlobals'] === FALSE) {
|
|
|
172 |
$suite->setBackupGlobals(FALSE);
|
|
|
173 |
}
|
|
|
174 |
|
|
|
175 |
if ($arguments['backupStaticAttributes'] === TRUE) {
|
|
|
176 |
$suite->setBackupStaticAttributes(TRUE);
|
|
|
177 |
}
|
|
|
178 |
|
|
|
179 |
if (is_integer($arguments['repeat'])) {
|
|
|
180 |
$suite = new PHPUnit_Extensions_RepeatedTest(
|
|
|
181 |
$suite,
|
|
|
182 |
$arguments['repeat'],
|
|
|
183 |
$arguments['filter'],
|
|
|
184 |
$arguments['groups'],
|
|
|
185 |
$arguments['excludeGroups'],
|
|
|
186 |
$arguments['processIsolation']
|
|
|
187 |
);
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
$result = $this->createTestResult();
|
|
|
191 |
|
|
|
192 |
if (!$arguments['convertErrorsToExceptions']) {
|
|
|
193 |
$result->convertErrorsToExceptions(FALSE);
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
if (!$arguments['convertNoticesToExceptions']) {
|
|
|
197 |
PHPUnit_Framework_Error_Notice::$enabled = FALSE;
|
|
|
198 |
}
|
|
|
199 |
|
|
|
200 |
if (!$arguments['convertWarningsToExceptions']) {
|
|
|
201 |
PHPUnit_Framework_Error_Warning::$enabled = FALSE;
|
|
|
202 |
}
|
|
|
203 |
|
|
|
204 |
if ($arguments['stopOnFailure']) {
|
|
|
205 |
$result->stopOnFailure(TRUE);
|
|
|
206 |
}
|
|
|
207 |
|
|
|
208 |
if ($this->printer === NULL) {
|
|
|
209 |
if (isset($arguments['printer']) &&
|
|
|
210 |
$arguments['printer'] instanceof PHPUnit_Util_Printer) {
|
|
|
211 |
$this->printer = $arguments['printer'];
|
|
|
212 |
} else {
|
|
|
213 |
$this->printer = new PHPUnit_TextUI_ResultPrinter(
|
|
|
214 |
NULL,
|
|
|
215 |
$arguments['verbose'],
|
|
|
216 |
$arguments['colors'],
|
|
|
217 |
$arguments['debug']
|
|
|
218 |
);
|
|
|
219 |
}
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
if (!$this->printer instanceof PHPUnit_Util_Log_TAP &&
|
|
|
223 |
!self::$versionStringPrinted) {
|
|
|
224 |
$this->printer->write(
|
|
|
225 |
PHPUnit_Runner_Version::getVersionString() . "\n\n"
|
|
|
226 |
);
|
|
|
227 |
}
|
|
|
228 |
|
|
|
229 |
foreach ($arguments['listeners'] as $listener) {
|
|
|
230 |
$result->addListener($listener);
|
|
|
231 |
}
|
|
|
232 |
|
|
|
233 |
$result->addListener($this->printer);
|
|
|
234 |
|
|
|
235 |
if (isset($arguments['storyHTMLFile'])) {
|
|
|
236 |
require_once 'PHPUnit/Extensions/Story/ResultPrinter/HTML.php';
|
|
|
237 |
|
|
|
238 |
$result->addListener(
|
|
|
239 |
new PHPUnit_Extensions_Story_ResultPrinter_HTML(
|
|
|
240 |
$arguments['storyHTMLFile']
|
|
|
241 |
)
|
|
|
242 |
);
|
|
|
243 |
}
|
|
|
244 |
|
|
|
245 |
if (isset($arguments['storyTextFile'])) {
|
|
|
246 |
require_once 'PHPUnit/Extensions/Story/ResultPrinter/Text.php';
|
|
|
247 |
|
|
|
248 |
$result->addListener(
|
|
|
249 |
new PHPUnit_Extensions_Story_ResultPrinter_Text(
|
|
|
250 |
$arguments['storyTextFile']
|
|
|
251 |
)
|
|
|
252 |
);
|
|
|
253 |
}
|
|
|
254 |
|
|
|
255 |
if (isset($arguments['testdoxHTMLFile'])) {
|
|
|
256 |
require_once 'PHPUnit/Util/TestDox/ResultPrinter/HTML.php';
|
|
|
257 |
|
|
|
258 |
$result->addListener(
|
|
|
259 |
new PHPUnit_Util_TestDox_ResultPrinter_HTML(
|
|
|
260 |
$arguments['testdoxHTMLFile']
|
|
|
261 |
)
|
|
|
262 |
);
|
|
|
263 |
}
|
|
|
264 |
|
|
|
265 |
if (isset($arguments['testdoxTextFile'])) {
|
|
|
266 |
require_once 'PHPUnit/Util/TestDox/ResultPrinter/Text.php';
|
|
|
267 |
|
|
|
268 |
$result->addListener(
|
|
|
269 |
new PHPUnit_Util_TestDox_ResultPrinter_Text(
|
|
|
270 |
$arguments['testdoxTextFile']
|
|
|
271 |
)
|
|
|
272 |
);
|
|
|
273 |
}
|
|
|
274 |
|
|
|
275 |
if (isset($arguments['graphvizLogfile'])) {
|
|
|
276 |
if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Image/GraphViz.php')) {
|
|
|
277 |
require_once 'PHPUnit/Util/Log/GraphViz.php';
|
|
|
278 |
|
|
|
279 |
$result->addListener(
|
|
|
280 |
new PHPUnit_Util_Log_GraphViz($arguments['graphvizLogfile'])
|
|
|
281 |
);
|
|
|
282 |
}
|
|
|
283 |
}
|
|
|
284 |
|
|
|
285 |
if ((isset($arguments['coverageClover']) ||
|
|
|
286 |
isset($arguments['coverageSource']) ||
|
|
|
287 |
isset($arguments['metricsXML']) ||
|
|
|
288 |
isset($arguments['pmdXML']) ||
|
|
|
289 |
isset($arguments['reportDirectory'])) &&
|
|
|
290 |
extension_loaded('xdebug')) {
|
|
|
291 |
$result->collectCodeCoverageInformation(TRUE);
|
|
|
292 |
}
|
|
|
293 |
|
|
|
294 |
if (isset($arguments['jsonLogfile'])) {
|
|
|
295 |
require_once 'PHPUnit/Util/Log/JSON.php';
|
|
|
296 |
|
|
|
297 |
$result->addListener(
|
|
|
298 |
new PHPUnit_Util_Log_JSON($arguments['jsonLogfile'])
|
|
|
299 |
);
|
|
|
300 |
}
|
|
|
301 |
|
|
|
302 |
if (isset($arguments['tapLogfile'])) {
|
|
|
303 |
require_once 'PHPUnit/Util/Log/TAP.php';
|
|
|
304 |
|
|
|
305 |
$result->addListener(
|
|
|
306 |
new PHPUnit_Util_Log_TAP($arguments['tapLogfile'])
|
|
|
307 |
);
|
|
|
308 |
}
|
|
|
309 |
|
|
|
310 |
if (isset($arguments['junitLogfile'])) {
|
|
|
311 |
require_once 'PHPUnit/Util/Log/JUnit.php';
|
|
|
312 |
|
|
|
313 |
$result->addListener(
|
|
|
314 |
new PHPUnit_Util_Log_JUnit(
|
|
|
315 |
$arguments['junitLogfile'], $arguments['logIncompleteSkipped']
|
|
|
316 |
)
|
|
|
317 |
);
|
|
|
318 |
}
|
|
|
319 |
|
|
|
320 |
if (isset($arguments['testDatabaseDSN']) &&
|
|
|
321 |
isset($arguments['testDatabaseLogRevision']) &&
|
|
|
322 |
extension_loaded('pdo')) {
|
|
|
323 |
$writeToTestDatabase = TRUE;
|
|
|
324 |
} else {
|
|
|
325 |
$writeToTestDatabase = FALSE;
|
|
|
326 |
}
|
|
|
327 |
|
|
|
328 |
if ($writeToTestDatabase) {
|
|
|
329 |
$dbh = PHPUnit_Util_PDO::factory($arguments['testDatabaseDSN']);
|
|
|
330 |
|
|
|
331 |
require_once 'PHPUnit/Util/Log/Database.php';
|
|
|
332 |
|
|
|
333 |
$dbListener = PHPUnit_Util_Log_Database::getInstance(
|
|
|
334 |
$dbh,
|
|
|
335 |
$arguments['testDatabaseLogRevision'],
|
|
|
336 |
isset($arguments['testDatabaseLogInfo']) ? $arguments['testDatabaseLogInfo'] : ''
|
|
|
337 |
);
|
|
|
338 |
|
|
|
339 |
$result->addListener($dbListener);
|
|
|
340 |
$result->collectCodeCoverageInformation(TRUE);
|
|
|
341 |
}
|
|
|
342 |
|
|
|
343 |
$suite->run(
|
|
|
344 |
$result,
|
|
|
345 |
$arguments['filter'],
|
|
|
346 |
$arguments['groups'],
|
|
|
347 |
$arguments['excludeGroups'],
|
|
|
348 |
$arguments['processIsolation']
|
|
|
349 |
);
|
|
|
350 |
|
|
|
351 |
unset($suite);
|
|
|
352 |
$result->flushListeners();
|
|
|
353 |
|
|
|
354 |
if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
|
|
|
355 |
$this->printer->printResult($result);
|
|
|
356 |
}
|
|
|
357 |
|
|
|
358 |
if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
|
|
|
359 |
if (isset($arguments['coverageClover'])) {
|
|
|
360 |
$this->printer->write(
|
|
|
361 |
"\nWriting code coverage data to XML file, " .
|
|
|
362 |
'this may take a moment.'
|
|
|
363 |
);
|
|
|
364 |
|
|
|
365 |
require_once 'PHPUnit/Util/Log/CodeCoverage/XML/Clover.php';
|
|
|
366 |
|
|
|
367 |
$writer = new PHPUnit_Util_Log_CodeCoverage_XML_Clover(
|
|
|
368 |
$arguments['coverageClover']
|
|
|
369 |
);
|
|
|
370 |
|
|
|
371 |
$writer->process($result);
|
|
|
372 |
$this->printer->write("\n");
|
|
|
373 |
}
|
|
|
374 |
|
|
|
375 |
if (isset($arguments['coverageSource'])) {
|
|
|
376 |
$this->printer->write(
|
|
|
377 |
"\nWriting code coverage data to XML files, " .
|
|
|
378 |
'this may take a moment.'
|
|
|
379 |
);
|
|
|
380 |
|
|
|
381 |
require_once 'PHPUnit/Util/Log/CodeCoverage/XML/Source.php';
|
|
|
382 |
|
|
|
383 |
$writer = new PHPUnit_Util_Log_CodeCoverage_XML_Source(
|
|
|
384 |
$arguments['coverageSource']
|
|
|
385 |
);
|
|
|
386 |
|
|
|
387 |
$writer->process($result);
|
|
|
388 |
$this->printer->write("\n");
|
|
|
389 |
}
|
|
|
390 |
|
|
|
391 |
if ($writeToTestDatabase) {
|
|
|
392 |
$this->printer->write(
|
|
|
393 |
"\nStoring code coverage and software metrics data in " .
|
|
|
394 |
"database.\nThis may take a moment."
|
|
|
395 |
);
|
|
|
396 |
|
|
|
397 |
require_once 'PHPUnit/Util/Log/CodeCoverage/Database.php';
|
|
|
398 |
|
|
|
399 |
$testDb = new PHPUnit_Util_Log_CodeCoverage_Database($dbh);
|
|
|
400 |
$testDb->storeCodeCoverage(
|
|
|
401 |
$result,
|
|
|
402 |
$dbListener->getRunId(),
|
|
|
403 |
$arguments['testDatabaseLogRevision'],
|
|
|
404 |
$arguments['testDatabasePrefix']
|
|
|
405 |
);
|
|
|
406 |
|
|
|
407 |
$this->printer->write("\n");
|
|
|
408 |
}
|
|
|
409 |
|
|
|
410 |
if (isset($arguments['metricsXML'])) {
|
|
|
411 |
$this->printer->write(
|
|
|
412 |
"\nWriting metrics report XML file, this may take a moment."
|
|
|
413 |
);
|
|
|
414 |
|
|
|
415 |
require_once 'PHPUnit/Util/Log/Metrics.php';
|
|
|
416 |
|
|
|
417 |
$writer = new PHPUnit_Util_Log_Metrics(
|
|
|
418 |
$arguments['metricsXML']
|
|
|
419 |
);
|
|
|
420 |
|
|
|
421 |
$writer->process($result);
|
|
|
422 |
$this->printer->write("\n");
|
|
|
423 |
}
|
|
|
424 |
|
|
|
425 |
if (isset($arguments['pmdXML'])) {
|
|
|
426 |
require_once 'PHPUnit/Util/Log/PMD.php';
|
|
|
427 |
|
|
|
428 |
$writer = new PHPUnit_Util_Log_PMD(
|
|
|
429 |
$arguments['pmdXML'], $arguments['pmd']
|
|
|
430 |
);
|
|
|
431 |
|
|
|
432 |
$this->printer->write(
|
|
|
433 |
"\nWriting violations report XML file, " .
|
|
|
434 |
'this may take a moment.'
|
|
|
435 |
);
|
|
|
436 |
|
|
|
437 |
$writer->process($result);
|
|
|
438 |
|
|
|
439 |
require_once 'PHPUnit/Util/Log/CPD.php';
|
|
|
440 |
|
|
|
441 |
$writer = new PHPUnit_Util_Log_CPD(
|
|
|
442 |
str_replace('.xml', '-cpd.xml', $arguments['pmdXML'])
|
|
|
443 |
);
|
|
|
444 |
|
|
|
445 |
$writer->process(
|
|
|
446 |
$result,
|
|
|
447 |
$arguments['cpdMinLines'],
|
|
|
448 |
$arguments['cpdMinMatches']
|
|
|
449 |
);
|
|
|
450 |
|
|
|
451 |
$this->printer->write("\n");
|
|
|
452 |
}
|
|
|
453 |
|
|
|
454 |
if (isset($arguments['reportDirectory'])) {
|
|
|
455 |
$this->printer->write(
|
|
|
456 |
"\nGenerating code coverage report, this may take a moment."
|
|
|
457 |
);
|
|
|
458 |
|
|
|
459 |
$title = '';
|
|
|
460 |
|
|
|
461 |
if (isset($arguments['configuration'])) {
|
|
|
462 |
$loggingConfiguration = $arguments['configuration']->getLoggingConfiguration();
|
|
|
463 |
|
|
|
464 |
if (isset($loggingConfiguration['title'])) {
|
|
|
465 |
$title = $loggingConfiguration['title'];
|
|
|
466 |
}
|
|
|
467 |
}
|
|
|
468 |
|
|
|
469 |
PHPUnit_Util_Report::render(
|
|
|
470 |
$result,
|
|
|
471 |
$arguments['reportDirectory'],
|
|
|
472 |
$title,
|
|
|
473 |
$arguments['reportCharset'],
|
|
|
474 |
$arguments['reportYUI'],
|
|
|
475 |
$arguments['reportHighlight'],
|
|
|
476 |
$arguments['reportLowUpperBound'],
|
|
|
477 |
$arguments['reportHighLowerBound']
|
|
|
478 |
);
|
|
|
479 |
|
|
|
480 |
$this->printer->write("\n");
|
|
|
481 |
}
|
|
|
482 |
}
|
|
|
483 |
|
|
|
484 |
$this->pause($arguments['wait']);
|
|
|
485 |
|
|
|
486 |
return $result;
|
|
|
487 |
}
|
|
|
488 |
|
|
|
489 |
/**
|
|
|
490 |
* @param boolean $wait
|
|
|
491 |
*/
|
|
|
492 |
protected function pause($wait)
|
|
|
493 |
{
|
|
|
494 |
if (!$wait) {
|
|
|
495 |
return;
|
|
|
496 |
}
|
|
|
497 |
|
|
|
498 |
if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
|
|
|
499 |
$this->printer->printWaitPrompt();
|
|
|
500 |
}
|
|
|
501 |
|
|
|
502 |
fgets(STDIN);
|
|
|
503 |
}
|
|
|
504 |
|
|
|
505 |
/**
|
|
|
506 |
* @param PHPUnit_TextUI_ResultPrinter $resultPrinter
|
|
|
507 |
*/
|
|
|
508 |
public function setPrinter(PHPUnit_TextUI_ResultPrinter $resultPrinter)
|
|
|
509 |
{
|
|
|
510 |
$this->printer = $resultPrinter;
|
|
|
511 |
}
|
|
|
512 |
|
|
|
513 |
/**
|
|
|
514 |
* Override to define how to handle a failed loading of
|
|
|
515 |
* a test suite.
|
|
|
516 |
*
|
|
|
517 |
* @param string $message
|
|
|
518 |
*/
|
|
|
519 |
protected function runFailed($message)
|
|
|
520 |
{
|
|
|
521 |
self::printVersionString();
|
|
|
522 |
self::write($message);
|
|
|
523 |
exit(self::FAILURE_EXIT);
|
|
|
524 |
}
|
|
|
525 |
|
|
|
526 |
/**
|
|
|
527 |
* @param string $buffer
|
|
|
528 |
* @since Method available since Release 3.1.0
|
|
|
529 |
*/
|
|
|
530 |
protected static function write($buffer)
|
|
|
531 |
{
|
|
|
532 |
if (PHP_SAPI != 'cli') {
|
|
|
533 |
$buffer = htmlspecialchars($buffer);
|
|
|
534 |
}
|
|
|
535 |
|
|
|
536 |
print $buffer;
|
|
|
537 |
}
|
|
|
538 |
|
|
|
539 |
/**
|
|
|
540 |
* Returns the loader to be used.
|
|
|
541 |
*
|
|
|
542 |
* @return PHPUnit_Runner_TestSuiteLoader
|
|
|
543 |
* @since Method available since Release 2.2.0
|
|
|
544 |
*/
|
|
|
545 |
public function getLoader()
|
|
|
546 |
{
|
|
|
547 |
if ($this->loader === NULL) {
|
|
|
548 |
$this->loader = new PHPUnit_Runner_StandardTestSuiteLoader;
|
|
|
549 |
}
|
|
|
550 |
|
|
|
551 |
return $this->loader;
|
|
|
552 |
}
|
|
|
553 |
|
|
|
554 |
/**
|
|
|
555 |
*/
|
|
|
556 |
public static function showError($message)
|
|
|
557 |
{
|
|
|
558 |
self::printVersionString();
|
|
|
559 |
self::write($message . "\n");
|
|
|
560 |
|
|
|
561 |
exit(self::FAILURE_EXIT);
|
|
|
562 |
}
|
|
|
563 |
|
|
|
564 |
/**
|
|
|
565 |
*/
|
|
|
566 |
public static function printVersionString()
|
|
|
567 |
{
|
|
|
568 |
if (!self::$versionStringPrinted) {
|
|
|
569 |
self::write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
|
|
|
570 |
self::$versionStringPrinted = TRUE;
|
|
|
571 |
}
|
|
|
572 |
}
|
|
|
573 |
|
|
|
574 |
/**
|
|
|
575 |
* @param array $arguments
|
|
|
576 |
* @since Method available since Release 3.2.1
|
|
|
577 |
*/
|
|
|
578 |
protected function handleConfiguration(array &$arguments)
|
|
|
579 |
{
|
|
|
580 |
if (isset($arguments['configuration']) &&
|
|
|
581 |
!$arguments['configuration'] instanceof PHPUnit_Util_Configuration) {
|
|
|
582 |
$arguments['configuration'] = PHPUnit_Util_Configuration::getInstance(
|
|
|
583 |
$arguments['configuration']
|
|
|
584 |
);
|
|
|
585 |
|
|
|
586 |
$arguments['pmd'] = $arguments['configuration']->getPMDConfiguration();
|
|
|
587 |
} else {
|
|
|
588 |
$arguments['pmd'] = array();
|
|
|
589 |
}
|
|
|
590 |
|
|
|
591 |
$arguments['debug'] = isset($arguments['debug']) ? $arguments['debug'] : FALSE;
|
|
|
592 |
$arguments['filter'] = isset($arguments['filter']) ? $arguments['filter'] : FALSE;
|
|
|
593 |
$arguments['listeners'] = isset($arguments['listeners']) ? $arguments['listeners'] : array();
|
|
|
594 |
$arguments['repeat'] = isset($arguments['repeat']) ? $arguments['repeat'] : FALSE;
|
|
|
595 |
$arguments['testDatabasePrefix'] = isset($arguments['testDatabasePrefix']) ? $arguments['testDatabasePrefix'] : '';
|
|
|
596 |
$arguments['verbose'] = isset($arguments['verbose']) ? $arguments['verbose'] : FALSE;
|
|
|
597 |
$arguments['wait'] = isset($arguments['wait']) ? $arguments['wait'] : FALSE;
|
|
|
598 |
|
|
|
599 |
if (isset($arguments['configuration'])) {
|
|
|
600 |
$arguments['configuration']->handlePHPConfiguration();
|
|
|
601 |
|
|
|
602 |
$filterConfiguration = $arguments['configuration']->getFilterConfiguration();
|
|
|
603 |
|
|
|
604 |
PHPUnit_Util_Filter::$addUncoveredFilesFromWhitelist = $filterConfiguration['whitelist']['addUncoveredFilesFromWhitelist'];
|
|
|
605 |
|
|
|
606 |
foreach ($filterConfiguration['blacklist']['include']['directory'] as $dir) {
|
|
|
607 |
PHPUnit_Util_Filter::addDirectoryToFilter(
|
|
|
608 |
$dir['path'], $dir['suffix'], $dir['group'], $dir['prefix']
|
|
|
609 |
);
|
|
|
610 |
}
|
|
|
611 |
|
|
|
612 |
foreach ($filterConfiguration['blacklist']['include']['file'] as $file) {
|
|
|
613 |
PHPUnit_Util_Filter::addFileToFilter($file);
|
|
|
614 |
}
|
|
|
615 |
|
|
|
616 |
foreach ($filterConfiguration['blacklist']['exclude']['directory'] as $dir) {
|
|
|
617 |
PHPUnit_Util_Filter::removeDirectoryFromFilter(
|
|
|
618 |
$dir['path'], $dir['suffix'], $dir['group'], $dir['prefix']
|
|
|
619 |
);
|
|
|
620 |
}
|
|
|
621 |
|
|
|
622 |
foreach ($filterConfiguration['blacklist']['exclude']['file'] as $file) {
|
|
|
623 |
PHPUnit_Util_Filter::removeFileFromFilter($file);
|
|
|
624 |
}
|
|
|
625 |
|
|
|
626 |
foreach ($filterConfiguration['whitelist']['include']['directory'] as $dir) {
|
|
|
627 |
PHPUnit_Util_Filter::addDirectoryToWhitelist(
|
|
|
628 |
$dir['path'], $dir['suffix'], $dir['prefix']
|
|
|
629 |
);
|
|
|
630 |
}
|
|
|
631 |
|
|
|
632 |
foreach ($filterConfiguration['whitelist']['include']['file'] as $file) {
|
|
|
633 |
PHPUnit_Util_Filter::addFileToWhitelist($file);
|
|
|
634 |
}
|
|
|
635 |
|
|
|
636 |
foreach ($filterConfiguration['whitelist']['exclude']['directory'] as $dir) {
|
|
|
637 |
PHPUnit_Util_Filter::removeDirectoryFromWhitelist(
|
|
|
638 |
$dir['path'], $dir['suffix'], $dir['prefix']
|
|
|
639 |
);
|
|
|
640 |
}
|
|
|
641 |
|
|
|
642 |
foreach ($filterConfiguration['whitelist']['exclude']['file'] as $file) {
|
|
|
643 |
PHPUnit_Util_Filter::removeFileFromWhitelist($file);
|
|
|
644 |
}
|
|
|
645 |
|
|
|
646 |
$phpunitConfiguration = $arguments['configuration']->getPHPUnitConfiguration();
|
|
|
647 |
|
|
|
648 |
if (isset($phpunitConfiguration['backupGlobals']) &&
|
|
|
649 |
!isset($arguments['backupGlobals'])) {
|
|
|
650 |
$arguments['backupGlobals'] = $phpunitConfiguration['backupGlobals'];
|
|
|
651 |
}
|
|
|
652 |
|
|
|
653 |
if (isset($phpunitConfiguration['backupStaticAttributes']) &&
|
|
|
654 |
!isset($arguments['backupStaticAttributes'])) {
|
|
|
655 |
$arguments['backupStaticAttributes'] = $phpunitConfiguration['backupStaticAttributes'];
|
|
|
656 |
}
|
|
|
657 |
|
|
|
658 |
if (isset($phpunitConfiguration['bootstrap']) &&
|
|
|
659 |
!isset($arguments['bootstrap'])) {
|
|
|
660 |
$arguments['bootstrap'] = $phpunitConfiguration['bootstrap'];
|
|
|
661 |
}
|
|
|
662 |
|
|
|
663 |
if (isset($phpunitConfiguration['colors']) &&
|
|
|
664 |
!isset($arguments['colors'])) {
|
|
|
665 |
$arguments['colors'] = $phpunitConfiguration['colors'];
|
|
|
666 |
}
|
|
|
667 |
|
|
|
668 |
if (isset($phpunitConfiguration['convertErrorsToExceptions']) &&
|
|
|
669 |
!isset($arguments['convertErrorsToExceptions'])) {
|
|
|
670 |
$arguments['convertErrorsToExceptions'] = $phpunitConfiguration['convertErrorsToExceptions'];
|
|
|
671 |
}
|
|
|
672 |
|
|
|
673 |
if (isset($phpunitConfiguration['convertNoticesToExceptions']) &&
|
|
|
674 |
!isset($arguments['convertNoticesToExceptions'])) {
|
|
|
675 |
$arguments['convertNoticesToExceptions'] = $phpunitConfiguration['convertNoticesToExceptions'];
|
|
|
676 |
}
|
|
|
677 |
|
|
|
678 |
if (isset($phpunitConfiguration['convertWarningsToExceptions']) &&
|
|
|
679 |
!isset($arguments['convertWarningsToExceptions'])) {
|
|
|
680 |
$arguments['convertWarningsToExceptions'] = $phpunitConfiguration['convertWarningsToExceptions'];
|
|
|
681 |
}
|
|
|
682 |
|
|
|
683 |
if (isset($phpunitConfiguration['processIsolation']) &&
|
|
|
684 |
!isset($arguments['processIsolation'])) {
|
|
|
685 |
$arguments['processIsolation'] = $phpunitConfiguration['processIsolation'];
|
|
|
686 |
}
|
|
|
687 |
|
|
|
688 |
if (isset($phpunitConfiguration['stopOnFailure']) &&
|
|
|
689 |
!isset($arguments['stopOnFailure'])) {
|
|
|
690 |
$arguments['stopOnFailure'] = $phpunitConfiguration['stopOnFailure'];
|
|
|
691 |
}
|
|
|
692 |
|
|
|
693 |
$groupConfiguration = $arguments['configuration']->getGroupConfiguration();
|
|
|
694 |
|
|
|
695 |
if (!empty($groupConfiguration['include']) &&
|
|
|
696 |
!isset($arguments['groups'])) {
|
|
|
697 |
$arguments['groups'] = $groupConfiguration['include'];
|
|
|
698 |
}
|
|
|
699 |
|
|
|
700 |
if (!empty($groupConfiguration['exclude']) &&
|
|
|
701 |
!isset($arguments['excludeGroups'])) {
|
|
|
702 |
$arguments['excludeGroups'] = $groupConfiguration['exclude'];
|
|
|
703 |
}
|
|
|
704 |
|
|
|
705 |
foreach ($arguments['configuration']->getListenerConfiguration() as $listener) {
|
|
|
706 |
if (!class_exists($listener['class'], FALSE) &&
|
|
|
707 |
$listener['file'] !== '') {
|
|
|
708 |
$file = PHPUnit_Util_Filesystem::fileExistsInIncludePath(
|
|
|
709 |
$listener['file']
|
|
|
710 |
);
|
|
|
711 |
|
|
|
712 |
if ($file !== FALSE) {
|
|
|
713 |
require $file;
|
|
|
714 |
}
|
|
|
715 |
}
|
|
|
716 |
|
|
|
717 |
if (class_exists($listener['class'], FALSE)) {
|
|
|
718 |
if (count($listener['arguments']) == 0) {
|
|
|
719 |
$listener = new $listener['class'];
|
|
|
720 |
} else {
|
|
|
721 |
$listenerClass = new ReflectionClass(
|
|
|
722 |
$listener['class']
|
|
|
723 |
);
|
|
|
724 |
$listener = $listenerClass->newInstanceArgs(
|
|
|
725 |
$listener['arguments']
|
|
|
726 |
);
|
|
|
727 |
}
|
|
|
728 |
|
|
|
729 |
if ($listener instanceof PHPUnit_Framework_TestListener) {
|
|
|
730 |
$arguments['listeners'][] = $listener;
|
|
|
731 |
}
|
|
|
732 |
}
|
|
|
733 |
}
|
|
|
734 |
|
|
|
735 |
$loggingConfiguration = $arguments['configuration']->getLoggingConfiguration();
|
|
|
736 |
|
|
|
737 |
if (isset($loggingConfiguration['coverage-html']) &&
|
|
|
738 |
!isset($arguments['reportDirectory'])) {
|
|
|
739 |
if (isset($loggingConfiguration['charset']) &&
|
|
|
740 |
!isset($arguments['reportCharset'])) {
|
|
|
741 |
$arguments['reportCharset'] = $loggingConfiguration['charset'];
|
|
|
742 |
}
|
|
|
743 |
|
|
|
744 |
if (isset($loggingConfiguration['yui']) &&
|
|
|
745 |
!isset($arguments['reportYUI'])) {
|
|
|
746 |
$arguments['reportYUI'] = $loggingConfiguration['yui'];
|
|
|
747 |
}
|
|
|
748 |
|
|
|
749 |
if (isset($loggingConfiguration['highlight']) &&
|
|
|
750 |
!isset($arguments['reportHighlight'])) {
|
|
|
751 |
$arguments['reportHighlight'] = $loggingConfiguration['highlight'];
|
|
|
752 |
}
|
|
|
753 |
|
|
|
754 |
if (isset($loggingConfiguration['lowUpperBound']) &&
|
|
|
755 |
!isset($arguments['reportLowUpperBound'])) {
|
|
|
756 |
$arguments['reportLowUpperBound'] = $loggingConfiguration['lowUpperBound'];
|
|
|
757 |
}
|
|
|
758 |
|
|
|
759 |
if (isset($loggingConfiguration['highLowerBound']) &&
|
|
|
760 |
!isset($arguments['reportHighLowerBound'])) {
|
|
|
761 |
$arguments['reportHighLowerBound'] = $loggingConfiguration['highLowerBound'];
|
|
|
762 |
}
|
|
|
763 |
|
|
|
764 |
$arguments['reportDirectory'] = $loggingConfiguration['coverage-html'];
|
|
|
765 |
}
|
|
|
766 |
|
|
|
767 |
if (isset($loggingConfiguration['coverage-clover']) &&
|
|
|
768 |
!isset($arguments['coverageClover'])) {
|
|
|
769 |
$arguments['coverageClover'] = $loggingConfiguration['coverage-clover'];
|
|
|
770 |
}
|
|
|
771 |
|
|
|
772 |
if (isset($loggingConfiguration['coverage-xml']) &&
|
|
|
773 |
!isset($arguments['coverageClover'])) {
|
|
|
774 |
$arguments['coverageClover'] = $loggingConfiguration['coverage-xml'];
|
|
|
775 |
}
|
|
|
776 |
|
|
|
777 |
if (isset($loggingConfiguration['coverage-source']) &&
|
|
|
778 |
!isset($arguments['coverageSource'])) {
|
|
|
779 |
$arguments['coverageSource'] = $loggingConfiguration['coverage-source'];
|
|
|
780 |
}
|
|
|
781 |
|
|
|
782 |
if (isset($loggingConfiguration['graphviz']) &&
|
|
|
783 |
!isset($arguments['graphvizLogfile'])) {
|
|
|
784 |
$arguments['graphvizLogfile'] = $loggingConfiguration['graphviz'];
|
|
|
785 |
}
|
|
|
786 |
|
|
|
787 |
if (isset($loggingConfiguration['json']) &&
|
|
|
788 |
!isset($arguments['jsonLogfile'])) {
|
|
|
789 |
$arguments['jsonLogfile'] = $loggingConfiguration['json'];
|
|
|
790 |
}
|
|
|
791 |
|
|
|
792 |
if (isset($loggingConfiguration['metrics-xml']) &&
|
|
|
793 |
!isset($arguments['metricsXML'])) {
|
|
|
794 |
$arguments['metricsXML'] = $loggingConfiguration['metrics-xml'];
|
|
|
795 |
}
|
|
|
796 |
|
|
|
797 |
if (isset($loggingConfiguration['plain'])) {
|
|
|
798 |
$arguments['listeners'][] = new PHPUnit_TextUI_ResultPrinter($loggingConfiguration['plain'], TRUE);
|
|
|
799 |
}
|
|
|
800 |
|
|
|
801 |
if (isset($loggingConfiguration['pmd-xml']) &&
|
|
|
802 |
!isset($arguments['pmdXML'])) {
|
|
|
803 |
if (isset($loggingConfiguration['cpdMinLines']) &&
|
|
|
804 |
!isset($arguments['cpdMinLines'])) {
|
|
|
805 |
$arguments['cpdMinLines'] = $loggingConfiguration['cpdMinLines'];
|
|
|
806 |
}
|
|
|
807 |
|
|
|
808 |
if (isset($loggingConfiguration['cpdMinMatches']) &&
|
|
|
809 |
!isset($arguments['cpdMinMatches'])) {
|
|
|
810 |
$arguments['cpdMinMatches'] = $loggingConfiguration['cpdMinMatches'];
|
|
|
811 |
}
|
|
|
812 |
|
|
|
813 |
$arguments['pmdXML'] = $loggingConfiguration['pmd-xml'];
|
|
|
814 |
}
|
|
|
815 |
|
|
|
816 |
if (isset($loggingConfiguration['tap']) &&
|
|
|
817 |
!isset($arguments['tapLogfile'])) {
|
|
|
818 |
$arguments['tapLogfile'] = $loggingConfiguration['tap'];
|
|
|
819 |
}
|
|
|
820 |
|
|
|
821 |
if (isset($loggingConfiguration['junit']) &&
|
|
|
822 |
!isset($arguments['junitLogfile'])) {
|
|
|
823 |
$arguments['junitLogfile'] = $loggingConfiguration['junit'];
|
|
|
824 |
|
|
|
825 |
if (isset($loggingConfiguration['logIncompleteSkipped']) && !isset($arguments['logIncompleteSkipped'])) {
|
|
|
826 |
$arguments['logIncompleteSkipped'] = $loggingConfiguration['logIncompleteSkipped'];
|
|
|
827 |
}
|
|
|
828 |
}
|
|
|
829 |
|
|
|
830 |
if (isset($loggingConfiguration['story-html']) &&
|
|
|
831 |
!isset($arguments['storyHTMLFile'])) {
|
|
|
832 |
$arguments['storyHTMLFile'] = $loggingConfiguration['story-html'];
|
|
|
833 |
}
|
|
|
834 |
|
|
|
835 |
if (isset($loggingConfiguration['story-text']) &&
|
|
|
836 |
!isset($arguments['storyTextFile'])) {
|
|
|
837 |
$arguments['storsTextFile'] = $loggingConfiguration['story-text'];
|
|
|
838 |
}
|
|
|
839 |
|
|
|
840 |
if (isset($loggingConfiguration['testdox-html']) &&
|
|
|
841 |
!isset($arguments['testdoxHTMLFile'])) {
|
|
|
842 |
$arguments['testdoxHTMLFile'] = $loggingConfiguration['testdox-html'];
|
|
|
843 |
}
|
|
|
844 |
|
|
|
845 |
if (isset($loggingConfiguration['testdox-text']) &&
|
|
|
846 |
!isset($arguments['testdoxTextFile'])) {
|
|
|
847 |
$arguments['testdoxTextFile'] = $loggingConfiguration['testdox-text'];
|
|
|
848 |
}
|
|
|
849 |
}
|
|
|
850 |
|
|
|
851 |
$arguments['backupGlobals'] = isset($arguments['backupGlobals']) ? $arguments['backupGlobals'] : NULL;
|
|
|
852 |
$arguments['backupStaticAttributes'] = isset($arguments['backupStaticAttributes']) ? $arguments['backupStaticAttributes'] : NULL;
|
|
|
853 |
$arguments['cpdMinLines'] = isset($arguments['cpdMinLines']) ? $arguments['cpdMinLines'] : 5;
|
|
|
854 |
$arguments['cpdMinMatches'] = isset($arguments['cpdMinMatches']) ? $arguments['cpdMinMatches'] : 70;
|
|
|
855 |
$arguments['colors'] = isset($arguments['colors']) ? $arguments['colors'] : FALSE;
|
|
|
856 |
$arguments['convertErrorsToExceptions'] = isset($arguments['convertErrorsToExceptions']) ? $arguments['convertErrorsToExceptions'] : TRUE;
|
|
|
857 |
$arguments['convertNoticesToExceptions'] = isset($arguments['convertNoticesToExceptions']) ? $arguments['convertNoticesToExceptions'] : TRUE;
|
|
|
858 |
$arguments['convertWarningsToExceptions'] = isset($arguments['convertWarningsToExceptions']) ? $arguments['convertWarningsToExceptions'] : TRUE;
|
|
|
859 |
$arguments['excludeGroups'] = isset($arguments['excludeGroups']) ? $arguments['excludeGroups'] : array();
|
|
|
860 |
$arguments['groups'] = isset($arguments['groups']) ? $arguments['groups'] : array();
|
|
|
861 |
$arguments['logIncompleteSkipped'] = isset($arguments['logIncompleteSkipped']) ? $arguments['logIncompleteSkipped'] : FALSE;
|
|
|
862 |
$arguments['processIsolation'] = isset($arguments['processIsolation']) ? $arguments['processIsolation'] : FALSE;
|
|
|
863 |
$arguments['reportCharset'] = isset($arguments['reportCharset']) ? $arguments['reportCharset'] : 'ISO-8859-1';
|
|
|
864 |
$arguments['reportHighlight'] = isset($arguments['reportHighlight']) ? $arguments['reportHighlight'] : FALSE;
|
|
|
865 |
$arguments['reportHighLowerBound'] = isset($arguments['reportHighLowerBound']) ? $arguments['reportHighLowerBound'] : 70;
|
|
|
866 |
$arguments['reportLowUpperBound'] = isset($arguments['reportLowUpperBound']) ? $arguments['reportLowUpperBound'] : 35;
|
|
|
867 |
$arguments['reportYUI'] = isset($arguments['reportYUI']) ? $arguments['reportYUI'] : TRUE;
|
|
|
868 |
$arguments['stopOnFailure'] = isset($arguments['stopOnFailure']) ? $arguments['stopOnFailure'] : FALSE;
|
|
|
869 |
|
|
|
870 |
if ($arguments['filter'] !== FALSE &&
|
|
|
871 |
preg_match('/^[a-zA-Z0-9_]/', $arguments['filter'])) {
|
|
|
872 |
// Escape delimiters in regular expression. Do NOT use preg_quote,
|
|
|
873 |
// to keep magic characters.
|
|
|
874 |
$arguments['filter'] = '/' . str_replace(
|
|
|
875 |
'/', '\\/', $arguments['filter']
|
|
|
876 |
) . '/';
|
|
|
877 |
}
|
|
|
878 |
}
|
|
|
879 |
}
|
|
|
880 |
?>
|