123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
-
-
-
- require_once(dirname(__FILE__) . '/xml.php');
- require_once(dirname(__FILE__) . '/shell_tester.php');
-
-
-
- class DetachedTestCase {
- private $command;
- private $dry_command;
- private $size;
-
-
-
- function __construct($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;
- }
-
-
-
- protected function &createParser(&$reporter) {
- return new SimpleTestXmlParser($reporter);
- }
- }
- ?>
|