/**
  * The main entry point
  *
  * @throws BuildException
  */
 public function main()
 {
     $suite = new TestSuite();
     $filenames = $this->getFilenames();
     foreach ($filenames as $testfile) {
         $suite->addFile($testfile);
     }
     if ($this->debug) {
         $fe = new SimpleTestFormatterElement();
         $fe->setType('debug');
         $fe->setUseFile(false);
         $this->formatters[] = $fe;
     }
     if ($this->printsummary) {
         $fe = new SimpleTestFormatterElement();
         $fe->setType('summary');
         $fe->setUseFile(false);
         $this->formatters[] = $fe;
     }
     foreach ($this->formatters as $fe) {
         $formatter = $fe->getFormatter();
         $formatter->setProject($this->getProject());
         if ($fe->getUseFile()) {
             $destFile = new PhingFile($fe->getToDir(), $fe->getOutfile());
             $writer = new FileWriter($destFile->getAbsolutePath());
             $formatter->setOutput($writer);
         } else {
             $formatter->setOutput($this->getDefaultOutput());
         }
     }
     $this->execute($suite);
     if ($this->testfailed && $this->formatters[0]->getFormatter() instanceof SimpleTestDebugResultFormatter) {
         $this->getDefaultOutput()->write("Failed tests: ");
         $this->formatters[0]->getFormatter()->printFailingTests();
     }
     if ($this->testfailed) {
         throw new BuildException("One or more tests failed");
     }
 }
 /**
  * The main entry point
  *
  * @throws BuildException
  */
 function main()
 {
     $group = new GroupTest();
     $filenames = $this->getFilenames();
     foreach ($filenames as $testfile) {
         $group->addTestFile($testfile);
     }
     if ($this->printsummary) {
         $fe = new SimpleTestFormatterElement();
         $fe->setType('summary');
         $fe->setUseFile(false);
         $this->formatters[] = $fe;
     }
     foreach ($this->formatters as $fe) {
         $formatter = $fe->getFormatter();
         $formatter->setProject($this->getProject());
         if ($fe->getUseFile()) {
             $destFile = new PhingFile($fe->getToDir(), $fe->getOutfile());
             $writer = new FileWriter($destFile->getAbsolutePath());
             $formatter->setOutput($writer);
         } else {
             $formatter->setOutput($this->getDefaultOutput());
         }
     }
     $this->execute($group);
     if ($this->testfailed) {
         throw new BuildException("One or more tests failed");
     }
 }