123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- require_once(dirname(__FILE__) . '/xml.php');
- require_once(dirname(__FILE__) . '/shell_tester.php');
- class DetachedTestCase {
- var $_command;
- var $_dry_command;
- var $_size;
-
- function DetachedTestCase($command, $dry_command = false) {
- $this->_command = $command;
- $this->_dry_command = $dry_command ? $dry_command : $command;
- $this->_size = false;
- }
-
- function getLabel() {
- return $this->_command;
- }
-
- 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;
- }
-
- 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;
- }
-
- function &_createParser(&$reporter) {
- return new SimpleTestXmlParser($reporter);
- }
- }
- ?>
|