当前位置: 首页>>代码示例>>PHP>>正文


PHP PHP_CodeCoverage_Report_PHP类代码示例

本文整理汇总了PHP中PHP_CodeCoverage_Report_PHP的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeCoverage_Report_PHP类的具体用法?PHP PHP_CodeCoverage_Report_PHP怎么用?PHP PHP_CodeCoverage_Report_PHP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PHP_CodeCoverage_Report_PHP类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __destruct

 /**
  * Save report
  */
 public function __destruct()
 {
     if ($this->_coverage) {
         $this->_coverage->stop();
         $report = new PHP_CodeCoverage_Report_PHP();
         $report->process($this->_coverage, $this->_covResult);
     }
 }
开发者ID:JBZoo,项目名称:CrossCMS,代码行数:11,代码来源:fake-index.php

示例2: it_should_run_all_reports

 function it_should_run_all_reports(\PHP_CodeCoverage $coverage, \PHP_CodeCoverage_Report_Clover $clover, \PHP_CodeCoverage_Report_PHP $php, SuiteEvent $event, IO $io)
 {
     $reports = array('clover' => $clover, 'php' => $php);
     $this->beConstructedWith($coverage, $reports);
     $this->setOptions(array('format' => array('clover', 'php'), 'output' => array('clover' => 'coverage.xml', 'php' => 'coverage.php')));
     $this->setIO($io);
     $clover->process($coverage, 'coverage.xml')->shouldBeCalled();
     $php->process($coverage, 'coverage.php')->shouldBeCalled();
     $this->afterSuite($event);
 }
开发者ID:Jvbzephir,项目名称:PhpSpecCodeCoverageExtension,代码行数:10,代码来源:CodeCoverageListenerSpec.php

示例3: main


//.........这里部分代码省略.........
     $input->registerOption(new \ezcConsoleOption('h', 'help', \ezcConsoleInput::TYPE_NONE, NULL, FALSE, '', '', array(), array(), FALSE, FALSE, TRUE));
     $input->registerOption(new \ezcConsoleOption('v', 'version', \ezcConsoleInput::TYPE_NONE, NULL, FALSE, '', '', array(), array(), FALSE, FALSE, TRUE));
     try {
         $input->process();
     } catch (ezcConsoleOptionException $e) {
         print $e->getMessage() . "\n";
         exit(1);
     }
     if ($input->getOption('help')->value) {
         $this->showHelp();
         exit(0);
     } else {
         if ($input->getOption('version')->value) {
             $this->printVersionString();
             exit(0);
         }
     }
     $arguments = $input->getArguments();
     $clover = $input->getOption('clover')->value;
     $configuration = $input->getOption('configuration')->value;
     $html = $input->getOption('html')->value;
     $php = $input->getOption('php')->value;
     $text = $input->getOption('text')->value;
     $blacklist = $input->getOption('blacklist')->value;
     $whitelist = $input->getOption('whitelist')->value;
     $addUncovered = $input->getOption('add-uncovered')->value;
     $processUncovered = $input->getOption('process-uncovered')->value;
     $merge = $input->getOption('merge')->value;
     $coverage = new \PHP_CodeCoverage();
     $filter = $coverage->filter();
     if ($configuration) {
         $this->handleConfiguration($configuration, $coverage);
     }
     if (count($arguments) == 1) {
         $this->printVersionString();
         if (empty($whitelist)) {
             $c = new \ReflectionClass('ezcBase');
             $filter->addDirectoryToBlacklist(dirname($c->getFileName()));
             $c = new \ReflectionClass('ezcConsoleInput');
             $filter->addDirectoryToBlacklist(dirname($c->getFileName()));
             foreach ($blacklist as $item) {
                 if (is_dir($item)) {
                     $filter->addDirectoryToBlacklist($item);
                 } else {
                     if (is_file($item)) {
                         $filter->addFileToBlacklist($item);
                     }
                 }
             }
         } else {
             $coverage->setAddUncoveredFilesFromWhitelist($addUncovered);
             $coverage->setProcessUncoveredFilesFromWhitelist($processUncovered);
             foreach ($whitelist as $item) {
                 if (is_dir($item)) {
                     $filter->addDirectoryToWhitelist($item);
                 } else {
                     if (is_file($item)) {
                         $filter->addFileToWhitelist($item);
                     }
                 }
             }
         }
         if (!$merge) {
             $coverage->start('phpcov');
             require $arguments[0];
             $coverage->stop();
         } else {
             $facade = new \File_Iterator_Facade();
             $files = $facade->getFilesAsArray($arguments[0], '.cov');
             foreach ($files as $file) {
                 $coverage->merge(unserialize(file_get_contents($file)));
             }
         }
         if ($clover) {
             print "\nGenerating code coverage report in Clover XML format ...";
             $writer = new \PHP_CodeCoverage_Report_Clover();
             $writer->process($coverage, $clover);
             print " done\n";
         }
         if ($html) {
             print "\nGenerating code coverage report in HTML format ...";
             $writer = new \PHP_CodeCoverage_Report_HTML();
             $writer->process($coverage, $html);
             print " done\n";
         }
         if ($php) {
             print "\nGenerating code coverage report in PHP format ...";
             $writer = new \PHP_CodeCoverage_Report_PHP();
             $writer->process($coverage, $php);
             print " done\n";
         }
         if ($text) {
             $writer = new \PHP_CodeCoverage_Report_Text();
             $writer->process($coverage, $text);
         }
     } else {
         $this->showHelp();
         exit(1);
     }
 }
