From af68030fcf0c266300feb2c100149ecadef7d364 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 16 Jul 2006 01:50:23 +0000 Subject: Merge from 3.0 branch till 1264. --- tests/test_tools/simpletest/detached.php | 96 ++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 tests/test_tools/simpletest/detached.php (limited to 'tests/test_tools/simpletest/detached.php') diff --git a/tests/test_tools/simpletest/detached.php b/tests/test_tools/simpletest/detached.php new file mode 100644 index 00000000..00f08880 --- /dev/null +++ b/tests/test_tools/simpletest/detached.php @@ -0,0 +1,96 @@ +_command = $command; + $this->_dry_command = $dry_command ? $dry_command : $command; + $this->_size = false; + } + + /** + * Accessor for the test name for subclasses. + * @return string Name of the test. + * @access public + */ + function getLabel() { + return $this->_command; + } + + /** + * Runs the top level test for this class. Currently + * reads the data as a single chunk. I'll fix this + * once I have added iteration to the browser. + * @param SimpleReporter $reporter Target of test results. + * @returns boolean True if no failures. + * @access public + */ + function run($reporter) { + $shell = new SimpleShell(); + $shell->execute($this->_command); + $parser = $this->_createParser($reporter); + if (! $parser->parse($shell->getOutput())) { + trigger_error('Cannot parse incoming XML from [' . $this->_command . ']'); + return false; + } + return true; + } + + /** + * Accessor for the number of subtests. + * @return integer Number of test cases. + * @access public + */ + function getSize() { + if ($this->_size === false) { + $shell = new SimpleShell(); + $shell->execute($this->_dry_command); + $reporter = new SimpleReporter(); + $parser = $this->_createParser($reporter); + if (! $parser->parse($shell->getOutput())) { + trigger_error('Cannot parse incoming XML from [' . $this->_dry_command . ']'); + return false; + } + $this->_size = $reporter->getTestCaseCount(); + } + return $this->_size; + } + + /** + * Creates the XML parser. + * @param SimpleReporter $reporter Target of test results. + * @return SimpleTestXmlListener XML reader. + * @access protected + */ + function &_createParser($reporter) { + return new SimpleTestXmlParser($reporter); + } + } +?> \ No newline at end of file -- cgit v1.2.3