/**
  * @param  PHPUnit_Framework_Test $suite
  * @param  array                   $parameters
  * @return PHPUnit_Framework_TestResult
  * @access public
  */
 public function doRun(PHPUnit_Framework_Test $suite, array $parameters = array())
 {
     $parameters['repeat'] = isset($parameters['repeat']) ? $parameters['repeat'] : FALSE;
     $parameters['filter'] = isset($parameters['filter']) ? $parameters['filter'] : FALSE;
     $parameters['verbose'] = isset($parameters['verbose']) ? $parameters['verbose'] : FALSE;
     if (is_integer($parameters['repeat'])) {
         $suite = new PHPUnit_Extensions_RepeatedTest($suite, $parameters['repeat']);
     }
     if (isset($parameters['reportDirectory'])) {
         $parameters['reportDirectory'] = $this->getDirectory($parameters['reportDirectory']);
     }
     $result = $this->createTestResult();
     if ($this->printer === NULL) {
         $this->printer = $parameters['xml'] ? new CopixTestXMLPrinter(NULL, $parameters['verbose']) : new CopixTestPrinter(NULL, $parameters['verbose']);
     }
     $result->addListener($this->printer);
     if (isset($parameters['testdoxHTMLFile'])) {
         $result->addListener(PHPUnit_Util_TestDox_ResultPrinter::factory('HTML', $parameters['testdoxHTMLFile']));
     }
     if (isset($parameters['testdoxTextFile'])) {
         $result->addListener(PHPUnit_Util_TestDox_ResultPrinter::factory('Text', $parameters['testdoxTextFile']));
     }
     if (isset($parameters['graphvizLogfile'])) {
         if (class_exists('Image_GraphViz', FALSE) && class_exists('PHPUnit_Util_Log_GraphViz', FALSE)) {
             $result->addListener(new PHPUnit_Util_Log_GraphViz($parameters['graphvizLogfile']));
         }
     }
     if (isset($parameters['reportDirectory']) && extension_loaded('xdebug')) {
         if (class_exists('Image_GraphViz', FALSE) && class_exists('PHPUnit_Util_Report_GraphViz', FALSE)) {
             $result->addListener(new PHPUnit_Util_Report_GraphViz($parameters['reportDirectory']));
         }
         $result->collectCodeCoverageInformation(TRUE);
     }
     if (isset($parameters['jsonLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JSON($parameters['jsonLogfile']));
     }
     if (isset($parameters['tapLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_TAP($parameters['tapLogfile']));
     }
     if (isset($parameters['xmlLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_XML($parameters['xmlLogfile']));
     }
     $suite->run($result, $parameters['filter']);
     $result->flushListeners();
     if (isset($parameters['reportDirectory']) && extension_loaded('xdebug')) {
         $this->printer->codeCoverage($parameters['reportDirectory']);
         PHPUnit_Util_Report::render($result, $parameters['reportDirectory']);
     } else {
         $this->printer->codeCoverage(false);
     }
     if ($this->printer) {
         $this->printer->printResult($result);
     }
     return $result;
 }