function Loader::codeCoverage
1 call to Loader::codeCoverage()
- Loader::load in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Loader.php
File
-
vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Loader.php, line 304
Class
- Loader
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\TextUI\XmlConfigurationCode
private function codeCoverage(string $filename, DOMXPath $xpath) : CodeCoverage {
$cacheDirectory = null;
$pathCoverage = false;
$includeUncoveredFiles = true;
$ignoreDeprecatedCodeUnits = false;
$disableCodeCoverageIgnore = false;
$element = $this->element($xpath, 'coverage');
if ($element) {
$cacheDirectory = $this->getStringAttribute($element, 'cacheDirectory');
if ($cacheDirectory !== null) {
$cacheDirectory = new Directory($this->toAbsolutePath($filename, $cacheDirectory));
}
$pathCoverage = $this->getBooleanAttribute($element, 'pathCoverage', false);
$includeUncoveredFiles = $this->getBooleanAttribute($element, 'includeUncoveredFiles', true);
$ignoreDeprecatedCodeUnits = $this->getBooleanAttribute($element, 'ignoreDeprecatedCodeUnits', false);
$disableCodeCoverageIgnore = $this->getBooleanAttribute($element, 'disableCodeCoverageIgnore', false);
}
$clover = null;
$element = $this->element($xpath, 'coverage/report/clover');
if ($element) {
$clover = new Clover(new File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile'))));
}
$cobertura = null;
$element = $this->element($xpath, 'coverage/report/cobertura');
if ($element) {
$cobertura = new Cobertura(new File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile'))));
}
$crap4j = null;
$element = $this->element($xpath, 'coverage/report/crap4j');
if ($element) {
$crap4j = new Crap4j(new File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile'))), $this->getIntegerAttribute($element, 'threshold', 30));
}
$html = null;
$element = $this->element($xpath, 'coverage/report/html');
if ($element) {
$defaultColors = Colors::default();
$defaultThresholds = Thresholds::default();
$html = new CodeCoverageHtml(new Directory($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputDirectory'))), $this->getIntegerAttribute($element, 'lowUpperBound', $defaultThresholds->lowUpperBound()), $this->getIntegerAttribute($element, 'highLowerBound', $defaultThresholds->highLowerBound()), $this->getStringAttributeWithDefault($element, 'colorSuccessLow', $defaultColors->successLow()), $this->getStringAttributeWithDefault($element, 'colorSuccessMedium', $defaultColors->successMedium()), $this->getStringAttributeWithDefault($element, 'colorSuccessHigh', $defaultColors->successHigh()), $this->getStringAttributeWithDefault($element, 'colorWarning', $defaultColors->warning()), $this->getStringAttributeWithDefault($element, 'colorDanger', $defaultColors->danger()), $this->getStringAttribute($element, 'customCssFile'));
}
$php = null;
$element = $this->element($xpath, 'coverage/report/php');
if ($element) {
$php = new CodeCoveragePhp(new File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile'))));
}
$text = null;
$element = $this->element($xpath, 'coverage/report/text');
if ($element) {
$text = new CodeCoverageText(new File($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputFile'))), $this->getBooleanAttribute($element, 'showUncoveredFiles', false), $this->getBooleanAttribute($element, 'showOnlySummary', false));
}
$xml = null;
$element = $this->element($xpath, 'coverage/report/xml');
if ($element) {
$xml = new CodeCoverageXml(new Directory($this->toAbsolutePath($filename, (string) $this->getStringAttribute($element, 'outputDirectory'))));
}
return new CodeCoverage($cacheDirectory, $this->readFilterDirectories($filename, $xpath, 'coverage/include/directory'), $this->readFilterFiles($filename, $xpath, 'coverage/include/file'), $this->readFilterDirectories($filename, $xpath, 'coverage/exclude/directory'), $this->readFilterFiles($filename, $xpath, 'coverage/exclude/file'), $pathCoverage, $includeUncoveredFiles, $ignoreDeprecatedCodeUnits, $disableCodeCoverageIgnore, $clover, $cobertura, $crap4j, $html, $php, $text, $xml);
}