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


PHP PHP_CodeCoverage::setCheckForUnexecutedCoveredCode方法代码示例

本文整理汇总了PHP中PHP_CodeCoverage::setCheckForUnexecutedCoveredCode方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeCoverage::setCheckForUnexecutedCoveredCode方法的具体用法?PHP PHP_CodeCoverage::setCheckForUnexecutedCoveredCode怎么用?PHP PHP_CodeCoverage::setCheckForUnexecutedCoveredCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHP_CodeCoverage的用法示例。


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

示例1: testAppendThrowsExceptionIfUsedCodeWasNotExecuted

 /**
  * @covers PHP_CodeCoverage::performUnexecutedCoveredCodeCheck
  * @expectedException PHP_CodeCoverage_CoveredCodeNotExecutedException
  */
 public function testAppendThrowsExceptionIfUsedCodeWasNotExecuted()
 {
     $this->coverage->filter()->addDirectoryToWhitelist(TEST_FILES_PATH);
     $this->coverage->setCheckForUnexecutedCoveredCode(true);
     $data = [TEST_FILES_PATH . 'BankAccount.php' => [29 => -1, 31 => -1]];
     $linesToBeCovered = [TEST_FILES_PATH . 'BankAccount.php' => [29, 31]];
     $linesToBeUsed = [TEST_FILES_PATH . 'BankAccount.php' => [22, 24]];
     $this->coverage->append($data, 'File1.php', true, $linesToBeCovered, $linesToBeUsed);
 }
开发者ID:ezrra,项目名称:PHP,代码行数:13,代码来源:CodeCoverageTest.php

示例2: doRun


//.........这里部分代码省略.........
         $codeCoverageReports++;
     }
     if (isset($arguments['coverageHtml'])) {
         $codeCoverageReports++;
     }
     if (isset($arguments['coveragePHP'])) {
         $codeCoverageReports++;
     }
     if (isset($arguments['coverageText'])) {
         $codeCoverageReports++;
     }
     if (isset($arguments['coverageXml'])) {
         $codeCoverageReports++;
     }
     if (isset($arguments['noCoverage'])) {
         $codeCoverageReports = 0;
     }
     if ($codeCoverageReports > 0) {
         if (!$this->runtime->canCollectCodeCoverage()) {
             $this->writeMessage('Error', 'No code coverage driver is available');
             $codeCoverageReports = 0;
         } elseif (!isset($arguments['whitelist']) && !$this->codeCoverageFilter->hasWhitelist()) {
             $this->writeMessage('Error', 'No whitelist configured, no code coverage will be generated');
             $codeCoverageReports = 0;
         }
     }
     if (!$this->printer instanceof PHPUnit_Util_Log_TAP) {
         $this->printer->write("\n");
     }
     if ($codeCoverageReports > 0) {
         $codeCoverage = new PHP_CodeCoverage(null, $this->codeCoverageFilter);
         $codeCoverage->setAddUncoveredFilesFromWhitelist($arguments['addUncoveredFilesFromWhitelist']);
         $codeCoverage->setCheckForUnintentionallyCoveredCode($arguments['strictCoverage']);
         $codeCoverage->setCheckForUnexecutedCoveredCode($arguments['strictCoverage']);
         $codeCoverage->setProcessUncoveredFilesFromWhitelist($arguments['processUncoveredFilesFromWhitelist']);
         if (isset($arguments['forceCoversAnnotation'])) {
             $codeCoverage->setForceCoversAnnotation($arguments['forceCoversAnnotation']);
         }
         if (isset($arguments['disableCodeCoverageIgnore'])) {
             $codeCoverage->setDisableIgnoredLines(true);
         }
         if (isset($arguments['whitelist'])) {
             $this->codeCoverageFilter->addDirectoryToWhitelist($arguments['whitelist']);
         }
         $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['teamcityLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_TeamCity($arguments['teamcityLogfile']));
     }
     if (isset($arguments['junitLogfile'])) {
         $result->addListener(new PHPUnit_Util_Log_JUnit($arguments['junitLogfile'], $arguments['logIncompleteSkipped']));
     }
     $result->beStrictAboutTestsThatDoNotTestAnything($arguments['reportUselessTests']);
     $result->beStrictAboutOutputDuringTests($arguments['disallowTestOutput']);
     $result->beStrictAboutTodoAnnotatedTests($arguments['disallowTodoAnnotatedTests']);
开发者ID:tknplt,项目名称:phpunit,代码行数:67,代码来源:TestRunner.php


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