开发者ID:eanoriega20,项目名称:monedasZend,代码行数:101,代码来源:Command.php

示例4: function

  * When a runner starts out of process, create a new coverage
  * object.
  */
 $emitter->on('runner.start', function () use($covered) {
     $covered(function ($token, \PHP_CodeCoverage $coverage) {
         $coverage->filter()->addDirectoryToWhitelist(__DIR__ . '/src');
         $coverage->start($token);
     });
 });
 /**
  * When a runner ends out of process, write it to a temp file.
  */
 $emitter->on('runner.end', function () use($covered) {
     $covered(function ($token, \PHP_CodeCoverage $coverage) {
         $coverage->stop();
         $writer = new \PHP_CodeCoverage_Report_PHP();
         $file = tempnam(sys_get_temp_dir(), "PCC_{$token}_");
         $writer->process($coverage, $file);
     });
 });
 /**
  * When peridot ends in the main process, we aggregate all of our code coverage
  * results.
  */
 $emitter->on('peridot.end', function () use($coverageType, $coverageFiles, $hhvm) {
     if (!$coverageType || $hhvm) {
         return;
     }
     $coverages = [];
     $files = $coverageFiles();
     foreach ($files as $file) {
开发者ID:peridot-php,项目名称:peridot-concurrency,代码行数:31,代码来源:peridot.php

示例5: doRun


//.........这里部分代码省略.........
     }
     if (!$this->printer instanceof PHPUnit_Util_Log_TAP && !self::$versionStringPrinted) {
         $this->printer->write(PHPUnit_Runner_Version::getVersionString() . "\n\n");
         if (isset($arguments['configuration'])) {
             $this->printer->write(sprintf("Configuration read from %s\n\n", $arguments['configuration']->getFilename()));
         }
     }
     foreach ($arguments['listeners'] as $listener) {
         $result->addListener($listener);
     }
     $result->addListener($this->printer);
     if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
         $result->addListener(new PHPUnit_Util_DeprecatedFeature_Logger());
     }
     if (isset($arguments['testdoxHTMLFile'])) {
         $result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
     }
     if (isset($arguments['testdoxTextFile'])) {
         $result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
     }
     if ((isset($arguments['coverageClover']) || isset($arguments['reportDirectory']) || isset($arguments['coveragePHP']) || isset($arguments['coverageText'])) && extension_loaded('xdebug')) {
         $codeCoverage = new PHP_CodeCoverage(NULL, $this->codeCoverageFilter);
         $codeCoverage->setProcessUncoveredFilesFromWhitelist($arguments['addUncoveredFilesFromWhitelist']);
         if (isset($arguments['cacheTokens'])) {
             $codeCoverage->setCacheTokens($arguments['cacheTokens']);
         }
         if (isset($arguments['forceCoversAnnotation'])) {
             $codeCoverage->setForceCoversAnnotation($arguments['forceCoversAnnotation']);
         }
         if (isset($arguments['mapTestClassNameToCoveredClassName'])) {
             $codeCoverage->setMapTestClassNameToCoveredClassName($arguments['mapTestClassNameToCoveredClassName']);
         }
         $result->setCodeCoverage($codeCoverage);
     }
     if (isset($arguments['jsonLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
     }
     if (isset($arguments['tapLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
     }
     if (isset($arguments['junitLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
     }
     if ($arguments['strict']) {
         $result->strictMode(TRUE);
         $result->setTimeoutForSmallTests($arguments['timeoutForSmallTests']);
         $result->setTimeoutForMediumTests($arguments['timeoutForMediumTests']);
         $result->setTimeoutForLargeTests($arguments['timeoutForLargeTests']);
     }
     $suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     unset($suite);
     $result->flushListeners();
     if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
         $this->printer->printResult($result);
     }
     if (isset($codeCoverage)) {
         $title = '';
         if (isset($arguments['configuration'])) {
             $loggingConfiguration = $arguments['configuration']->getLoggingConfiguration();
             if (isset($loggingConfiguration['title'])) {
                 $title = $loggingConfiguration['title'];
             }
         }
         if (isset($arguments['coverageClover'])) {
             $this->printer->write("\nWriting code coverage data to XML file, this may take " . 'a moment.');
             $writer = new PHP_CodeCoverage_Report_Clover();
             $writer->process($codeCoverage, $arguments['coverageClover']);
             $this->printer->write("\n");
             unset($writer);
         }
         if (isset($arguments['reportDirectory'])) {
             $this->printer->write("\nGenerating code coverage report, this may take a moment.");
             $writer = new PHP_CodeCoverage_Report_HTML($title, $arguments['reportCharset'], $arguments['reportYUI'], $arguments['reportHighlight'], $arguments['reportLowUpperBound'], $arguments['reportHighLowerBound'], ' and PHPUnit ' . PHPUnit_Runner_Version::id());
             $writer->process($codeCoverage, $arguments['reportDirectory']);
             $this->printer->write("\n");
             unset($writer);
         }
         if (isset($arguments['coveragePHP'])) {
             $this->printer->write("\nSerializing PHP_CodeCoverage object to file, this may take a moment.");
             $writer = new PHP_CodeCoverage_Report_PHP();
             $writer->process($codeCoverage, $arguments['coveragePHP']);
             $this->printer->write("\n");
             unset($writer);
         }
         if (isset($arguments['coverageText'])) {
             $this->printer->write("\nGenerating textual code coverage report, this may take a moment.");
             if ($arguments['coverageText'] == 'php://stdout') {
                 $outputStream = $this->printer;
                 $colors = (bool) $arguments['colors'];
             } else {
                 $outputStream = new PHPUnit_Util_Printer($arguments['coverageText']);
                 $colors = FALSE;
             }
             $writer = new PHP_CodeCoverage_Report_Text($outputStream, $title, $arguments['reportLowUpperBound'], $arguments['reportHighLowerBound'], $arguments['coverageTextShowUncoveredFiles']);
             $writer->process($codeCoverage, $colors);
             $this->printer->write("\n");
         }
     }
     return $result;
 }
开发者ID:DaveNascimento,项目名称:civicrm-packages,代码行数:101,代码来源:TestRunner.php

示例6: printPHP

 protected function printPHP()
 {
     $writer = new \PHP_CodeCoverage_Report_PHP();
     $writer->process(self::$coverage, $this->absolutePath($this->options['coverage']));
 }
开发者ID:Eli-TW,项目名称:Codeception,代码行数:5,代码来源:Printer.php

示例7: shutdown

 public function shutdown(PHP_CodeCoverage $coverage)
 {
     $coverage->stop();
     $writer = new PHP_CodeCoverage_Report_PHP();
     $writer->process($coverage, __DIR__ . '/../../../build/logs/clover-child.cov');
 }
开发者ID:tiagobutzke,项目名称:phparallel,代码行数:6,代码来源:CoverageCollectorThread.php

示例8: php

 /**
  * Generate php coverage report
  * @param string $target Report filename
  */
 public function php($target)
 {
     $php = new \PHP_CodeCoverage_Report_PHP();
     $php->process($this->coverage, $target);
 }
开发者ID:brianium,项目名称:paratest,代码行数:9,代码来源:CoverageReporterLegacy.php

示例9: _createReports

 /**
  * Stop or pause coverage proccess
  */
 protected function _createReports()
 {
     if (!$this->_coverage) {
         return;
     }
     $reportXmlDir = $this->_config->get('build_xml');
     if ($this->_config->get('xml', true, 'bool')) {
         $this->_checkDir($reportXmlDir);
         $report = new \PHP_CodeCoverage_Report_Clover();
         $report->process($this->_coverage, $reportXmlDir . '/' . $this->_hash . '.xml');
     }
     $reportCovDir = $this->_config->get('build_cov');
     if ($this->_config->get('cov', false, 'bool')) {
         $this->_checkDir($reportCovDir);
         $report = new \PHP_CodeCoverage_Report_PHP();
         $report->process($this->_coverage, $reportCovDir . '/' . $this->_hash . '.cov');
     }
     $reportHtmlDir = $this->_config->get('build_html');
     if ($this->_config->get('html', false, 'bool')) {
         $this->_checkDir($reportHtmlDir);
         $report = new \PHP_CodeCoverage_Report_HTML();
         $report->process($this->_coverage, $reportHtmlDir . '/' . $this->_hash);
     }
 }
开发者ID:jbzoo,项目名称:phpunit,代码行数:27,代码来源:CovCatcher.php

示例10: logCoverage

 /**
  * Write coverage to file if requested
  */
 private function logCoverage()
 {
     if (!$this->hasCoverage()) {
         return;
     }
     $filteredOptions = $this->options->filtered;
     if (isset($filteredOptions['coverage-clover'])) {
         $clover = new \PHP_CodeCoverage_Report_Clover();
         $clover->process($this->getCoverage()->getCoverage(), $filteredOptions['coverage-clover']);
     }
     if (isset($filteredOptions['coverage-html'])) {
         $html = new \PHP_CodeCoverage_Report_HTML();
         $html->process($this->getCoverage()->getCoverage(), $filteredOptions['coverage-html']);
     }
     $php = new \PHP_CodeCoverage_Report_PHP();
     $php->process($this->getCoverage()->getCoverage(), $filteredOptions['coverage-php']);
 }
开发者ID:bruno-arsene,项目名称:paratest,代码行数:20,代码来源:Runner.php

示例11: PHP_CodeCoverage_Report_PHP

<?php

$coverage->stop();
$writer = new PHP_CodeCoverage_Report_PHP();
$objectName = 'proc_' . getmypid() . '_' . uniqid();
$writer->process($coverage, __DIR__ . '/../../../build/coverage-parts/' . $objectName . '.cov');
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:6,代码来源:auto_append.php

示例12: main

 /**
  * Main method.
  */
 public static function main()
 {
     $input = new ezcConsoleInput();
     $input->registerOption(new ezcConsoleOption('', 'clover', ezcConsoleInput::TYPE_STRING));
     $input->registerOption(new ezcConsoleOption('', 'html', ezcConsoleInput::TYPE_STRING));
     $input->registerOption(new ezcConsoleOption('', 'php', ezcConsoleInput::TYPE_STRING));
     $input->registerOption(new ezcConsoleOption('', 'text', ezcConsoleInput::TYPE_STRING));
     $input->registerOption(new ezcConsoleOption('', 'blacklist', ezcConsoleInput::TYPE_STRING, array(), TRUE));
     $input->registerOption(new ezcConsoleOption('', 'whitelist', ezcConsoleInput::TYPE_STRING, array(), TRUE));
     $input->registerOption(new ezcConsoleOption('', 'merge', ezcConsoleInput::TYPE_NONE, FALSE));
     $input->registerOption(new ezcConsoleOption('', 'add-uncovered', ezcConsoleInput::TYPE_NONE, FALSE));
     $input->registerOption(new ezcConsoleOption('', 'process-uncovered', ezcConsoleInput::TYPE_NONE, FALSE));
     $input->registerOption(new ezcConsoleOption('h', 'help', ezcConsoleInput::TYPE_NONE, NULL, FALSE, '', '', array(), array(), FALSE, FALSE, TRUE));
     $input->registerOption(new ezcConsoleOption('v', 'version', ezcConsoleInput::TYPE_NONE, NULL, FALSE, '', '', array(), array(), FALSE, FALSE, TRUE));
     try {
         $input->process();
     } catch (ezcConsoleOptionException $e) {
         print $e->getMessage() . "\n";
         exit(1);
     }
     if ($input->getOption('help')->value) {
         self::showHelp();
         exit(0);
     } else {
         if ($input->getOption('version')->value) {
             self::printVersionString();
             exit(0);
         }
     }
     $arguments = $input->getArguments();
     $clover = $input->getOption('clover')->value;
     $html = $input->getOption('html')->value;
     $php = $input->getOption('php')->value;
     $text = $input->getOption('text')->value;
     $blacklist = $input->getOption('blacklist')->value;
     $whitelist = $input->getOption('whitelist')->value;
     $addUncovered = $input->getOption('add-uncovered')->value;
     $processUncovered = $input->getOption('process-uncovered')->value;
     $merge = $input->getOption('merge')->value;
     if (count($arguments) == 1) {
         self::printVersionString();
         $coverage = new PHP_CodeCoverage();
         $filter = $coverage->filter();
         if (empty($whitelist)) {
             $c = new ReflectionClass('ezcBase');
             $filter->addDirectoryToBlacklist(dirname($c->getFileName()));
             $c = new ReflectionClass('ezcConsoleInput');
             $filter->addDirectoryToBlacklist(dirname($c->getFileName()));
             foreach ($blacklist as $item) {
                 if (is_dir($item)) {
                     $filter->addDirectoryToBlacklist($item);
                 } else {
                     if (is_file($item)) {
                         $filter->addFileToBlacklist($item);
                     }
                 }
             }
         } else {
             $coverage->setAddUncoveredFilesFromWhitelist($addUncovered);
             $coverage->setProcessUncoveredFilesFromWhitelist($processUncovered);
             foreach ($whitelist as $item) {
                 if (is_dir($item)) {
                     $filter->addDirectoryToWhitelist($item);
                 } else {
                     if (is_file($item)) {
                         $filter->addFileToWhitelist($item);
                     }
                 }
             }
         }
         if (!$merge) {
             $coverage->start('phpcov');
             require $arguments[0];
             $coverage->stop();
         } else {
             $finder = new Symfony\Component\Finder\Finder();
             $finder->in($arguments[0])->name('*.cov');
             foreach ($finder as $file) {
                 $coverage->merge(unserialize(file_get_contents($file->getRealpath())));
             }
         }
         if ($clover) {
             $writer = new PHP_CodeCoverage_Report_Clover();
             $writer->process($coverage, $clover);
         }
         if ($html) {
             $writer = new PHP_CodeCoverage_Report_HTML();
             $writer->process($coverage, $html);
         }
         if ($php) {
             $writer = new PHP_CodeCoverage_Report_PHP();
             $writer->process($coverage, $php);
         }
         if ($text) {
             $writer = new PHP_CodeCoverage_Report_Text();
             $writer->process($coverage, $text);
         }
//.........这里部分代码省略.........
开发者ID:nagyist,项目名称:phpcov_ui,代码行数:101,代码来源:Command.php

示例13: handleReports

 private function handleReports(\PHP_CodeCoverage $coverage)
 {
     if ($this->clover) {
         $this->log("Generating code coverage report in Clover XML format ...");
         $writer = new \PHP_CodeCoverage_Report_Clover();
         $writer->process($coverage, $this->clover);
     }
     if ($this->crap4j) {
         $this->log("Generating code coverage report in Crap4J XML format...");
         $writer = new \PHP_CodeCoverage_Report_Crap4j();
         $writer->process($coverage, $this->crap4j);
     }
     if ($this->html) {
         $this->log("Generating code coverage report in HTML format ...");
         $writer = new \PHP_CodeCoverage_Report_HTML();
         $writer->process($coverage, $this->html);
     }
     if ($this->php) {
         $this->log("Generating code coverage report in PHP format ...");
         $writer = new \PHP_CodeCoverage_Report_PHP();
         $writer->process($coverage, $this->php);
     }
     if ($this->text) {
         $writer = new \PHP_CodeCoverage_Report_Text(50, 90, false, false);
         $writer->process($coverage, $this->text);
     }
 }
开发者ID:greencape,项目名称:phing-tasks,代码行数:27,代码来源:CombineCoverageTask.php

示例14: doRun


//.........这里部分代码省略.........
     $result->enforceTimeLimit($arguments['enforceTimeLimit']);
     $result->setTimeoutForSmallTests($arguments['timeoutForSmallTests']);
     $result->setTimeoutForMediumTests($arguments['timeoutForMediumTests']);
     $result->setTimeoutForLargeTests($arguments['timeoutForLargeTests']);
     if ($suite instanceof PHPUnit_Framework_TestSuite) {
         $suite->setRunTestInSeparateProcess($arguments['processIsolation']);
     }
     $suite->run($result);
     unset($suite);
     $result->flushListeners();
     if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
         $this->printer->printResult($result);
     }
     if (isset($codeCoverage)) {
         if (isset($arguments['coverageClover'])) {
             $this->printer->write("\nGenerating code coverage report in Clover XML format ...");
             try {
                 $writer = new PHP_CodeCoverage_Report_Clover();
                 $writer->process($codeCoverage, $arguments['coverageClover']);
                 $this->printer->write(" done\n");
                 unset($writer);
             } catch (PHP_CodeCoverage_Exception $e) {
                 $this->printer->write(" failed\n" . $e->getMessage() . "\n");
             }
         }
         if (isset($arguments['coverageCrap4J'])) {
             $this->printer->write("\nGenerating Crap4J report XML file ...");
             try {
                 $writer = new PHP_CodeCoverage_Report_Crap4j($arguments['crap4jThreshold']);
                 $writer->process($codeCoverage, $arguments['coverageCrap4J']);
                 $this->printer->write(" done\n");
                 unset($writer);
             } catch (PHP_CodeCoverage_Exception $e) {
                 $this->printer->write(" failed\n" . $e->getMessage() . "\n");
             }
         }
         if (isset($arguments['coverageHtml'])) {
             $this->printer->write("\nGenerating code coverage report in HTML format ...");
             try {
                 $writer = new PHP_CodeCoverage_Report_HTML($arguments['reportLowUpperBound'], $arguments['reportHighLowerBound'], sprintf(' and <a href="https://phpunit.de/">PHPUnit %s</a>', PHPUnit_Runner_Version::id()));
                 $writer->process($codeCoverage, $arguments['coverageHtml']);
                 $this->printer->write(" done\n");
                 unset($writer);
             } catch (PHP_CodeCoverage_Exception $e) {
                 $this->printer->write(" failed\n" . $e->getMessage() . "\n");
             }
         }
         if (isset($arguments['coveragePHP'])) {
             $this->printer->write("\nGenerating code coverage report in PHP format ...");
             try {
                 $writer = new PHP_CodeCoverage_Report_PHP();
                 $writer->process($codeCoverage, $arguments['coveragePHP']);
                 $this->printer->write(" done\n");
                 unset($writer);
             } catch (PHP_CodeCoverage_Exception $e) {
                 $this->printer->write(" failed\n" . $e->getMessage() . "\n");
             }
         }
         if (isset($arguments['coverageText'])) {
             if ($arguments['coverageText'] == 'php://stdout') {
                 $outputStream = $this->printer;
                 $colors = $arguments['colors'] && $arguments['colors'] != PHPUnit_TextUI_ResultPrinter::COLOR_NEVER;
             } else {
                 $outputStream = new PHPUnit_Util_Printer($arguments['coverageText']);
                 $colors = false;
             }
             $processor = new PHP_CodeCoverage_Report_Text($arguments['reportLowUpperBound'], $arguments['reportHighLowerBound'], $arguments['coverageTextShowUncoveredFiles'], $arguments['coverageTextShowOnlySummary']);
             $outputStream->write($processor->process($codeCoverage, $colors));
         }
         if (isset($arguments['coverageXml'])) {
             $this->printer->write("\nGenerating code coverage report in PHPUnit XML format ...");
             try {
                 $writer = new PHP_CodeCoverage_Report_XML();
                 $writer->process($codeCoverage, $arguments['coverageXml']);
                 $this->printer->write(" done\n");
                 unset($writer);
             } catch (PHP_CodeCoverage_Exception $e) {
                 $this->printer->write(" failed\n" . $e->getMessage() . "\n");
             }
         }
     }
     if ($exit) {
         if ($result->wasSuccessful()) {
             if ($arguments['failOnRisky'] && !$result->allHarmless()) {
                 exit(self::FAILURE_EXIT);
             }
             if ($arguments['failOnWarning'] && $result->warningCount() > 0) {
                 exit(self::FAILURE_EXIT);
             }
             exit(self::SUCCESS_EXIT);
         }
         if ($result->errorCount() > 0) {
             exit(self::EXCEPTION_EXIT);
         }
         if ($result->failureCount() > 0) {
             exit(self::FAILURE_EXIT);
         }
     }
     return $result;
 }
开发者ID:tknplt,项目名称:phpunit,代码行数:101,代码来源:TestRunner.php

示例15: doRun


//.........这里部分代码省略.........
     }
     $result->addListener($this->printer);
     if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
         $result->addListener(new PHPUnit_Util_DeprecatedFeature_Logger());
     }
     if (isset($arguments['testdoxHTMLFile'])) {
         $result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_HTML($arguments['testdoxHTMLFile']));
     }
     if (isset($arguments['testdoxTextFile'])) {
         $result->addListener(new PHPUnit_Util_TestDox_ResultPrinter_Text($arguments['testdoxTextFile']));
     }
     $codeCoverageReports = 0;
     if (extension_loaded('xdebug')) {
         if (isset($arguments['coverageClover'])) {
             $codeCoverageReports++;
         }
         if (isset($arguments['reportDirectory'])) {
             $codeCoverageReports++;
         }
         if (isset($arguments['coveragePHP'])) {
             $codeCoverageReports++;
         }
         if (isset($arguments['coverageText'])) {
             $codeCoverageReports++;
         }
     }
     if ($codeCoverageReports > 0) {
         $codeCoverage = new PHP_CodeCoverage(null, $this->codeCoverageFilter);
         $codeCoverage->setAddUncoveredFilesFromWhitelist($arguments['addUncoveredFilesFromWhitelist']);
         $codeCoverage->setProcessUncoveredFilesFromWhitelist($arguments['processUncoveredFilesFromWhitelist']);
         if (isset($arguments['forceCoversAnnotation'])) {
             $codeCoverage->setForceCoversAnnotation($arguments['forceCoversAnnotation']);
         }
         if (isset($arguments['mapTestClassNameToCoveredClassName'])) {
             $codeCoverage->setMapTestClassNameToCoveredClassName($arguments['mapTestClassNameToCoveredClassName']);
         }
         $result->setCodeCoverage($codeCoverage);
     }
     if ($codeCoverageReports > 1) {
         if (isset($arguments['cacheTokens'])) {
             $codeCoverage->setCacheTokens($arguments['cacheTokens']);
         }
     }
     if (isset($arguments['jsonLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JSON($arguments['jsonLogfile']));
     }
     if (isset($arguments['tapLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_TAP($arguments['tapLogfile']));
     }
     if (isset($arguments['junitLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
     }
     if ($arguments['strict']) {
         $result->strictMode(true);
         $result->setTimeoutForSmallTests($arguments['timeoutForSmallTests']);
         $result->setTimeoutForMediumTests($arguments['timeoutForMediumTests']);
         $result->setTimeoutForLargeTests($arguments['timeoutForLargeTests']);
     }
     $suite->run($result, $arguments['filter'], $arguments['groups'], $arguments['excludeGroups'], $arguments['processIsolation']);
     unset($suite);
     $result->flushListeners();
     if ($this->printer instanceof PHPUnit_TextUI_ResultPrinter) {
         $this->printer->printResult($result);
     }
     if (isset($codeCoverage)) {
         if (isset($arguments['coverageClover'])) {
             $this->printer->write("\nGenerating code coverage report in Clover XML format ...");
             $writer = new PHP_CodeCoverage_Report_Clover();
             $writer->process($codeCoverage, $arguments['coverageClover']);
             $this->printer->write(" done\n");
             unset($writer);
         }
         if (isset($arguments['reportDirectory'])) {
             $this->printer->write("\nGenerating code coverage report in HTML format ...");
             $writer = new PHP_CodeCoverage_Report_HTML($arguments['reportCharset'], $arguments['reportHighlight'], $arguments['reportLowUpperBound'], $arguments['reportHighLowerBound'], sprintf(' and <a href="http://phpunit.de/">PHPUnit %s</a>', PHPUnit_Runner_Version::id()));
             $writer->process($codeCoverage, $arguments['reportDirectory']);
             $this->printer->write(" done\n");
             unset($writer);
         }
         if (isset($arguments['coveragePHP'])) {
             $this->printer->write("\nGenerating code coverage report in PHP format ...");
             $writer = new PHP_CodeCoverage_Report_PHP();
             $writer->process($codeCoverage, $arguments['coveragePHP']);
             $this->printer->write(" done\n");
             unset($writer);
         }
         if (isset($arguments['coverageText'])) {
             if ($arguments['coverageText'] == 'php://stdout') {
                 $outputStream = $this->printer;
                 $colors = (bool) $arguments['colors'];
             } else {
                 $outputStream = new PHPUnit_Util_Printer($arguments['coverageText']);
                 $colors = false;
             }
             $writer = new PHP_CodeCoverage_Report_Text($outputStream, $arguments['reportLowUpperBound'], $arguments['reportHighLowerBound'], $arguments['coverageTextShowUncoveredFiles']);
             $writer->process($codeCoverage, $colors);
         }
     }
     return $result;
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:101,代码来源:TestRunner.php


注:本文中的PHP_CodeCoverage_Report_PHP类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。