5 * Copyright (c) 2002-2011, Sebastian Bergmann <sebastian@phpunit.de>.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
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
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.
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.
39 * @author Sebastian Bergmann <sebastian@phpunit.de>
40 * @copyright 2002-2011 Sebastian Bergmann <sebastian@phpunit.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
47 * A TestRunner for the Command Line Interface (CLI)
52 * @author Sebastian Bergmann <sebastian@phpunit.de>
53 * @copyright 2002-2011 Sebastian Bergmann <sebastian@phpunit.de>
54 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
55 * @version Release: 3.5.13
56 * @link http://www.phpunit.de/
57 * @since Class available since Release 2.0.0
59 class PHPUnit_TextUI_TestRunner extends PHPUnit_Runner_BaseTestRunner
61 const SUCCESS_EXIT = 0;
62 const FAILURE_EXIT = 1;
63 const EXCEPTION_EXIT = 2;
66 * @var PHPUnit_Runner_TestSuiteLoader
68 protected $loader = NULL;
71 * @var PHPUnit_TextUI_ResultPrinter
73 protected $printer = NULL;
78 protected static $versionStringPrinted = FALSE;
81 * @param PHPUnit_Runner_TestSuiteLoader $loader
82 * @since Method available since Release 3.4.0
84 public function __construct(PHPUnit_Runner_TestSuiteLoader $loader = NULL)
86 $this->loader = $loader;
91 * @param array $arguments
92 * @throws InvalidArgumentException
94 public static function run($test, array $arguments = array())
96 if ($test instanceof ReflectionClass) {
97 $test = new PHPUnit_Framework_TestSuite($test);
100 if ($test instanceof PHPUnit_Framework_Test) {
101 $aTestRunner = new PHPUnit_TextUI_TestRunner;
103 return $aTestRunner->doRun(
108 throw new InvalidArgumentException(
109 'No test case or test suite found.'
115 * Runs a single test and waits until the user types RETURN.
117 * @param PHPUnit_Framework_Test $suite
119 public static function runAndWait(PHPUnit_Framework_Test $suite)
121 $aTestRunner = new PHPUnit_TextUI_TestRunner;
133 * @return PHPUnit_Framework_TestResult
135 protected function createTestResult()
137 return new PHPUnit_Framework_TestResult;
141 * @param PHPUnit_Framework_Test $suite
142 * @param array $arguments
143 * @return PHPUnit_Framework_TestResult
145 public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
147 $this->handleConfiguration($arguments);
149 if (isset($arguments['bootstrap'])) {
150 $GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap'];
153 if ($arguments['backupGlobals'] === FALSE) {
154 $suite->setBackupGlobals(FALSE);
157 if ($arguments['backupStaticAttributes'] === TRUE) {
158 $suite->setBackupStaticAttributes(TRUE);
161 if (is_integer($arguments['repeat'])) {
162 $suite = new PHPUnit_Extensions_RepeatedTest(
164 $arguments['repeat'],
165 $arguments['filter'],
166 $arguments['groups'],
167 $arguments['excludeGroups'],
168 $arguments['processIsolation']
172 $result = $this->createTestResult();
174 if (!$arguments['convertErrorsToExceptions']) {
175 $result->convertErrorsToExceptions(FALSE);
178 if (!$arguments['convertNoticesToExceptions']) {
179 PHPUnit_Framework_Error_Notice::$enabled = FALSE;
182 if (!$arguments['convertWarningsToExceptions']) {
183 PHPUnit_Framework_Error_Warning::$enabled = FALSE;
186 if ($arguments['stopOnError']) {
187 $result->stopOnError(TRUE);
190 if ($arguments['stopOnFailure']) {
191 $result->stopOnFailure(TRUE);
194 if ($arguments['stopOnIncomplete']) {
195 $result->stopOnIncomplete(TRUE);
198 if ($arguments['stopOnSkipped']) {
199 $result->stopOnSkipped(TRUE);
202 if ($this->printer === NULL) {
203 if (isset($arguments['printer']) &&
204 $arguments['printer'] instanceof PHPUnit_Util_Printer) {
205 $this->printer = $arguments['printer'];
207 $this->printer = new PHPUnit_TextUI_ResultPrinter(
209 $arguments['verbose'],
210 $arguments['colors'],
216 if (!$this->printer instanceof PHPUnit_Util_Log_TAP &&
217 !self::$versionStringPrinted) {
218 $this->printer->write(
219 PHPUnit_Runner_Version::getVersionString() . "\n\n"
223 foreach ($arguments['listeners'] as $listener) {
224 $result->addListener($listener);
227 $result->addListener($this->printer);
229 if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
230 $result->addListener(new PHPUnit_Util_DeprecatedFeature_Logger);
233 if (isset($arguments['storyHTMLFile'])) {
234 $result->addListener(
235 new PHPUnit_Extensions_Story_ResultPrinter_HTML(
236 $arguments['storyHTMLFile']
241 if (isset($arguments['storyTextFile'])) {
242 $result->addListener(
243 new PHPUnit_Extensions_Story_ResultPrinter_Text(
244 $arguments['storyTextFile']
249 if (isset($arguments['testdoxHTMLFile'])) {
250 $result->addListener(
251 new PHPUnit_Util_TestDox_ResultPrinter_HTML(
252 $arguments['testdoxHTMLFile']
257 if (isset($arguments['testdoxTextFile'])) {
258 $result->addListener(
259 new PHPUnit_Util_TestDox_ResultPrinter_Text(
260 $arguments['testdoxTextFile']
265 if ((isset($arguments['coverageClover']) ||
266 isset($arguments['reportDirectory'])) &&
267 extension_loaded('xdebug')) {
268 $result->collectCodeCoverageInformation(TRUE);
271 if (isset($arguments['logDbus'])) {
272 $result->addListener(new PHPUnit_Util_Log_DBUS);
275 if (isset($arguments['jsonLogfile'])) {
276 $result->addListener(
277 new PHPUnit_Util_Log_JSON($arguments['jsonLogfile'])
281 if (isset($arguments['tapLogfile'])) {
282 $result->addListener(
283 new PHPUnit_Util_Log_TAP($arguments['tapLogfile'])
287 if (isset($arguments['junitLogfile'])) {
288 $result->addListener(
289 new PHPUnit_Util_Log_JUnit(
290 $arguments['junitLogfile'], $arguments['logIncompleteSkipped']
295 if ($arguments['strict']) {
296 $result->strictMode(TRUE);
301 $arguments['filter'],
302 $arguments['groups'],
303 $arguments['excludeGroups'],
304 $arguments['processIsolation']
308 $result->flushListeners();
310 if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
311 $this->printer->printResult($result);
314 if (extension_loaded('tokenizer') && extension_loaded('xdebug')) {
315 if (isset($arguments['coverageClover'])) {
316 $this->printer->write(
317 "\nWriting code coverage data to XML file, this may take " .
321 require_once 'PHP/CodeCoverage/Report/Clover.php';
323 $writer = new PHP_CodeCoverage_Report_Clover;
325 $result->getCodeCoverage(), $arguments['coverageClover']
328 $this->printer->write("\n");
332 if (isset($arguments['reportDirectory'])) {
333 $this->printer->write(
334 "\nGenerating code coverage report, this may take a moment."
339 if (isset($arguments['configuration'])) {
340 $loggingConfiguration = $arguments['configuration']->getLoggingConfiguration();
342 if (isset($loggingConfiguration['title'])) {
343 $title = $loggingConfiguration['title'];
347 require_once 'PHP/CodeCoverage/Report/HTML.php';
349 $writer = new PHP_CodeCoverage_Report_HTML(
352 'charset' => $arguments['reportCharset'],
353 'yui' => $arguments['reportYUI'],
354 'highlight' => $arguments['reportHighlight'],
355 'lowUpperBound' => $arguments['reportLowUpperBound'],
356 'highLowerBound' => $arguments['reportHighLowerBound'],
357 'generator' => ' and PHPUnit ' . PHPUnit_Runner_Version::id()
362 $result->getCodeCoverage(), $arguments['reportDirectory']
365 $this->printer->write("\n");
370 $this->pause($arguments['wait']);
376 * @param boolean $wait
378 protected function pause($wait)
384 if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
385 $this->printer->printWaitPrompt();
392 * @param PHPUnit_TextUI_ResultPrinter $resultPrinter
394 public function setPrinter(PHPUnit_TextUI_ResultPrinter $resultPrinter)
396 $this->printer = $resultPrinter;
400 * Override to define how to handle a failed loading of
403 * @param string $message
405 protected function runFailed($message)
407 self::printVersionString();
408 self::write($message);
409 exit(self::FAILURE_EXIT);
413 * @param string $buffer
414 * @since Method available since Release 3.1.0
416 protected static function write($buffer)
418 if (PHP_SAPI != 'cli') {
419 $buffer = htmlspecialchars($buffer);
426 * Returns the loader to be used.
428 * @return PHPUnit_Runner_TestSuiteLoader
429 * @since Method available since Release 2.2.0
431 public function getLoader()
433 if ($this->loader === NULL) {
434 $this->loader = new PHPUnit_Runner_StandardTestSuiteLoader;
437 return $this->loader;
442 public static function showError($message)
444 self::printVersionString();
445 self::write($message . "\n");
447 exit(self::FAILURE_EXIT);
452 public static function printVersionString()
454 if (!self::$versionStringPrinted) {
455 self::write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
456 self::$versionStringPrinted = TRUE;
461 * @param array $arguments
462 * @since Method available since Release 3.2.1
464 protected function handleConfiguration(array &$arguments)
466 if (isset($arguments['configuration']) &&
467 !$arguments['configuration'] instanceof PHPUnit_Util_Configuration) {
468 $arguments['configuration'] = PHPUnit_Util_Configuration::getInstance(
469 $arguments['configuration']
473 $arguments['debug'] = isset($arguments['debug']) ? $arguments['debug'] : FALSE;
474 $arguments['filter'] = isset($arguments['filter']) ? $arguments['filter'] : FALSE;
475 $arguments['listeners'] = isset($arguments['listeners']) ? $arguments['listeners'] : array();
476 $arguments['wait'] = isset($arguments['wait']) ? $arguments['wait'] : FALSE;
478 if (isset($arguments['configuration'])) {
479 $arguments['configuration']->handlePHPConfiguration();
481 $phpunitConfiguration = $arguments['configuration']->getPHPUnitConfiguration();
483 if (isset($phpunitConfiguration['backupGlobals']) &&
484 !isset($arguments['backupGlobals'])) {
485 $arguments['backupGlobals'] = $phpunitConfiguration['backupGlobals'];
488 if (isset($phpunitConfiguration['backupStaticAttributes']) &&
489 !isset($arguments['backupStaticAttributes'])) {
490 $arguments['backupStaticAttributes'] = $phpunitConfiguration['backupStaticAttributes'];
493 if (isset($phpunitConfiguration['bootstrap']) &&
494 !isset($arguments['bootstrap'])) {
495 $arguments['bootstrap'] = $phpunitConfiguration['bootstrap'];
498 if (isset($phpunitConfiguration['colors']) &&
499 !isset($arguments['colors'])) {
500 $arguments['colors'] = $phpunitConfiguration['colors'];
503 if (isset($phpunitConfiguration['convertErrorsToExceptions']) &&
504 !isset($arguments['convertErrorsToExceptions'])) {
505 $arguments['convertErrorsToExceptions'] = $phpunitConfiguration['convertErrorsToExceptions'];
508 if (isset($phpunitConfiguration['convertNoticesToExceptions']) &&
509 !isset($arguments['convertNoticesToExceptions'])) {
510 $arguments['convertNoticesToExceptions'] = $phpunitConfiguration['convertNoticesToExceptions'];
513 if (isset($phpunitConfiguration['convertWarningsToExceptions']) &&
514 !isset($arguments['convertWarningsToExceptions'])) {
515 $arguments['convertWarningsToExceptions'] = $phpunitConfiguration['convertWarningsToExceptions'];
518 if (isset($phpunitConfiguration['processIsolation']) &&
519 !isset($arguments['processIsolation'])) {
520 $arguments['processIsolation'] = $phpunitConfiguration['processIsolation'];
523 if (isset($phpunitConfiguration['stopOnFailure']) &&
524 !isset($arguments['stopOnFailure'])) {
525 $arguments['stopOnFailure'] = $phpunitConfiguration['stopOnFailure'];
528 if (isset($phpunitConfiguration['strict']) &&
529 !isset($arguments['strict'])) {
530 $arguments['strict'] = $phpunitConfiguration['strict'];
533 if (isset($phpunitConfiguration['verbose']) &&
534 !isset($arguments['verbose'])) {
535 $arguments['verbose'] = $phpunitConfiguration['verbose'];
538 if (isset($phpunitConfiguration['forceCoversAnnotation']) &&
539 !isset($arguments['forceCoversAnnotation'])) {
540 $arguments['forceCoversAnnotation'] = $phpunitConfiguration['forceCoversAnnotation'];
543 if (isset($phpunitConfiguration['mapTestClassNameToCoveredClassName']) &&
544 !isset($arguments['mapTestClassNameToCoveredClassName'])) {
545 $arguments['mapTestClassNameToCoveredClassName'] = $phpunitConfiguration['mapTestClassNameToCoveredClassName'];
548 $groupConfiguration = $arguments['configuration']->getGroupConfiguration();
550 if (!empty($groupConfiguration['include']) &&
551 !isset($arguments['groups'])) {
552 $arguments['groups'] = $groupConfiguration['include'];
555 if (!empty($groupConfiguration['exclude']) &&
556 !isset($arguments['excludeGroups'])) {
557 $arguments['excludeGroups'] = $groupConfiguration['exclude'];
560 foreach ($arguments['configuration']->getListenerConfiguration() as $listener) {
561 if (!class_exists($listener['class'], FALSE) &&
562 $listener['file'] !== '') {
563 $file = PHPUnit_Util_Filesystem::fileExistsInIncludePath(
567 if ($file !== FALSE) {
572 if (class_exists($listener['class'], FALSE)) {
573 if (count($listener['arguments']) == 0) {
574 $listener = new $listener['class'];
576 $listenerClass = new ReflectionClass(
579 $listener = $listenerClass->newInstanceArgs(
580 $listener['arguments']
584 if ($listener instanceof PHPUnit_Framework_TestListener) {
585 $arguments['listeners'][] = $listener;
590 $loggingConfiguration = $arguments['configuration']->getLoggingConfiguration();
592 if (isset($loggingConfiguration['coverage-html']) &&
593 !isset($arguments['reportDirectory'])) {
594 if (isset($loggingConfiguration['charset']) &&
595 !isset($arguments['reportCharset'])) {
596 $arguments['reportCharset'] = $loggingConfiguration['charset'];
599 if (isset($loggingConfiguration['yui']) &&
600 !isset($arguments['reportYUI'])) {
601 $arguments['reportYUI'] = $loggingConfiguration['yui'];
604 if (isset($loggingConfiguration['highlight']) &&
605 !isset($arguments['reportHighlight'])) {
606 $arguments['reportHighlight'] = $loggingConfiguration['highlight'];
609 if (isset($loggingConfiguration['lowUpperBound']) &&
610 !isset($arguments['reportLowUpperBound'])) {
611 $arguments['reportLowUpperBound'] = $loggingConfiguration['lowUpperBound'];
614 if (isset($loggingConfiguration['highLowerBound']) &&
615 !isset($arguments['reportHighLowerBound'])) {
616 $arguments['reportHighLowerBound'] = $loggingConfiguration['highLowerBound'];
619 $arguments['reportDirectory'] = $loggingConfiguration['coverage-html'];
622 if (isset($loggingConfiguration['coverage-clover']) &&
623 !isset($arguments['coverageClover'])) {
624 $arguments['coverageClover'] = $loggingConfiguration['coverage-clover'];
627 if (isset($loggingConfiguration['json']) &&
628 !isset($arguments['jsonLogfile'])) {
629 $arguments['jsonLogfile'] = $loggingConfiguration['json'];
632 if (isset($loggingConfiguration['plain'])) {
633 $arguments['listeners'][] = new PHPUnit_TextUI_ResultPrinter(
634 $loggingConfiguration['plain'], TRUE
638 if (isset($loggingConfiguration['tap']) &&
639 !isset($arguments['tapLogfile'])) {
640 $arguments['tapLogfile'] = $loggingConfiguration['tap'];
643 if (isset($loggingConfiguration['junit']) &&
644 !isset($arguments['junitLogfile'])) {
645 $arguments['junitLogfile'] = $loggingConfiguration['junit'];
647 if (isset($loggingConfiguration['logIncompleteSkipped']) &&
648 !isset($arguments['logIncompleteSkipped'])) {
649 $arguments['logIncompleteSkipped'] = $loggingConfiguration['logIncompleteSkipped'];
653 if (isset($loggingConfiguration['story-html']) &&
654 !isset($arguments['storyHTMLFile'])) {
655 $arguments['storyHTMLFile'] = $loggingConfiguration['story-html'];
658 if (isset($loggingConfiguration['story-text']) &&
659 !isset($arguments['storyTextFile'])) {
660 $arguments['storsTextFile'] = $loggingConfiguration['story-text'];
663 if (isset($loggingConfiguration['testdox-html']) &&
664 !isset($arguments['testdoxHTMLFile'])) {
665 $arguments['testdoxHTMLFile'] = $loggingConfiguration['testdox-html'];
668 if (isset($loggingConfiguration['testdox-text']) &&
669 !isset($arguments['testdoxTextFile'])) {
670 $arguments['testdoxTextFile'] = $loggingConfiguration['testdox-text'];
674 if (isset($arguments['configuration'])) {
675 $filterConfiguration = $arguments['configuration']->getFilterConfiguration();
677 $filter = PHP_CodeCoverage_Filter::getInstance();
679 foreach ($filterConfiguration['blacklist']['include']['directory'] as $dir) {
680 $filter->addDirectoryToBlacklist(
681 $dir['path'], $dir['suffix'], $dir['prefix'], $dir['group']
685 foreach ($filterConfiguration['blacklist']['include']['file'] as $file) {
686 $filter->addFileToBlacklist($file);
689 foreach ($filterConfiguration['blacklist']['exclude']['directory'] as $dir) {
690 $filter->removeDirectoryFromBlacklist(
691 $dir['path'], $dir['suffix'], $dir['prefix'], $dir['group']
695 foreach ($filterConfiguration['blacklist']['exclude']['file'] as $file) {
696 $filter->removeFileFromBlacklist($file);
699 if ((isset($arguments['coverageClover']) ||
700 isset($arguments['reportDirectory'])) &&
701 extension_loaded('xdebug')) {
702 $coverage = PHP_CodeCoverage::getInstance();
704 $coverage->setProcessUncoveredFilesFromWhitelist(
705 $filterConfiguration['whitelist']['addUncoveredFilesFromWhitelist']
708 if (isset($arguments['forceCoversAnnotation'])) {
709 $coverage->setForceCoversAnnotation(
710 $arguments['forceCoversAnnotation']
714 if (isset($arguments['mapTestClassNameToCoveredClassName'])) {
715 $coverage->setMapTestClassNameToCoveredClassName(
716 $arguments['mapTestClassNameToCoveredClassName']
720 foreach ($filterConfiguration['whitelist']['include']['directory'] as $dir) {
721 $filter->addDirectoryToWhitelist(
722 $dir['path'], $dir['suffix'], $dir['prefix']
726 foreach ($filterConfiguration['whitelist']['include']['file'] as $file) {
727 $filter->addFileToWhitelist($file);
730 foreach ($filterConfiguration['whitelist']['exclude']['directory'] as $dir) {
731 $filter->removeDirectoryFromWhitelist(
732 $dir['path'], $dir['suffix'], $dir['prefix']
736 foreach ($filterConfiguration['whitelist']['exclude']['file'] as $file) {
737 $filter->removeFileFromWhitelist($file);
742 $arguments['backupGlobals'] = isset($arguments['backupGlobals']) ? $arguments['backupGlobals'] : NULL;
743 $arguments['backupStaticAttributes'] = isset($arguments['backupStaticAttributes']) ? $arguments['backupStaticAttributes'] : NULL;
744 $arguments['colors'] = isset($arguments['colors']) ? $arguments['colors'] : FALSE;
745 $arguments['convertErrorsToExceptions'] = isset($arguments['convertErrorsToExceptions']) ? $arguments['convertErrorsToExceptions'] : TRUE;
746 $arguments['convertNoticesToExceptions'] = isset($arguments['convertNoticesToExceptions']) ? $arguments['convertNoticesToExceptions'] : TRUE;
747 $arguments['convertWarningsToExceptions'] = isset($arguments['convertWarningsToExceptions']) ? $arguments['convertWarningsToExceptions'] : TRUE;
748 $arguments['excludeGroups'] = isset($arguments['excludeGroups']) ? $arguments['excludeGroups'] : array();
749 $arguments['groups'] = isset($arguments['groups']) ? $arguments['groups'] : array();
750 $arguments['logIncompleteSkipped'] = isset($arguments['logIncompleteSkipped']) ? $arguments['logIncompleteSkipped'] : FALSE;
751 $arguments['processIsolation'] = isset($arguments['processIsolation']) ? $arguments['processIsolation'] : FALSE;
752 $arguments['repeat'] = isset($arguments['repeat']) ? $arguments['repeat'] : FALSE;
753 $arguments['reportCharset'] = isset($arguments['reportCharset']) ? $arguments['reportCharset'] : 'UTF-8';
754 $arguments['reportHighlight'] = isset($arguments['reportHighlight']) ? $arguments['reportHighlight'] : FALSE;
755 $arguments['reportHighLowerBound'] = isset($arguments['reportHighLowerBound']) ? $arguments['reportHighLowerBound'] : 70;
756 $arguments['reportLowUpperBound'] = isset($arguments['reportLowUpperBound']) ? $arguments['reportLowUpperBound'] : 35;
757 $arguments['reportYUI'] = isset($arguments['reportYUI']) ? $arguments['reportYUI'] : TRUE;
758 $arguments['stopOnError'] = isset($arguments['stopOnError']) ? $arguments['stopOnError'] : FALSE;
759 $arguments['stopOnFailure'] = isset($arguments['stopOnFailure']) ? $arguments['stopOnFailure'] : FALSE;
760 $arguments['stopOnIncomplete'] = isset($arguments['stopOnIncomplete']) ? $arguments['stopOnIncomplete'] : FALSE;
761 $arguments['stopOnSkipped'] = isset($arguments['stopOnSkipped']) ? $arguments['stopOnSkipped'] : FALSE;
762 $arguments['strict'] = isset($arguments['strict']) ? $arguments['strict'] : FALSE;
763 $arguments['verbose'] = isset($arguments['verbose']) ? $arguments['verbose'] : FALSE;
765 if ($arguments['filter'] !== FALSE &&
766 preg_match('/^[a-zA-Z0-9_]/', $arguments['filter'])) {
767 // Escape delimiters in regular expression. Do NOT use preg_quote,
768 // to keep magic characters.
769 $arguments['filter'] = '/' . str_replace(
770 '/', '\\/', $arguments['filter']