diff options
Diffstat (limited to 'modules/simpletest/default_reporter.php')
-rw-r--r-- | modules/simpletest/default_reporter.php | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/modules/simpletest/default_reporter.php b/modules/simpletest/default_reporter.php deleted file mode 100644 index 8a760353d..000000000 --- a/modules/simpletest/default_reporter.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -// $Id$ - -/** - * Parser for command line arguments. Extracts - * the a specific test to run and engages XML - * reporting when necessary. - */ -class SimpleCommandLineParser { - protected $to_property = array('c' => 'case', 't' => 'test'); - protected $case = ''; - protected $test = ''; - protected $xml = false; - - function SimpleCommandLineParser($arguments) { - if (!is_array($arguments)) { - return; - } - foreach ($arguments as $i => $argument) { - if (preg_match('/^--?(test|case|t|c)=(.+)$/', $argument, $matches)) { - $this->{$this->_parseProperty($matches[1])} = $matches[2]; - } - elseif (preg_match('/^--?(test|case|t|c)$/', $argument, $matches)) { - if (isset($arguments[$i + 1])) { - $this->{$this->_parseProperty($matches[1])} = $arguments[$i + 1]; - } - } - elseif (preg_match('/^--?(xml|x)$/', $argument)) { - $this->xml = true; - } - } - } - function _parseProperty($property) { - if (isset($this->to_property[$property])) { - return $this->to_property[$property]; - } - else { - return $property; - } - } - function getTest() { - return $this->test; - } - - function getTestCase() { - return $this->case; - } - - function isXml() { - return $this->xml; - } -} - -/** - * The default reporter used by SimpleTest's autorun - * feature. The actual reporters used are dependency - * injected and can be overridden. - */ -class DefaultReporter extends SimpleReporterDecorator { - /** - * Assembles the appopriate reporter for the environment. - */ - function DefaultReporter() { - if (SimpleReporter::inCli()) { - global $argv; - $parser = new SimpleCommandLineParser($argv); - $interfaces = $parser->isXml() ? array('XmlReporter') : array('TextReporter'); - $reporter = &new SelectiveReporter(SimpleTest::preferred($interfaces), $parser->getTestCase(), $parser->getTest()); - } - else { - $reporter = &new SelectiveReporter(SimpleTest::preferred('HtmlReporter'), @$_GET['c'], @$_GET['t']); - } - $this->SimpleReporterDecorator($reporter); - } -} |