function run() { $res = NULL; if (PHPUnitUtil::$installedVersion == 3) { require_once 'PHPUnit/Framework/TestSuite.php'; $res = new PHPUnit_Framework_TestResult(); } else { require_once 'PHPUnit2/Framework/TestSuite.php'; $res = new PHPUnit2_Framework_TestResult(); } if ($this->codecoverage) { $res->collectCodeCoverageInformation(TRUE); } foreach ($this->formatters as $formatter) { $res->addListener($formatter); } $this->suite->run($res); if ($this->codecoverage) { $coverageInformation = $res->getCodeCoverageInformation(); if (PHPUnitUtil::$installedVersion == 3) { CoverageMerger::merge($this->project, array($coverageInformation[0]['files'])); } else { CoverageMerger::merge($this->project, $coverageInformation); } } if ($res->errorCount() != 0) { $this->retCode = self::ERRORS; } else { if ($res->failureCount() != 0 || $res->notImplementedCount() != 0) { $this->retCode = self::FAILURES; } } }
function run() { $result = new PHPUnit2_Framework_TestResult(); $result->addListener($this->formatter); $this->suite->run($result); return $result; }
function run() { $res = new PHPUnit2_Framework_TestResult(); if ($this->codecoverage) { $res->collectCodeCoverageInformation(TRUE); } foreach ($this->formatters as $formatter) { $res->addListener($formatter); } $this->suite->run($res); if ($this->codecoverage) { CoverageMerger::merge($this->project, $res->getCodeCoverageInformation()); } if ($res->errorCount() != 0) { $this->retCode = self::ERRORS; } else { if ($res->failureCount() != 0 || $res->notImplementedCount() != 0) { $this->retCode = self::FAILURES; } } }
/** * @param PHPUnit2_Framework_TestResult $result * @param mixed $coverageDataFile * @param mixed $coverageHTMLFile * @param mixed $coverageTextFile * @access protected * @since Method available since Release 2.1.0 */ protected function handleCodeCoverageInformation(PHPUnit2_Framework_TestResult $result, $coverageDataFile, $coverageHTMLFile, $coverageTextFile) { if ($coverageDataFile !== FALSE && ($fp = fopen($coverageDataFile, 'w'))) { fputs($fp, serialize($result->getCodeCoverageInformation())); fclose($fp); } if ($coverageHTMLFile !== FALSE || $coverageTextFile !== FALSE) { require_once 'PHPUnit2/Util/CodeCoverage/Renderer.php'; if ($coverageHTMLFile !== FALSE) { $renderer = PHPUnit2_Util_CodeCoverage_Renderer::factory('HTML', $result->getCodeCoverageInformation()); $renderer->renderToFile($coverageHTMLFile); } if ($coverageTextFile !== FALSE) { $renderer = PHPUnit2_Util_CodeCoverage_Renderer::factory('Text', $result->getCodeCoverageInformation()); $renderer->renderToFile($coverageTextFile); } } }
/** * @param PHPUnit2_Framework_TestResult $result * @access protected */ protected function printFooter(PHPUnit2_Framework_TestResult $result) { if ($result->allCompletlyImplemented() && $result->wasSuccessful()) { $this->write(sprintf("\nOK (%d test%s)\n", $result->runCount(), $result->runCount() == 1 ? '' : 's')); } else { if (!$result->allCompletlyImplemented() && $result->wasSuccessful()) { $this->write(sprintf("\nOK, but incomplete test cases!!!\nTests run: %d, Incomplete Tests: %d.\n", $result->runCount(), $result->notImplementedCount())); } else { $this->write(sprintf("\nFAILURES!!!\nTests run: %d, Failures: %d, Errors: %d, Incomplete Tests: %d.\n", $result->runCount(), $result->failureCount(), $result->errorCount(), $result->notImplementedCount())); } } }