diff options
Diffstat (limited to 'buildscripts/phing/classes/phing/tasks/ext/simpletest/SimpleTestTask.php')
-rw-r--r-- | buildscripts/phing/classes/phing/tasks/ext/simpletest/SimpleTestTask.php | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/buildscripts/phing/classes/phing/tasks/ext/simpletest/SimpleTestTask.php b/buildscripts/phing/classes/phing/tasks/ext/simpletest/SimpleTestTask.php index 6aede68f..e32c31c6 100644 --- a/buildscripts/phing/classes/phing/tasks/ext/simpletest/SimpleTestTask.php +++ b/buildscripts/phing/classes/phing/tasks/ext/simpletest/SimpleTestTask.php @@ -41,6 +41,7 @@ class SimpleTestTask extends Task private $errorproperty; private $printsummary = false; private $testfailed = false; + private $filesets=array(); /** * Initialize Task. @@ -49,29 +50,24 @@ class SimpleTestTask extends Task * because we may want this class to be loaded w/o triggering an error. */ function init() { - @include_once 'simpletest/scorer.php'; - + if (!class_exists('SimpleReporter')) { throw new BuildException("SimpleTestTask depends on SimpleTest package being installed.", $this->getLocation()); } - - require_once 'simpletest/reporter.php'; - require_once 'simpletest/xml.php'; - require_once 'simpletest/test_case.php'; require_once 'phing/tasks/ext/simpletest/SimpleTestCountResultFormatter.php'; require_once 'phing/tasks/ext/simpletest/SimpleTestFormatterElement.php'; } - + function setFailureproperty($value) { $this->failureproperty = $value; } - + function setErrorproperty($value) { $this->errorproperty = $value; } - + function setHaltonerror($value) { $this->haltonerror = $value; @@ -86,7 +82,7 @@ class SimpleTestTask extends Task { $this->printsummary = $printsummary; } - + /** * Add a new formatter to all tests of this task. * @@ -144,14 +140,14 @@ class SimpleTestTask extends Task function main() { $group = new GroupTest(); - + $filenames = $this->getFilenames(); - + foreach ($filenames as $testfile) { $group->addTestFile($testfile); } - + if ($this->printsummary) { $fe = new SimpleTestFormatterElement(); @@ -159,7 +155,7 @@ class SimpleTestTask extends Task $fe->setUseFile(false); $this->formatters[] = $fe; } - + foreach ($this->formatters as $fe) { $formatter = $fe->getFormatter(); @@ -168,7 +164,7 @@ class SimpleTestTask extends Task if ($fe->getUseFile()) { $destFile = new PhingFile($fe->getToDir(), $fe->getOutfile()); - + $writer = new FileWriter($destFile->getAbsolutePath()); $formatter->setOutput($writer); @@ -178,39 +174,39 @@ class SimpleTestTask extends Task $formatter->setOutput($this->getDefaultOutput()); } } - + $this->execute($group); - + if ($this->testfailed) { throw new BuildException("One or more tests failed"); } } - + private function execute($suite) { $counter = new SimpleTestCountResultFormatter(); $reporter = new MultipleReporter(); $reporter->attachReporter($counter); - + foreach ($this->formatters as $fe) { $formatter = $fe->getFormatter(); $reporter->attachReporter($formatter); - } - + } + $suite->run($reporter); - + $retcode = $counter->getRetCode(); - + if ($retcode == SimpleTestCountResultFormatter::ERRORS) { if ($this->errorproperty) { $this->project->setNewProperty($this->errorproperty, true); } - + if ($this->haltonerror) { $this->testfailed = true; @@ -222,7 +218,7 @@ class SimpleTestTask extends Task { $this->project->setNewProperty($this->failureproperty, true); } - + if ($this->haltonfailure) { $this->testfailed = true; |