本文整理汇总了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);
}
示例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']);