Beispiel #1
0
 /**
  * Runs a test.
  *
  * @param  PHPUnit2_Framework_Test        $test
  * @param  PHPUnit2_Framework_TestResult  $testResult
  * @access public
  */
 public function runTest(PHPUnit2_Framework_Test $test, PHPUnit2_Framework_TestResult $result)
 {
     $test->run($result);
 }
 /**
  * @param  PHPUnit2_Framework_Test $suite
  * @param  boolean                 $wait
  * @return PHPUnit2_Framework_TestResult
  * @access public
  */
 public function doRun(PHPUnit2_Framework_Test $suite, $wait = false)
 {
     $result = $this->createTestResult();
     if ($this->printer === null) {
         $this->printer = new PHPUnit2_TextUI_ResultPrinter();
     }
     $this->printer->write(PHPUnit2_Runner_Version::getVersionString() . "\n\n");
     $result->addListener($this->printer);
     if (class_exists('Benchmark_Timer')) {
         $timer = new Benchmark_Timer();
     }
     if (isset($timer)) {
         $timer->start();
     }
     $suite->run($result);
     if (isset($timer)) {
         $timer->stop();
         $timeElapsed = $timer->timeElapsed();
     } else {
         $timeElapsed = false;
     }
     $this->pause($wait);
     $this->printer->printResult($result, $timeElapsed);
     return $result;
 }
Beispiel #3
0
 /**
  * @param  PHPUnit2_Framework_Test $suite
  * @param  mixed                   $coverageDataFile
  * @param  mixed                   $coverageHTMLFile
  * @param  mixed                   $coverageTextFile
  * @param  mixed                   $testdoxHTMLFile
  * @param  mixed                   $testdoxTextFile
  * @param  mixed                   $xmlLogfile
  * @param  boolean                 $wait
  * @return PHPUnit2_Framework_TestResult
  * @access public
  */
 public function doRun(PHPUnit2_Framework_Test $suite, $coverageDataFile = FALSE, $coverageHTMLFile = FALSE, $coverageTextFile = FALSE, $testdoxHTMLFile = FALSE, $testdoxTextFile = FALSE, $xmlLogfile = FALSE, $wait = FALSE)
 {
     $result = $this->createTestResult();
     $timer = new Benchmark_Timer();
     if ($this->printer === NULL) {
         $this->printer = new PHPUnit2_TextUI_ResultPrinter();
     }
     $this->printer->write(PHPUnit2_Runner_Version::getVersionString() . "\n\n");
     $result->addListener($this->printer);
     if ($testdoxHTMLFile !== FALSE || $testdoxTextFile !== FALSE) {
         require_once 'PHPUnit2/Util/TestDox/ResultPrinter.php';
         if ($testdoxHTMLFile !== FALSE) {
             $result->addListener(PHPUnit2_Util_TestDox_ResultPrinter::factory('HTML', $testdoxHTMLFile));
         }
         if ($testdoxTextFile !== FALSE) {
             $result->addListener(PHPUnit2_Util_TestDox_ResultPrinter::factory('Text', $testdoxTextFile));
         }
     }
     if ($xmlLogfile !== FALSE) {
         require_once 'PHPUnit2/Util/Log/XML.php';
         $result->addListener(new PHPUnit2_Util_Log_XML($xmlLogfile));
     }
     if ($coverageDataFile !== FALSE || $coverageHTMLFile !== FALSE || $coverageTextFile !== FALSE) {
         $result->collectCodeCoverageInformation(TRUE);
     }
     $timer->start();
     $suite->run($result);
     $timer->stop();
     $timeElapsed = $timer->timeElapsed();
     $this->pause($wait);
     $this->printer->printResult($result, $timeElapsed);
     $this->handleCodeCoverageInformation($result, $coverageDataFile, $coverageHTMLFile, $coverageTextFile);
     return $result;
 }