diff --git a/.travis.yml b/.travis.yml
index 8bceea85b..4459eb803 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,10 @@ language: php
php:
- 5.6
+install:
+ - pecl install xdebug
+ - php --version
+
before_script:
- COMPOSER_ROOT_VERSION=dev-master composer install --prefer-source
diff --git a/src/CodeCoverage.php b/src/CodeCoverage.php
index d1ac2e9e7..a85030fb9 100644
--- a/src/CodeCoverage.php
+++ b/src/CodeCoverage.php
@@ -84,22 +84,32 @@ class PHP_CodeCoverage
/**
* Constructor.
*
- * @param PHP_CodeCoverage_Driver $driver
- * @param PHP_CodeCoverage_Filter $filter
- * @throws PHP_CodeCoverage_RuntimeException
+ * @param PHP_CodeCoverage_Driver $driver
+ * @param PHP_CodeCoverage_Filter $filter
+ * @param null|bool $pathCoverage `null` enables path coverage if supported.
+ * @throws PHP_CodeCoverage_InvalidArgumentException
*/
- public function __construct(PHP_CodeCoverage_Driver $driver = null, PHP_CodeCoverage_Filter $filter = null)
+ public function __construct(PHP_CodeCoverage_Driver $driver = null, PHP_CodeCoverage_Filter $filter = null, $pathCoverage = null)
{
+ if ($pathCoverage === null) {
+ $pathCoverage = version_compare(phpversion('xdebug'), '2.3.2', '>=');
+ } elseif (!is_bool($pathCoverage)) {
+ throw PHP_CodeCoverage_InvalidArgumentException::create(
+ 3,
+ 'boolean'
+ );
+ }
+
if ($driver === null) {
- $driver = $this->selectDriver();
+ $driver = $this->selectDriver($pathCoverage);
}
if ($filter === null) {
$filter = new PHP_CodeCoverage_Filter;
}
- $this->driver = $driver;
- $this->filter = $filter;
+ $this->driver = $driver;
+ $this->filter = $filter;
}
/**
@@ -307,15 +317,37 @@ public function append(array $data, $id = null, $append = true, $linesToBeCovere
$this->tests[$id] = ['size' => $size, 'status' => $status];
- foreach ($data as $file => $lines) {
+ foreach ($data as $file => $fileData) {
if (!$this->filter->isFile($file)) {
continue;
}
- foreach ($lines as $k => $v) {
- if ($v == PHP_CodeCoverage_Driver::LINE_EXECUTED) {
- if (empty($this->data[$file][$k]) || !in_array($id, $this->data[$file][$k])) {
- $this->data[$file][$k][] = $id;
+ foreach ($fileData['lines'] as $function => $functionCoverage) {
+ if ($functionCoverage === PHP_CodeCoverage_Driver::LINE_EXECUTED) {
+ $lineData = &$this->data[$file]['lines'][$function];
+ if ($lineData === null) {
+ $lineData = [
+ 'pathCovered' => false,
+ 'tests' => [$id],
+ ];
+ } elseif (!in_array($id, $lineData['tests'])) {
+ $lineData['tests'][] = $id;
+ }
+ }
+ }
+
+ foreach ($fileData['functions'] as $function => $functionCoverage) {
+ foreach ($functionCoverage['branches'] as $branch => $branchCoverage) {
+ if ($branchCoverage['hit'] === 1){
+ $this->data[$file]['branches'][$function][$branch]['hit'] = 1;
+ if (!in_array($id, $this->data[$file]['branches'][$function][$branch]['tests'])) {
+ $this->data[$file]['branches'][$function][$branch]['tests'][] = $id;
+ }
+ }
+ }
+ foreach ($functionCoverage['paths'] as $path => $pathCoverage) {
+ if ($pathCoverage['hit'] === 1 && $this->data[$file]['paths'][$function][$path]['hit'] === 0){
+ $this->data[$file]['paths'][$function][$path]['hit'] = 1;
}
}
}
@@ -333,22 +365,25 @@ public function merge(PHP_CodeCoverage $that)
array_merge($this->filter->getWhitelistedFiles(), $that->filter()->getWhitelistedFiles())
);
- foreach ($that->data as $file => $lines) {
+ foreach ($that->getData() as $file => $fileData) {
if (!isset($this->data[$file])) {
- if (!$this->filter->isFiltered($file)) {
- $this->data[$file] = $lines;
+ if (!$that->filter()->isFiltered($file)) {
+ $this->data[$file] = $fileData;
}
continue;
}
- foreach ($lines as $line => $data) {
+ foreach ($fileData['lines'] as $line => $data) {
if ($data !== null) {
- if (!isset($this->data[$file][$line])) {
- $this->data[$file][$line] = $data;
+ if (!isset($this->data[$file]['lines'][$line])) {
+ $this->data[$file]['lines'][$line] = $data;
} else {
- $this->data[$file][$line] = array_unique(
- array_merge($this->data[$file][$line], $data)
+ if ($data['pathCovered']) {
+ $this->data[$file]['lines'][$line]['pathCovered'] = $data['pathCovered'];
+ }
+ $this->data[$file]['lines'][$line]['tests'] = array_unique(
+ array_merge($this->data[$file]['lines'][$line]['tests'], $data['tests'])
);
}
}
@@ -486,7 +521,10 @@ private function applyCoversAnnotationFilter(array &$data, $linesToBeCovered, ar
{
if ($linesToBeCovered === false ||
($this->forceCoversAnnotation && empty($linesToBeCovered))) {
- $data = [];
+ $data = [
+ 'lines' => [],
+ 'functions' => [],
+ ];
return;
}
@@ -508,8 +546,8 @@ private function applyCoversAnnotationFilter(array &$data, $linesToBeCovered, ar
foreach (array_keys($data) as $filename) {
$_linesToBeCovered = array_flip($linesToBeCovered[$filename]);
- $data[$filename] = array_intersect_key(
- $data[$filename],
+ $data[$filename]['lines'] = array_intersect_key(
+ $data[$filename]['lines'],
$_linesToBeCovered
);
}
@@ -542,7 +580,7 @@ private function applyIgnoredLinesFilter(array &$data)
}
foreach ($this->getLinesToBeIgnored($filename) as $line) {
- unset($data[$filename][$line]);
+ unset($data[$filename]['lines'][$line]);
}
}
}
@@ -553,12 +591,45 @@ private function applyIgnoredLinesFilter(array &$data)
*/
private function initializeFilesThatAreSeenTheFirstTime(array $data)
{
- foreach ($data as $file => $lines) {
- if ($this->filter->isFile($file) && !isset($this->data[$file])) {
- $this->data[$file] = [];
+ foreach ($data as $file => $fileData) {
+ if (!$this->filter->isFile($file) || isset($this->data[$file])) {
+ continue;
+ }
- foreach ($lines as $k => $v) {
- $this->data[$file][$k] = $v == -2 ? null : [];
+ $this->data[$file] = [
+ 'lines' => [],
+ 'branches' =>[],
+ 'paths' => [],
+ ];
+
+ foreach ($fileData['lines'] as $lineNumber => $flag) {
+ if ($flag === PHP_CodeCoverage_Driver::LINE_NOT_EXECUTABLE) {
+ $this->data[$file]['lines'][$lineNumber] = null;
+ } else {
+ $this->data[$file]['lines'][$lineNumber] = [
+ 'pathCovered' => false,
+ 'tests' => [],
+ ];
+ }
+ }
+
+ foreach ($fileData['functions'] as $functionName => $functionData) {
+ $this->data[$file]['branches'][$functionName] = [];
+ $this->data[$file]['paths'][$functionName] = $functionData['paths'];
+
+ foreach ($functionData['branches'] as $index => $branch) {
+ $this->data[$file]['branches'][$functionName][$index] = [
+ 'hit' => $branch['hit'],
+ 'line_start' => $branch['line_start'],
+ 'line_end' => $branch['line_end'],
+ 'tests' => []
+ ];
+
+ for ($i = $branch['line_start']; $i < $branch['line_end']; $i++) {
+ if (isset($this->data[$file]['lines'][$i])) {
+ $this->data[$file]['lines'][$i]['pathCovered'] = (bool) $branch['hit'];
+ }
+ }
}
}
}
@@ -587,12 +658,15 @@ private function addUncoveredFilesFromWhitelist()
$uncoveredFiles
);
} else {
- $data[$uncoveredFile] = [];
+ $data[$uncoveredFile] = [
+ 'lines' => [],
+ 'functions' => [],
+ ];
$lines = count(file($uncoveredFile));
for ($i = 1; $i <= $lines; $i++) {
- $data[$uncoveredFile][$i] = PHP_CodeCoverage_Driver::LINE_NOT_EXECUTED;
+ $data[$uncoveredFile]['lines'][$i] = PHP_CodeCoverage_Driver::LINE_NOT_EXECUTED;
}
}
}
@@ -815,8 +889,8 @@ private function performUnintentionallyCoveredCodeCheck(array &$data, array $lin
$message = '';
- foreach ($data as $file => $_data) {
- foreach ($_data as $line => $flag) {
+ foreach ($data as $file => $fileData) {
+ foreach ($fileData['lines'] as $line => $flag) {
if ($flag == 1 &&
(!isset($allowedLines[$file]) ||
!isset($allowedLines[$file][$line]))) {
@@ -878,10 +952,11 @@ private function getAllowedLines(array $linesToBeCovered, array $linesToBeUsed)
}
/**
+ * @param bool $pathCoverage
* @return PHP_CodeCoverage_Driver
* @throws PHP_CodeCoverage_RuntimeException
*/
- private function selectDriver()
+ private function selectDriver($pathCoverage)
{
$runtime = new Runtime;
@@ -894,7 +969,7 @@ private function selectDriver()
} elseif ($runtime->isPHPDBG()) {
return new PHP_CodeCoverage_Driver_PHPDBG;
} else {
- return new PHP_CodeCoverage_Driver_Xdebug;
+ return new PHP_CodeCoverage_Driver_Xdebug($pathCoverage);
}
}
}
diff --git a/src/CodeCoverage/Driver/Xdebug.php b/src/CodeCoverage/Driver/Xdebug.php
index ed9a7035b..5f0e4588d 100644
--- a/src/CodeCoverage/Driver/Xdebug.php
+++ b/src/CodeCoverage/Driver/Xdebug.php
@@ -17,9 +17,14 @@
class PHP_CodeCoverage_Driver_Xdebug implements PHP_CodeCoverage_Driver
{
/**
- * Constructor.
+ * @var int
*/
- public function __construct()
+ private $flags;
+
+ /**
+ * @param bool $pathCoverage
+ */
+ public function __construct($pathCoverage = false)
{
if (!extension_loaded('xdebug')) {
throw new PHP_CodeCoverage_RuntimeException('This driver requires Xdebug');
@@ -31,6 +36,18 @@ public function __construct()
'xdebug.coverage_enable=On has to be set in php.ini'
);
}
+
+ $this->flags = XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE;
+
+ if ($pathCoverage) {
+ if (version_compare(phpversion('xdebug'), '2.3.2', '<')) {
+ throw new PHP_CodeCoverage_RuntimeException(
+ 'Path coverage requires Xdebug 2.3.2 (or newer)'
+ );
+ }
+
+ $this->flags |= XDEBUG_CC_BRANCH_CHECK;
+ }
}
/**
@@ -38,7 +55,7 @@ public function __construct()
*/
public function start()
{
- xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
+ xdebug_start_code_coverage($this->flags);
}
/**
@@ -62,14 +79,21 @@ public function stop()
private function cleanup(array $data)
{
foreach (array_keys($data) as $file) {
- unset($data[$file][0]);
+ if (!isset($data[$file]['lines'])) {
+ $data[$file] = ['lines' => $data[$file]];
+ }
+ if (!isset($data[$file]['functions'])) {
+ $data[$file]['functions'] = [];
+ }
+
+ unset($data[$file]['lines'][0]);
if ($file != 'xdebug://debug-eval' && file_exists($file)) {
$numLines = $this->getNumberOfLinesInFile($file);
- foreach (array_keys($data[$file]) as $line) {
+ foreach (array_keys($data[$file]['lines']) as $line) {
if ($line > $numLines) {
- unset($data[$file][$line]);
+ unset($data[$file]['lines'][$line]);
}
}
}
diff --git a/src/CodeCoverage/Report/Clover.php b/src/CodeCoverage/Report/Clover.php
index 6c8fda190..431dc9ec8 100644
--- a/src/CodeCoverage/Report/Clover.php
+++ b/src/CodeCoverage/Report/Clover.php
@@ -78,8 +78,8 @@ public function process(PHP_CodeCoverage $coverage, $target = null, $name = null
for ($i = $method['startLine'];
$i <= $method['endLine'];
$i++) {
- if (isset($coverage[$i]) && ($coverage[$i] !== null)) {
- $methodCount = max($methodCount, count($coverage[$i]));
+ if (isset($coverage['lines'][$i])) {
+ $methodCount = max($methodCount, count($coverage['lines'][$i]['tests']));
}
}
@@ -135,8 +135,8 @@ public function process(PHP_CodeCoverage $coverage, $target = null, $name = null
$xmlMetrics->setAttribute('complexity', $class['ccn']);
$xmlMetrics->setAttribute('methods', $classMethods);
$xmlMetrics->setAttribute('coveredmethods', $coveredMethods);
- $xmlMetrics->setAttribute('conditionals', 0);
- $xmlMetrics->setAttribute('coveredconditionals', 0);
+ $xmlMetrics->setAttribute('conditionals', $class['executablePaths']);
+ $xmlMetrics->setAttribute('coveredconditionals', $class['executedPaths']);
$xmlMetrics->setAttribute('statements', $classStatements);
$xmlMetrics->setAttribute(
'coveredstatements',
@@ -157,13 +157,14 @@ public function process(PHP_CodeCoverage $coverage, $target = null, $name = null
$xmlClass->appendChild($xmlMetrics);
}
- foreach ($coverage as $line => $data) {
+ foreach ($coverage['lines'] as $line => $data) {
if ($data === null || isset($lines[$line])) {
continue;
}
$lines[$line] = [
- 'count' => count($data), 'type' => 'stmt'
+ 'count' => count($data['tests']),
+ 'type' => 'stmt',
];
}
@@ -205,8 +206,8 @@ public function process(PHP_CodeCoverage $coverage, $target = null, $name = null
'coveredmethods',
$item->getNumTestedMethods()
);
- $xmlMetrics->setAttribute('conditionals', 0);
- $xmlMetrics->setAttribute('coveredconditionals', 0);
+ $xmlMetrics->setAttribute('conditionals', $item->getNumExecutablePaths());
+ $xmlMetrics->setAttribute('coveredconditionals', $item->getNumExecutedPaths());
$xmlMetrics->setAttribute(
'statements',
$item->getNumExecutableLines()
@@ -258,8 +259,8 @@ public function process(PHP_CodeCoverage $coverage, $target = null, $name = null
'coveredmethods',
$report->getNumTestedMethods()
);
- $xmlMetrics->setAttribute('conditionals', 0);
- $xmlMetrics->setAttribute('coveredconditionals', 0);
+ $xmlMetrics->setAttribute('conditionals', $report->getNumExecutablePaths());
+ $xmlMetrics->setAttribute('coveredconditionals', $report->getNumExecutedPaths());
$xmlMetrics->setAttribute(
'statements',
$report->getNumExecutableLines()
diff --git a/src/CodeCoverage/Report/HTML/Renderer.php b/src/CodeCoverage/Report/HTML/Renderer.php
index e669cd789..b441281fb 100644
--- a/src/CodeCoverage/Report/HTML/Renderer.php
+++ b/src/CodeCoverage/Report/HTML/Renderer.php
@@ -124,6 +124,22 @@ protected function renderItemTemplate(Text_Template $template, array $data)
$data['linesExecutedPercentAsString'] = '100.00%';
}
+ if ($data['numExecutablePaths'] > 0) {
+ $pathsLevel = $this->getColorLevel($data['pathsExecutedPercent']);
+
+ $pathsNumber = $data['numExecutedPaths'] . $numSeparator .
+ $data['numExecutablePaths'];
+
+ $pathsBar = $this->getCoverageBar(
+ $data['pathsExecutedPercent']
+ );
+ } else {
+ $pathsLevel = 'success';
+ $pathsNumber = '0' . $numSeparator . '0';
+ $pathsBar = $this->getCoverageBar(100);
+ $data['pathsExecutedPercentAsString'] = '100.00%';
+ }
+
$template->setVar(
[
'icon' => isset($data['icon']) ? $data['icon'] : '',
@@ -133,6 +149,10 @@ protected function renderItemTemplate(Text_Template $template, array $data)
'lines_executed_percent' => $data['linesExecutedPercentAsString'],
'lines_level' => $linesLevel,
'lines_number' => $linesNumber,
+ 'paths_bar' => $pathsBar,
+ 'paths_executed_percent' => $data['pathsExecutedPercentAsString'],
+ 'paths_level' => $pathsLevel,
+ 'paths_number' => $pathsNumber,
'methods_bar' => $methodsBar,
'methods_tested_percent' => $data['testedMethodsPercentAsString'],
'methods_level' => $methodsLevel,
diff --git a/src/CodeCoverage/Report/HTML/Renderer/Directory.php b/src/CodeCoverage/Report/HTML/Renderer/Directory.php
index b7c0d0d61..71ca727d8 100644
--- a/src/CodeCoverage/Report/HTML/Renderer/Directory.php
+++ b/src/CodeCoverage/Report/HTML/Renderer/Directory.php
@@ -61,6 +61,10 @@ protected function renderItem(PHP_CodeCoverage_Report_Node $item, $total = false
'linesExecutedPercentAsString' => $item->getLineExecutedPercent(),
'numExecutedLines' => $item->getNumExecutedLines(),
'numExecutableLines' => $item->getNumExecutableLines(),
+ 'pathsExecutedPercent' => $item->getPathExecutedPercent(false),
+ 'pathsExecutedPercentAsString' => $item->getPathExecutedPercent(),
+ 'numExecutedPaths' => $item->getNumExecutedPaths(),
+ 'numExecutablePaths' => $item->getNumExecutablePaths(),
'testedMethodsPercent' => $item->getTestedMethodsPercent(false),
'testedMethodsPercentAsString' => $item->getTestedMethodsPercent(),
'testedClassesPercent' => $item->getTestedClassesAndTraitsPercent(false),
diff --git a/src/CodeCoverage/Report/HTML/Renderer/File.php b/src/CodeCoverage/Report/HTML/Renderer/File.php
index 5ab20c5bd..7e7ed40ab 100644
--- a/src/CodeCoverage/Report/HTML/Renderer/File.php
+++ b/src/CodeCoverage/Report/HTML/Renderer/File.php
@@ -90,6 +90,10 @@ protected function renderItems(PHP_CodeCoverage_Report_Node_File $node)
'linesExecutedPercentAsString' => $node->getLineExecutedPercent(),
'numExecutedLines' => $node->getNumExecutedLines(),
'numExecutableLines' => $node->getNumExecutableLines(),
+ 'pathsExecutedPercent' => $node->getPathExecutedPercent(false),
+ 'pathsExecutedPercentAsString' => $node->getPathExecutedPercent(),
+ 'numExecutedPaths' => $node->getNumExecutedPaths(),
+ 'numExecutablePaths' => $node->getNumExecutablePaths(),
'testedMethodsPercent' => $node->getTestedMethodsPercent(false),
'testedMethodsPercentAsString' => $node->getTestedMethodsPercent(),
'testedClassesPercent' => $node->getTestedClassesAndTraitsPercent(false),
@@ -162,6 +166,18 @@ protected function renderTraitOrClassItems(array $items, Text_Template $template
),
'numExecutedLines' => $item['executedLines'],
'numExecutableLines' => $item['executableLines'],
+ 'pathsExecutedPercent' => PHP_CodeCoverage_Util::percent(
+ $item['executedPaths'],
+ $item['executablePaths'],
+ false
+ ),
+ 'pathsExecutedPercentAsString' => PHP_CodeCoverage_Util::percent(
+ $item['executedPaths'],
+ $item['executablePaths'],
+ true
+ ),
+ 'numExecutedPaths' => $item['executedPaths'],
+ 'numExecutablePaths' => $item['executablePaths'],
'testedMethodsPercent' => PHP_CodeCoverage_Util::percent(
$numTestedMethods,
$numMethods,
@@ -253,6 +269,18 @@ protected function renderFunctionOrMethodItem(Text_Template $template, array $it
),
'numExecutedLines' => $item['executedLines'],
'numExecutableLines' => $item['executableLines'],
+ 'pathsExecutedPercent' => PHP_CodeCoverage_Util::percent(
+ $item['executedPaths'],
+ $item['executablePaths'],
+ false
+ ),
+ 'pathsExecutedPercentAsString' => PHP_CodeCoverage_Util::percent(
+ $item['executedPaths'],
+ $item['executablePaths'],
+ true
+ ),
+ 'numExecutedPaths' => $item['executedPaths'],
+ 'numExecutablePaths' => $item['executablePaths'],
'testedMethodsPercent' => PHP_CodeCoverage_Util::percent(
$numTestedItems,
1,
@@ -285,24 +313,25 @@ protected function renderSource(PHP_CodeCoverage_Report_Node_File $node)
$popoverContent = '';
$popoverTitle = '';
- if (array_key_exists($i, $coverageData)) {
- $numTests = count($coverageData[$i]);
+ if (array_key_exists($i, $coverageData['lines'])) {
+ $lineData = $coverageData['lines'][$i];
- if ($coverageData[$i] === null) {
+ if ($lineData === null) {
$trClass = ' class="warning"';
- } elseif ($numTests == 0) {
+ } elseif (empty($lineData['tests'])) {
$trClass = ' class="danger"';
} else {
$lineCss = 'covered-by-large-tests';
$popoverContent = '
';
+ $numTests = count($lineData['tests']);
if ($numTests > 1) {
$popoverTitle = $numTests . ' tests cover line ' . $i;
} else {
$popoverTitle = '1 test covers line ' . $i;
}
- foreach ($coverageData[$i] as $test) {
+ foreach ($lineData['tests'] as $test) {
if ($lineCss == 'covered-by-large-tests' && $testData[$test]['size'] == 'medium') {
$lineCss = 'covered-by-medium-tests';
} elseif ($testData[$test]['size'] == 'small') {
diff --git a/src/CodeCoverage/Report/HTML/Renderer/Template/directory.html.dist b/src/CodeCoverage/Report/HTML/Renderer/Template/directory.html.dist
index efe743f51..8488d0eba 100644
--- a/src/CodeCoverage/Report/HTML/Renderer/Template/directory.html.dist
+++ b/src/CodeCoverage/Report/HTML/Renderer/Template/directory.html.dist
@@ -28,11 +28,12 @@
|
- Code Coverage |
+ Code Coverage |
|
Lines |
+ Paths |
Functions and Methods |
Classes and Traits |
diff --git a/src/CodeCoverage/Report/HTML/Renderer/Template/directory_item.html.dist b/src/CodeCoverage/Report/HTML/Renderer/Template/directory_item.html.dist
index 78dbb3565..c2e54dc30 100644
--- a/src/CodeCoverage/Report/HTML/Renderer/Template/directory_item.html.dist
+++ b/src/CodeCoverage/Report/HTML/Renderer/Template/directory_item.html.dist
@@ -3,6 +3,9 @@
{{lines_bar}} |
{{lines_executed_percent}} |
{{lines_number}} |
+ {{paths_bar}} |
+ {{paths_executed_percent}} |
+ {{paths_number}} |
{{methods_bar}} |
{{methods_tested_percent}} |
{{methods_number}} |
diff --git a/src/CodeCoverage/Report/HTML/Renderer/Template/file.html.dist b/src/CodeCoverage/Report/HTML/Renderer/Template/file.html.dist
index 59a068430..4fb0ca0d0 100644
--- a/src/CodeCoverage/Report/HTML/Renderer/Template/file.html.dist
+++ b/src/CodeCoverage/Report/HTML/Renderer/Template/file.html.dist
@@ -28,12 +28,13 @@
|
- Code Coverage |
+ Code Coverage |
|
Classes and Traits |
Functions and Methods |
+ Paths |
Lines |
diff --git a/src/CodeCoverage/Report/HTML/Renderer/Template/file_item.html.dist b/src/CodeCoverage/Report/HTML/Renderer/Template/file_item.html.dist
index 756fdd69b..8d482aa30 100644
--- a/src/CodeCoverage/Report/HTML/Renderer/Template/file_item.html.dist
+++ b/src/CodeCoverage/Report/HTML/Renderer/Template/file_item.html.dist
@@ -7,6 +7,9 @@
{{methods_tested_percent}} |
{{methods_number}} |
{{crap}} |
+ {{paths_bar}} |
+ {{paths_executed_percent}} |
+ {{paths_number}} |
{{lines_bar}} |
{{lines_executed_percent}} |
{{lines_number}} |
diff --git a/src/CodeCoverage/Report/HTML/Renderer/Template/method_item.html.dist b/src/CodeCoverage/Report/HTML/Renderer/Template/method_item.html.dist
index 4bb0e42cc..aca246251 100644
--- a/src/CodeCoverage/Report/HTML/Renderer/Template/method_item.html.dist
+++ b/src/CodeCoverage/Report/HTML/Renderer/Template/method_item.html.dist
@@ -4,6 +4,9 @@
{{methods_tested_percent}} |
{{methods_number}} |
{{crap}} |
+ {{paths_bar}} |
+ {{paths_executed_percent}} |
+ {{paths_number}} |
{{lines_bar}} |
{{lines_executed_percent}} |
{{lines_number}} |
diff --git a/src/CodeCoverage/Report/Node.php b/src/CodeCoverage/Report/Node.php
index e515a847a..4732f26a8 100644
--- a/src/CodeCoverage/Report/Node.php
+++ b/src/CodeCoverage/Report/Node.php
@@ -206,6 +206,21 @@ public function getLineExecutedPercent($asString = true)
);
}
+ /**
+ * Returns the percentage of executed paths.
+ *
+ * @param bool $asString
+ * @return int
+ */
+ public function getPathExecutedPercent($asString = true)
+ {
+ return PHP_CodeCoverage_Util::percent(
+ $this->getNumExecutedPaths(),
+ $this->getNumExecutablePaths(),
+ $asString
+ );
+ }
+
/**
* Returns the number of classes and traits.
*
@@ -281,6 +296,20 @@ abstract public function getNumExecutableLines();
*/
abstract public function getNumExecutedLines();
+ /**
+ * Returns the number of executable paths.
+ *
+ * @return int
+ */
+ abstract public function getNumExecutablePaths();
+
+ /**
+ * Returns the number of executed paths.
+ *
+ * @return int
+ */
+ abstract public function getNumExecutedPaths();
+
/**
* Returns the number of classes.
*
diff --git a/src/CodeCoverage/Report/Node/Directory.php b/src/CodeCoverage/Report/Node/Directory.php
index b3a650a2b..9be0d535c 100644
--- a/src/CodeCoverage/Report/Node/Directory.php
+++ b/src/CodeCoverage/Report/Node/Directory.php
@@ -65,6 +65,16 @@ class PHP_CodeCoverage_Report_Node_Directory extends PHP_CodeCoverage_Report_Nod
*/
protected $numExecutedLines = -1;
+ /**
+ * @var int
+ */
+ protected $numExecutablePaths = -1;
+
+ /**
+ * @var int
+ */
+ protected $numExecutedPaths = -1;
+
/**
* @var int
*/
@@ -177,6 +187,8 @@ public function addFile($name, array $coverageData, array $testData, $cacheToken
$this->numExecutableLines = -1;
$this->numExecutedLines = -1;
+ $this->numExecutablePaths = -1;
+ $this->numExecutedPaths = -1;
return $file;
}
@@ -332,6 +344,42 @@ public function getNumExecutedLines()
return $this->numExecutedLines;
}
+ /**
+ * Returns the number of executable paths.
+ *
+ * @return int
+ */
+ public function getNumExecutablePaths()
+ {
+ if ($this->numExecutablePaths == -1) {
+ $this->numExecutablePaths = 0;
+
+ foreach ($this->children as $child) {
+ $this->numExecutablePaths += $child->getNumExecutablePaths();
+ }
+ }
+
+ return $this->numExecutablePaths;
+ }
+
+ /**
+ * Returns the number of executed paths.
+ *
+ * @return int
+ */
+ public function getNumExecutedPaths()
+ {
+ if ($this->numExecutedPaths == -1) {
+ $this->numExecutedPaths = 0;
+
+ foreach ($this->children as $child) {
+ $this->numExecutedPaths += $child->getNumExecutedPaths();
+ }
+ }
+
+ return $this->numExecutedPaths;
+ }
+
/**
* Returns the number of classes.
*
diff --git a/src/CodeCoverage/Report/Node/File.php b/src/CodeCoverage/Report/Node/File.php
index f5b2ffb48..abe994c6c 100644
--- a/src/CodeCoverage/Report/Node/File.php
+++ b/src/CodeCoverage/Report/Node/File.php
@@ -35,6 +35,16 @@ class PHP_CodeCoverage_Report_Node_File extends PHP_CodeCoverage_Report_Node
*/
protected $numExecutedLines = 0;
+ /**
+ * @var int
+ */
+ protected $numExecutablePaths = 0;
+
+ /**
+ * @var int
+ */
+ protected $numExecutedPaths = 0;
+
/**
* @var array
*/
@@ -213,6 +223,26 @@ public function getNumExecutedLines()
return $this->numExecutedLines;
}
+ /**
+ * Returns the number of executable paths.
+ *
+ * @return int
+ */
+ public function getNumExecutablePaths()
+ {
+ return $this->numExecutablePaths;
+ }
+
+ /**
+ * Returns the number of executed paths.
+ *
+ * @return int
+ */
+ public function getNumExecutedPaths()
+ {
+ return $this->numExecutedPaths;
+ }
+
/**
* Returns the number of classes.
*
@@ -390,7 +420,7 @@ protected function calculateStatistics()
}
}
- if (isset($this->coverageData[$lineNumber])) {
+ if (isset($this->coverageData['lines'][$lineNumber])) {
if (isset($currentClass)) {
$currentClass['executableLines']++;
}
@@ -409,7 +439,7 @@ protected function calculateStatistics()
$this->numExecutableLines++;
- if (count($this->coverageData[$lineNumber]) > 0) {
+ if (!empty($this->coverageData['lines'][$lineNumber]['tests'])) {
if (isset($currentClass)) {
$currentClass['executedLines']++;
}
@@ -461,72 +491,35 @@ protected function calculateStatistics()
}
}
- foreach ($this->traits as &$trait) {
- foreach ($trait['methods'] as &$method) {
- if ($method['executableLines'] > 0) {
- $method['coverage'] = ($method['executedLines'] /
- $method['executableLines']) * 100;
- } else {
- $method['coverage'] = 100;
- }
+ foreach ($this->functions as &$function) {
+ if (isset($this->coverageData['paths'][$function['functionName']])) {
+ $functionPaths = $this->coverageData['paths'][$function['functionName']];
+ $this->calcPathsAggregate($functionPaths, $numExecutablePaths, $numExecutedPaths);
- $method['crap'] = $this->crap(
- $method['ccn'],
- $method['coverage']
- );
-
- $trait['ccn'] += $method['ccn'];
- }
+ $function['executablePaths'] = $numExecutablePaths;
+ $this->numExecutablePaths += $numExecutablePaths;
- if ($trait['executableLines'] > 0) {
- $trait['coverage'] = ($trait['executedLines'] /
- $trait['executableLines']) * 100;
- } else {
- $trait['coverage'] = 100;
+ $function['executedPaths'] = $numExecutedPaths;
+ $this->numExecutedPaths += $numExecutedPaths;
}
+ }
- if ($trait['coverage'] == 100) {
- $this->numTestedClasses++;
+ foreach ($this->traits as &$trait) {
+ $fqcn = $trait['traitName'];
+ if (!empty($trait['package']['namespace'])) {
+ $fqcn = $trait['package']['namespace'] . '\\' . $fqcn;
}
- $trait['crap'] = $this->crap(
- $trait['ccn'],
- $trait['coverage']
- );
+ $this->calcAndApplyClassAggregate($trait, $fqcn);
}
foreach ($this->classes as &$class) {
- foreach ($class['methods'] as &$method) {
- if ($method['executableLines'] > 0) {
- $method['coverage'] = ($method['executedLines'] /
- $method['executableLines']) * 100;
- } else {
- $method['coverage'] = 100;
- }
-
- $method['crap'] = $this->crap(
- $method['ccn'],
- $method['coverage']
- );
-
- $class['ccn'] += $method['ccn'];
+ $fqcn = $class['className'];
+ if (!empty($class['package']['namespace'])) {
+ $fqcn = $class['package']['namespace'] . '\\' . $fqcn;
}
- if ($class['executableLines'] > 0) {
- $class['coverage'] = ($class['executedLines'] /
- $class['executableLines']) * 100;
- } else {
- $class['coverage'] = 100;
- }
-
- if ($class['coverage'] == 100) {
- $this->numTestedClasses++;
- }
-
- $class['crap'] = $this->crap(
- $class['ccn'],
- $class['coverage']
- );
+ $this->calcAndApplyClassAggregate($class, $fqcn);
}
}
@@ -547,6 +540,8 @@ protected function processClasses(PHP_Token_Stream $tokens)
'startLine' => $class['startLine'],
'executableLines' => 0,
'executedLines' => 0,
+ 'executablePaths' => 0,
+ 'executedPaths' => 0,
'ccn' => 0,
'coverage' => 0,
'crap' => 0,
@@ -583,6 +578,8 @@ protected function processTraits(PHP_Token_Stream $tokens)
'startLine' => $trait['startLine'],
'executableLines' => 0,
'executedLines' => 0,
+ 'executablePaths' => 0,
+ 'executedPaths' => 0,
'ccn' => 0,
'coverage' => 0,
'crap' => 0,
@@ -619,6 +616,8 @@ protected function processFunctions(PHP_Token_Stream $tokens)
'startLine' => $function['startLine'],
'executableLines' => 0,
'executedLines' => 0,
+ 'executablePaths' => 0,
+ 'executedPaths' => 0,
'ccn' => $function['ccn'],
'coverage' => 0,
'crap' => 0,
@@ -672,10 +671,86 @@ private function newMethod($methodName, array $method, $link)
'endLine' => $method['endLine'],
'executableLines' => 0,
'executedLines' => 0,
+ 'executablePaths' => 0,
+ 'executedPaths' => 0,
'ccn' => $method['ccn'],
'coverage' => 0,
'crap' => 0,
'link' => $link . $method['startLine'],
];
}
+
+ /**
+ * @param string $paths
+ * @param int $functionExecutablePaths
+ * @param int $functionExecutedPaths
+ */
+ private function calcPathsAggregate($paths, &$functionExecutablePaths, &$functionExecutedPaths)
+ {
+ $functionExecutablePaths = count($paths);
+ $functionExecutedPaths = array_reduce(
+ $paths,
+ function ($carry, $value) {
+ return ($value['hit'] > 0) ? $carry + 1 : $carry;
+ },
+ 0
+ );
+ }
+
+ /**
+ * @param array $classOrTrait
+ * @param string $classOrTraitName
+ */
+ protected function calcAndApplyClassAggregate(&$classOrTrait, $classOrTraitName)
+ {
+ foreach ($classOrTrait['methods'] as &$method) {
+ if (isset($this->coverageData['branches'])) {
+ if ($method['methodName'] === 'anonymous function') {
+ // Locate index
+ $methodCoveragePath = $method['methodName'];
+ foreach ($this->coverageData['branches'] as $index => $branch) {
+ if ($method['startLine'] === $branch[0]['line_start']) {
+ $methodCoveragePath = $index;
+ }
+ }
+
+ } else {
+ $methodCoveragePath = $classOrTraitName . '->' . $method['methodName'];
+ }
+ if (isset($this->coverageData['paths'][$methodCoveragePath])) {
+ $methodPaths = $this->coverageData['paths'][$methodCoveragePath];
+ $this->calcPathsAggregate($methodPaths, $numExecutablePaths, $numExecutedPaths);
+
+ $method['executablePaths'] = $numExecutablePaths;
+ $classOrTrait['executablePaths'] += $numExecutablePaths;
+ $this->numExecutablePaths += $numExecutablePaths;
+
+ $method['executedPaths'] = $numExecutedPaths;
+ $classOrTrait['executedPaths'] += $numExecutedPaths;
+ $this->numExecutedPaths += $numExecutedPaths;
+ }
+ }
+ if ($method['executableLines'] > 0) {
+ $method['coverage'] = ($method['executedLines'] / $method['executableLines']) * 100;
+ } else {
+ $method['coverage'] = 100;
+ }
+
+ $method['crap'] = $this->crap($method['ccn'], $method['coverage']);
+
+ $classOrTrait['ccn'] += $method['ccn'];
+ }
+
+ if ($classOrTrait['executableLines'] > 0) {
+ $classOrTrait['coverage'] = ($classOrTrait['executedLines'] / $classOrTrait['executableLines']) * 100;
+ } else {
+ $classOrTrait['coverage'] = 100;
+ }
+
+ if ($classOrTrait['coverage'] == 100) {
+ $this->numTestedClasses++;
+ }
+
+ $classOrTrait['crap'] = $this->crap($classOrTrait['ccn'], $classOrTrait['coverage']);
+ }
}
diff --git a/src/CodeCoverage/Report/Text.php b/src/CodeCoverage/Report/Text.php
index d37a6d77c..409f209b2 100644
--- a/src/CodeCoverage/Report/Text.php
+++ b/src/CodeCoverage/Report/Text.php
@@ -55,6 +55,7 @@ public function process(PHP_CodeCoverage $coverage, $showColors = false)
'classes' => '',
'methods' => '',
'lines' => '',
+ 'paths' => '',
'reset' => '',
'eol' => ''
];
@@ -72,6 +73,10 @@ public function process(PHP_CodeCoverage $coverage, $showColors = false)
$report->getNumExecutedLines(),
$report->getNumExecutableLines()
);
+ $colors['paths'] = $this->getCoverageColor(
+ $report->getNumExecutedPaths(),
+ $report->getNumExecutablePaths()
+ );
$colors['reset'] = $this->colors['reset'];
$colors['header'] = $this->colors['header'];
$colors['eol'] = $this->colors['eol'];
@@ -110,6 +115,17 @@ public function process(PHP_CodeCoverage $coverage, $showColors = false)
$report->getNumExecutableLines()
);
+ $paths = sprintf(
+ ' Paths: %6s (%d/%d)',
+ PHP_CodeCoverage_Util::percent(
+ $report->getNumExecutedPaths(),
+ $report->getNumExecutablePaths(),
+ true
+ ),
+ $report->getNumExecutedPaths(),
+ $report->getNumExecutablePaths()
+ );
+
$padding = max(array_map('strlen', [$classes, $methods, $lines]));
if ($this->showOnlySummary) {
@@ -130,6 +146,7 @@ public function process(PHP_CodeCoverage $coverage, $showColors = false)
$output .= $this->format($colors['classes'], $padding, $classes);
$output .= $this->format($colors['methods'], $padding, $methods);
$output .= $this->format($colors['lines'], $padding, $lines);
+ $output .= $this->format($colors['paths'], $padding, $paths);
if ($this->showOnlySummary) {
return $output . PHP_EOL;
@@ -147,6 +164,8 @@ public function process(PHP_CodeCoverage $coverage, $showColors = false)
foreach ($classes as $className => $class) {
$classStatements = 0;
$coveredClassStatements = 0;
+ $classPaths = 0;
+ $coveredClassPaths = 0;
$coveredMethods = 0;
$classMethods = 0;
@@ -158,6 +177,8 @@ public function process(PHP_CodeCoverage $coverage, $showColors = false)
$classMethods++;
$classStatements += $method['executableLines'];
$coveredClassStatements += $method['executedLines'];
+ $classPaths += $method['executablePaths'];
+ $coveredClassPaths += $method['executedPaths'];
if ($method['coverage'] == 100) {
$coveredMethods++;
}
@@ -178,6 +199,8 @@ public function process(PHP_CodeCoverage $coverage, $showColors = false)
'methodCount' => $classMethods,
'statementsCovered' => $coveredClassStatements,
'statementCount' => $classStatements,
+ 'pathsCovered' => $coveredClassPaths,
+ 'pathCount' => $classPaths,
];
}
}
@@ -186,6 +209,7 @@ public function process(PHP_CodeCoverage $coverage, $showColors = false)
$methodColor = '';
$linesColor = '';
+ $pathsColor = '';
$resetColor = '';
foreach ($classCoverage as $fullQualifiedPath => $classInfo) {
@@ -194,12 +218,14 @@ public function process(PHP_CodeCoverage $coverage, $showColors = false)
if ($showColors) {
$methodColor = $this->getCoverageColor($classInfo['methodsCovered'], $classInfo['methodCount']);
$linesColor = $this->getCoverageColor($classInfo['statementsCovered'], $classInfo['statementCount']);
+ $pathsColor = $this->getCoverageColor($classInfo['pathsCovered'], $classInfo['pathCount']);
$resetColor = $colors['reset'];
}
$output .= PHP_EOL . $fullQualifiedPath . PHP_EOL
. ' ' . $methodColor . 'Methods: ' . $this->printCoverageCounts($classInfo['methodsCovered'], $classInfo['methodCount'], 2) . $resetColor . ' '
. ' ' . $linesColor . 'Lines: ' . $this->printCoverageCounts($classInfo['statementsCovered'], $classInfo['statementCount'], 3) . $resetColor
+ . ' ' . $pathsColor . ' Paths: ' . $this->printCoverageCounts($classInfo['pathsCovered'], $classInfo['pathCount'], 2) . $resetColor
;
}
}
diff --git a/src/CodeCoverage/Report/XML.php b/src/CodeCoverage/Report/XML.php
index ebdd7e284..cc936cfeb 100644
--- a/src/CodeCoverage/Report/XML.php
+++ b/src/CodeCoverage/Report/XML.php
@@ -114,8 +114,15 @@ private function processFile(PHP_CodeCoverage_Report_Node_File $file, PHP_CodeCo
$this->processFunction($function, $fileReport);
}
- foreach ($file->getCoverageData() as $line => $tests) {
- if (!is_array($tests) || count($tests) == 0) {
+ $fileData = $file->getCoverageData();
+
+ foreach ($fileData['lines'] as $line => $lineData) {
+ if ($lineData === null) {
+ continue;
+ }
+
+ $tests = $lineData['tests'];
+ if (empty($tests)) {
continue;
}
@@ -171,7 +178,9 @@ private function processUnit($unit, PHP_CodeCoverage_Report_XML_File_Report $rep
$methodObject->setTotals(
$method['executableLines'],
$method['executedLines'],
- $method['coverage']
+ $method['coverage'],
+ $method['executablePaths'],
+ $method['executedPaths']
);
}
}
@@ -183,7 +192,7 @@ private function processFunction($function, PHP_CodeCoverage_Report_XML_File_Rep
$functionObject->setSignature($function['signature']);
$functionObject->setLines($function['startLine']);
$functionObject->setCrap($function['crap']);
- $functionObject->setTotals($function['executableLines'], $function['executedLines'], $function['coverage']);
+ $functionObject->setTotals($function['executableLines'], $function['executedLines'], $function['coverage'], $function['executablePaths'], $function['executedPaths']);
}
private function processTests(array $tests)
@@ -216,6 +225,11 @@ private function setTotals(PHP_CodeCoverage_Report_Node $node, PHP_CodeCoverage_
$node->getNumTestedClasses()
);
+ $totals->setNumPaths(
+ $node->getNumExecutablePaths(),
+ $node->getNumExecutedPaths()
+ );
+
$totals->setNumTraits(
$node->getNumTraits(),
$node->getNumTestedTraits()
diff --git a/src/CodeCoverage/Report/XML/File/Method.php b/src/CodeCoverage/Report/XML/File/Method.php
index 917628fd1..08bca5bf4 100644
--- a/src/CodeCoverage/Report/XML/File/Method.php
+++ b/src/CodeCoverage/Report/XML/File/Method.php
@@ -44,11 +44,13 @@ public function setLines($start, $end = null)
}
}
- public function setTotals($executable, $executed, $coverage)
+ public function setTotals($executable, $executed, $coverage, $executablePaths, $executedPaths)
{
$this->contextNode->setAttribute('executable', $executable);
$this->contextNode->setAttribute('executed', $executed);
$this->contextNode->setAttribute('coverage', $coverage);
+ $this->contextNode->setAttribute('executablePaths', $executablePaths);
+ $this->contextNode->setAttribute('executedPaths', $executedPaths);
}
public function setCrap($crap)
diff --git a/src/CodeCoverage/Report/XML/Totals.php b/src/CodeCoverage/Report/XML/Totals.php
index d6073d95f..30fecfb54 100644
--- a/src/CodeCoverage/Report/XML/Totals.php
+++ b/src/CodeCoverage/Report/XML/Totals.php
@@ -23,6 +23,11 @@ class PHP_CodeCoverage_Report_XML_Totals
*/
private $linesNode;
+ /**
+ * @var DOMElement
+ */
+ private $pathsNode;
+
/**
* @var DOMElement
*/
@@ -53,6 +58,11 @@ public function __construct(DOMElement $container)
'lines'
);
+ $this->pathsNode = $dom->createElementNS(
+ 'http://schema.phpunit.de/coverage/1.0',
+ 'paths'
+ );
+
$this->methodsNode = $dom->createElementNS(
'http://schema.phpunit.de/coverage/1.0',
'methods'
@@ -74,6 +84,7 @@ public function __construct(DOMElement $container)
);
$container->appendChild($this->linesNode);
+ $container->appendChild($this->pathsNode);
$container->appendChild($this->methodsNode);
$container->appendChild($this->functionsNode);
$container->appendChild($this->classesNode);
@@ -98,6 +109,16 @@ public function setNumLines($loc, $cloc, $ncloc, $executable, $executed)
);
}
+ public function setNumPaths($count, $tested)
+ {
+ $this->pathsNode->setAttribute('count', $count);
+ $this->pathsNode->setAttribute('tested', $tested);
+ $this->pathsNode->setAttribute(
+ 'percent',
+ PHP_CodeCoverage_Util::percent($tested, $count, true)
+ );
+ }
+
public function setNumClasses($count, $tested)
{
$this->classesNode->setAttribute('count', $count);
diff --git a/tests/PHP/CodeCoverage/Report/FactoryTest.php b/tests/PHP/CodeCoverage/Report/FactoryTest.php
index 9d1aeba60..33dbe97d9 100644
--- a/tests/PHP/CodeCoverage/Report/FactoryTest.php
+++ b/tests/PHP/CodeCoverage/Report/FactoryTest.php
@@ -57,6 +57,8 @@ public function testSomething()
'endLine' => 9,
'executableLines' => 1,
'executedLines' => 1,
+ 'executablePaths' => 1,
+ 'executedPaths' => 1,
'ccn' => 1,
'coverage' => 100,
'crap' => '1',
@@ -70,6 +72,8 @@ public function testSomething()
'endLine' => 18,
'executableLines' => 5,
'executedLines' => 0,
+ 'executablePaths' => 2,
+ 'executedPaths' => 0,
'ccn' => 2,
'coverage' => 0,
'crap' => 6,
@@ -83,6 +87,8 @@ public function testSomething()
'endLine' => 25,
'executableLines' => 2,
'executedLines' => 2,
+ 'executablePaths' => 1,
+ 'executedPaths' => 0,
'ccn' => 1,
'coverage' => 100,
'crap' => '1',
@@ -96,6 +102,8 @@ public function testSomething()
'endLine' => 32,
'executableLines' => 2,
'executedLines' => 2,
+ 'executablePaths' => 1,
+ 'executedPaths' => 0,
'ccn' => 1,
'coverage' => 100,
'crap' => '1',
@@ -107,6 +115,8 @@ public function testSomething()
'startLine' => 2,
'executableLines' => 10,
'executedLines' => 5,
+ 'executablePaths' => 5,
+ 'executedPaths' => 1,
'ccn' => 5,
'coverage' => 50,
'crap' => '8.12',
diff --git a/tests/PHP/CodeCoverageTest.php b/tests/PHP/CodeCoverageTest.php
index df8dfe41b..ca144bdf1 100644
--- a/tests/PHP/CodeCoverageTest.php
+++ b/tests/PHP/CodeCoverageTest.php
@@ -262,8 +262,14 @@ public function testMerge()
$coverage = $this->getCoverageForBankAccountForFirstTwoTests();
$coverage->merge($this->getCoverageForBankAccountForLastTwoTests());
+ $expectedData = $this->getExpectedDataArrayForBankAccount();
+ $expectedData[TEST_FILES_PATH . 'BankAccount.php']['branches']['BankAccount->getBalance'][0]['tests'] = [
+ 'BankAccountTest::testBalanceIsInitiallyZero',
+ 'BankAccountTest::testBalanceCannotBecomeNegative',
+ ];
+
$this->assertEquals(
- $this->getExpectedDataArrayForBankAccount(),
+ $expectedData,
$coverage->getData()
);
}
diff --git a/tests/TestCase.php b/tests/TestCase.php
index d03585cef..f25436583 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -28,51 +28,210 @@ public static function setUpBeforeClass()
protected function getXdebugDataForBankAccount()
{
+ $bankAccountFunctions = [
+ 'BankAccount->depositMoney' => [
+ 'branches' => [
+ 0 => [
+ 'op_start' => 0,
+ 'op_end' => 20,
+ 'line_start' => 20,
+ 'line_end' => 25,
+ 'hit' => 0,
+ 'out' => [
+ ],
+ 'out_hit' => [
+ ],
+ ],
+ ],
+ 'paths' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ ],
+ 'hit' => 0,
+ ],
+ ],
+ ],
+ 'BankAccount->getBalance' => [
+ 'branches' => [
+ 0 => [
+ 'op_start' => 0,
+ 'op_end' => 5,
+ 'line_start' => 6,
+ 'line_end' => 9,
+ 'hit' => 1,
+ 'out' => [
+ ],
+ 'out_hit' => [
+ ],
+ ],
+ ],
+ 'paths' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ ],
+ 'hit' => 1,
+ ],
+ ],
+ ],
+ 'BankAccount->withdrawMoney' => [
+ 'branches' => [
+ 0 => [
+ 'op_start' => 0,
+ 'op_end' => 20,
+ 'line_start' => 27,
+ 'line_end' => 32,
+ 'hit' => 0,
+ 'out' => [
+ ],
+ 'out_hit' => [
+ ],
+ ],
+ ],
+ 'paths' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ ],
+ 'hit' => 0,
+ ],
+ ],
+ ],
+ 'BankAccount->setBalance' => [
+ 'branches' => [
+ 0 => [
+ 'op_start' => 0,
+ 'op_end' => 4,
+ 'line_start' => 11,
+ 'line_end' => 13,
+ 'hit' => 0,
+ 'out' => [
+ 0 => 5,
+ 1 => 9,
+ ],
+ 'out_hit' => [
+ 0 => 0,
+ 1 => 0,
+ ],
+ ],
+ 5 => [
+ 'op_start' => 5,
+ 'op_end' => 8,
+ 'line_start' => 14,
+ 'line_end' => 15,
+ 'hit' => 0,
+ 'out' => [
+ 0 => 16,
+ ],
+ 'out_hit' => [
+ 0 => 0,
+ ],
+ ],
+ 9 => [
+ 'op_start' => 9,
+ 'op_end' => 15,
+ 'line_start' => 16,
+ 'line_end' => 16,
+ 'hit' => 0,
+ 'out' => [
+ 0 => 2147483645,
+ ],
+ 'out_hit' => [
+ 0 => 0,
+ ],
+ ],
+ 16 => [
+ 'op_start' => 16,
+ 'op_end' => 17,
+ 'line_start' => 18,
+ 'line_end' => 18,
+ 'hit' => 0,
+ 'out' => [
+ 0 => 2147483645,
+ ],
+ 'out_hit' => [
+ 0 => 0,
+ ],
+ ],
+ ],
+ 'paths' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ 1 => 5,
+ 2 => 16,
+ ],
+ 'hit' => 0,
+ ],
+ 1 => [
+ 'path' => [
+ 0 => 0,
+ 1 => 9,
+ ],
+ 'hit' => 0,
+ ],
+ ],
+ ],
+ ];
+
return [
[
TEST_FILES_PATH . 'BankAccount.php' => [
- 8 => 1,
- 9 => -2,
- 13 => -1,
- 14 => -1,
- 15 => -1,
- 16 => -1,
- 18 => -1,
- 22 => -1,
- 24 => -1,
- 25 => -2,
- 29 => -1,
- 31 => -1,
- 32 => -2
+ 'lines' => [
+ 8 => 1,
+ 9 => -2,
+ 13 => -1,
+ 14 => -1,
+ 15 => -1,
+ 16 => -1,
+ 18 => -1,
+ 22 => -1,
+ 24 => -1,
+ 25 => -2,
+ 29 => -1,
+ 31 => -1,
+ 32 => -2,
+ ],
+ 'functions' => $bankAccountFunctions,
]
],
[
TEST_FILES_PATH . 'BankAccount.php' => [
- 8 => 1,
- 13 => 1,
- 16 => 1,
- 29 => 1,
+ 'lines' => [
+ 8 => 1,
+ 13 => 1,
+ 16 => 1,
+ 29 => 1,
+ ],
+ 'functions' => $bankAccountFunctions,
]
],
[
TEST_FILES_PATH . 'BankAccount.php' => [
- 8 => 1,
- 13 => 1,
- 16 => 1,
- 22 => 1,
+ 'lines' => [
+ 8 => 1,
+ 13 => 1,
+ 16 => 1,
+ 22 => 1,
+ ],
+ 'functions' => $bankAccountFunctions,
]
],
[
TEST_FILES_PATH . 'BankAccount.php' => [
- 8 => 1,
- 13 => 1,
- 14 => 1,
- 15 => 1,
- 18 => 1,
- 22 => 1,
- 24 => 1,
- 29 => 1,
- 31 => 1,
+ 'lines' => [
+ 8 => 1,
+ 13 => 1,
+ 14 => 1,
+ 15 => 1,
+ 18 => 1,
+ 22 => 1,
+ 24 => 1,
+ 29 => 1,
+ 31 => 1,
+ ],
+ 'functions' => $bankAccountFunctions,
]
]
];
@@ -231,32 +390,164 @@ protected function getExpectedDataArrayForBankAccount()
{
return [
TEST_FILES_PATH . 'BankAccount.php' => [
- 8 => [
- 0 => 'BankAccountTest::testBalanceIsInitiallyZero',
- 1 => 'BankAccountTest::testDepositWithdrawMoney'
- ],
- 9 => null,
- 13 => [],
- 14 => [],
- 15 => [],
- 16 => [],
- 18 => [],
- 22 => [
- 0 => 'BankAccountTest::testBalanceCannotBecomeNegative2',
- 1 => 'BankAccountTest::testDepositWithdrawMoney'
- ],
- 24 => [
- 0 => 'BankAccountTest::testDepositWithdrawMoney',
+ 'lines' => [
+ 8 => [
+ 'pathCovered' => true,
+ 'tests' => [
+ 0 => 'BankAccountTest::testBalanceIsInitiallyZero',
+ 1 => 'BankAccountTest::testDepositWithdrawMoney',
+ ],
+ ],
+ 9 => null,
+ 13 => [
+ 'pathCovered' => false,
+ 'tests' => [],
+ ],
+ 14 => [
+ 'pathCovered' => false,
+ 'tests' => [],
+ ],
+ 15 => [
+ 'pathCovered' => false,
+ 'tests' => [],
+ ],
+ 16 => [
+ 'pathCovered' => false,
+ 'tests' => [],
+ ],
+ 18 => [
+ 'pathCovered' => false,
+ 'tests' => [],
+ ],
+ 22 => [
+ 'pathCovered' => false,
+ 'tests' => [
+ 0 => 'BankAccountTest::testBalanceCannotBecomeNegative2',
+ 1 => 'BankAccountTest::testDepositWithdrawMoney',
+ ],
+ ],
+ 24 => [
+ 'pathCovered' => false,
+ 'tests' => [
+ 0 => 'BankAccountTest::testDepositWithdrawMoney',
+ ],
+ ],
+ 25 => null,
+ 29 => [
+ 'pathCovered' => false,
+ 'tests' => [
+ 0 => 'BankAccountTest::testBalanceCannotBecomeNegative',
+ 1 => 'BankAccountTest::testDepositWithdrawMoney',
+ ],
+ ],
+ 31 => [
+ 'pathCovered' => false,
+ 'tests' => [
+ 0 => 'BankAccountTest::testDepositWithdrawMoney',
+ ],
+ ],
+ 32 => null,
],
- 25 => null,
- 29 => [
- 0 => 'BankAccountTest::testBalanceCannotBecomeNegative',
- 1 => 'BankAccountTest::testDepositWithdrawMoney'
+ 'branches' => [
+ 'BankAccount->depositMoney' => [
+ 0 => [
+ 'line_start' => 20,
+ 'line_end' => 25,
+ 'tests' => [],
+ 'hit' => 0,
+ ],
+ ],
+ 'BankAccount->getBalance' => [
+ 0 => [
+ 'line_start' => 6,
+ 'line_end' => 9,
+ 'tests' => [
+ 'BankAccountTest::testBalanceIsInitiallyZero',
+ 'BankAccountTest::testBalanceCannotBecomeNegative',
+ 'BankAccountTest::testBalanceCannotBecomeNegative2',
+ 'BankAccountTest::testDepositWithdrawMoney',
+ ],
+ 'hit' => 1,
+ ],
+ ],
+ 'BankAccount->withdrawMoney' => [
+ 0 => [
+ 'line_start' => 27,
+ 'line_end' => 32,
+ 'tests' => [],
+ 'hit' => 0,
+ ],
+ ],
+ 'BankAccount->setBalance' => [
+ 0 => [
+ 'line_start' => 11,
+ 'line_end' => 13,
+ 'tests' => [],
+ 'hit' => 0,
+ ],
+ 5 => [
+ 'line_start' => 14,
+ 'line_end' => 15,
+ 'tests' => [],
+ 'hit' => 0,
+ ],
+ 9 => [
+ 'line_start' => 16,
+ 'line_end' => 16,
+ 'tests' => [],
+ 'hit' => 0,
+ ],
+ 16 => [
+ 'line_start' => 18,
+ 'line_end' => 18,
+ 'tests' => [],
+ 'hit' => 0,
+ ],
+ ],
],
- 31 => [
- 0 => 'BankAccountTest::testDepositWithdrawMoney'
+ 'paths' => [
+ 'BankAccount->depositMoney' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ ],
+ 'hit' => 0,
+ ],
+ ],
+ 'BankAccount->getBalance' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ ],
+ 'hit' => 1,
+ ],
+ ],
+ 'BankAccount->withdrawMoney' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ ],
+ 'hit' => 0,
+ ],
+ ],
+ 'BankAccount->setBalance' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ 1 => 5,
+ 2 => 16,
+ ],
+ 'hit' => 0,
+ ],
+ 1 => [
+ 'path' => [
+ 0 => 0,
+ 1 => 9,
+ ],
+ 'hit' => 0,
+ ],
+ ],
],
- 32 => null
]
];
}
@@ -285,10 +576,89 @@ protected function setUpXdebugStubForFileWithIgnoredLines()
->will($this->returnValue(
[
TEST_FILES_PATH . 'source_with_ignore.php' => [
- 2 => 1,
- 4 => -1,
- 6 => -1,
- 7 => 1
+ 'lines' => [
+ 2 => 1,
+ 4 => -1,
+ 6 => -1,
+ 7 => 1,
+ ],
+ 'functions' => [
+ 'Bar->foo' => [
+ 'branches' => [
+ 0 => [
+ 'op_start' => 0,
+ 'op_end' => 2,
+ 'line_start' => 23,
+ 'line_end' => 25,
+ 'hit' => 0,
+ 'out' => [
+ 0 => 2147483645,
+ ],
+ 'out_hit' => [
+ 0 => 0,
+ ],
+ ],
+ ],
+ 'paths' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ ],
+ 'hit' => 0,
+ ],
+ ],
+ ],
+ 'Foo->bar' => [
+ 'branches' => [
+ 0 => [
+ 'op_start' => 0,
+ 'op_end' => 2,
+ 'line_start' => 13,
+ 'line_end' => 15,
+ 'hit' => 0,
+ 'out' => [
+ 0 => 2147483645,
+ ],
+ 'out_hit' => [
+ 0 => 0,
+ ],
+ ],
+ ],
+ 'paths' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ ],
+ 'hit' => 0,
+ ],
+ ],
+ ],
+ 'baz' => [
+ 'branches' => [
+ 0 => [
+ 'op_start' => 0,
+ 'op_end' => 5,
+ 'line_start' => 28,
+ 'line_end' => 31,
+ 'hit' => 0,
+ 'out' => [
+ 0 => 2147483645,
+ ],
+ 'out_hit' => [
+ 0 => 0,
+ ],
+ ],
+ ],
+ 'paths' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ ],
+ 'hit' => 0,
+ ],
+ ],
+ ],
+ ],
]
]
));
@@ -320,15 +690,69 @@ protected function setUpXdebugStubForClassWithAnonymousFunction()
->will($this->returnValue(
[
TEST_FILES_PATH . 'source_with_class_and_anonymous_function.php' => [
- 7 => 1,
- 9 => 1,
- 10 => -1,
- 11 => 1,
- 12 => 1,
- 13 => 1,
- 14 => 1,
- 17 => 1,
- 18 => 1
+ 'lines' => [
+ 7 => 1,
+ 9 => 1,
+ 10 => -1,
+ 11 => 1,
+ 12 => 1,
+ 13 => 1,
+ 14 => 1,
+ 17 => 1,
+ 18 => 1,
+ ],
+ 'functions' => [
+ 'CoveredClassWithAnonymousFunctionInStaticMethod->runAnonymous' => [
+ 'branches' => [
+ 0 => [
+ 'op_start' => 0,
+ 'op_end' => 16,
+ 'line_start' => 5,
+ 'line_end' => 18,
+ 'hit' => 0,
+ 'out' => [
+ 0 => 2147483645,
+ ],
+ 'out_hit' => [
+ 0 => 0,
+ ],
+ ],
+ ],
+ 'paths' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ ],
+ 'hit' => 0,
+ ],
+ ],
+ ],
+ '{closure:' . TEST_FILES_PATH . 'source_with_class_and_anonymous_function.php:11-13}' => [
+ 'branches' => [
+ 0 => [
+ 'op_start' => 0,
+ 'op_end' => 12,
+ 'line_start' => 11,
+ 'line_end' => 13,
+ 'hit' => 0,
+ 'out' => [
+ 0 => 2147483645,
+ ],
+ 'out_hit' => [
+ 0 => 0,
+ ],
+ ],
+ ],
+ 'paths' => [
+ 0 => [
+ 'path' => [
+ 0 => 0,
+ ],
+ 'hit' => 0,
+ ],
+ ],
+ ],
+ ],
]
]
));
diff --git a/tests/_files/BankAccount-clover.xml b/tests/_files/BankAccount-clover.xml
index 0986fdf71..b39cc51dd 100644
--- a/tests/_files/BankAccount-clover.xml
+++ b/tests/_files/BankAccount-clover.xml
@@ -3,7 +3,7 @@
-
+
@@ -19,8 +19,8 @@
-
+
-
+
diff --git a/tests/_files/BankAccount-text.txt b/tests/_files/BankAccount-text.txt
index 892d83464..31991cc7b 100644
--- a/tests/_files/BankAccount-text.txt
+++ b/tests/_files/BankAccount-text.txt
@@ -7,6 +7,7 @@ Code Coverage Report:
Classes: 0.00% (0/1)
Methods: 75.00% (3/4)
Lines: 50.00% (5/10)
+ Paths: 20.00% (1/5)
BankAccount
- Methods: 75.00% ( 3/ 4) Lines: 50.00% ( 5/ 10)
+ Methods: 75.00% ( 3/ 4) Lines: 50.00% ( 5/ 10) Paths: 20.00% ( 1/ 5)
diff --git a/tests/_files/Report/HTML/CoverageForBankAccount/BankAccount.php.html b/tests/_files/Report/HTML/CoverageForBankAccount/BankAccount.php.html
index a5dcd4c2b..b3895de1f 100644
--- a/tests/_files/Report/HTML/CoverageForBankAccount/BankAccount.php.html
+++ b/tests/_files/Report/HTML/CoverageForBankAccount/BankAccount.php.html
@@ -30,12 +30,13 @@
|
- Code Coverage |
+ Code Coverage |
|
Classes and Traits |
Functions and Methods |
+ Paths |
Lines |
@@ -59,6 +60,14 @@
75.00% |
3 / 4 |
CRAP |
+
+
+ 20.00% covered (danger)
+
+
+ |
+ 20.00% |
+ 1 / 5 |
50.00% covered (danger)
@@ -88,6 +97,14 @@
75.00% |
3 / 4 |
8.12 |
+
+
+ 20.00% covered (danger)
+
+
+ |
+ 20.00% |
+ 1 / 5 |
50.00% covered (danger)
@@ -114,6 +131,14 @@
100.00% covered (success)
+ |
+ 100.00% |
+ 1 / 1 |
+
+
+ 100.00% covered (success)
+
+
|
100.00% |
1 / 1 |
@@ -135,6 +160,14 @@
0.00% covered (danger)
+ |
+ 0.00% |
+ 0 / 2 |
+
+
+ 0.00% covered (danger)
+
+
|
0.00% |
0 / 5 |
@@ -151,6 +184,14 @@
100.00% |
1 / 1 |
1 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 1 |
100.00% covered (success)
@@ -172,6 +213,14 @@
100.00% |
1 / 1 |
1 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 1 |
100.00% covered (success)
diff --git a/tests/_files/Report/HTML/CoverageForBankAccount/index.html b/tests/_files/Report/HTML/CoverageForBankAccount/index.html
index 5c99c2e42..ad0df9c7c 100644
--- a/tests/_files/Report/HTML/CoverageForBankAccount/index.html
+++ b/tests/_files/Report/HTML/CoverageForBankAccount/index.html
@@ -30,11 +30,12 @@
|
- Code Coverage |
+ Code Coverage |
|
Lines |
+ Paths |
Functions and Methods |
Classes and Traits |
@@ -50,6 +51,14 @@
50.00% |
5 / 10 |
+
+
+ 20.00% covered (danger)
+
+
+ |
+ 20.00% |
+ 1 / 5 |
75.00% covered (warning)
@@ -78,6 +87,14 @@
|
50.00% |
5 / 10 |
+
+
+ 20.00% covered (danger)
+
+
+ |
+ 20.00% |
+ 1 / 5 |
75.00% covered (warning)
diff --git a/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/index.html b/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/index.html
index ace676be4..9600f6d70 100644
--- a/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/index.html
+++ b/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/index.html
@@ -30,11 +30,12 @@
|
- Code Coverage |
+ Code Coverage |
|
Lines |
+ Paths |
Functions and Methods |
Classes and Traits |
@@ -50,6 +51,14 @@
87.50% |
7 / 8 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 2 |
50.00% covered (danger)
@@ -78,6 +87,14 @@
|
87.50% |
7 / 8 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 2 |
50.00% covered (danger)
diff --git a/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html b/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html
index ce90096b9..ef6f4883f 100644
--- a/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html
+++ b/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html
@@ -30,12 +30,13 @@
|
- Code Coverage |
+ Code Coverage |
|
Classes and Traits |
Functions and Methods |
+ Paths |
Lines |
@@ -59,6 +60,14 @@
50.00% |
1 / 2 |
CRAP |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 2 |
87.50% covered (warning)
@@ -88,6 +97,14 @@
50.00% |
1 / 2 |
2.01 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 2 |
87.50% covered (warning)
@@ -109,6 +126,14 @@
0.00% |
0 / 1 |
1.04 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 1 |
66.67% covered (warning)
@@ -130,6 +155,14 @@
100.00% |
1 / 1 |
1 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 1 |
100.00% covered (success)
diff --git a/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/index.html b/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/index.html
index 2687444ff..85d69a488 100644
--- a/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/index.html
+++ b/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/index.html
@@ -30,11 +30,12 @@
|
- Code Coverage |
+ Code Coverage |
|
Lines |
+ Paths |
Functions and Methods |
Classes and Traits |
@@ -50,6 +51,14 @@
50.00% |
1 / 2 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 3 |
100.00% covered (success)
@@ -78,6 +87,14 @@
|
50.00% |
1 / 2 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 3 |
100.00% covered (success)
diff --git a/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html b/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html
index 251b5c309..efaa4a20f 100644
--- a/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html
+++ b/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html
@@ -30,12 +30,13 @@
|
- Code Coverage |
+ Code Coverage |
|
Classes and Traits |
Functions and Methods |
+ Paths |
Lines |
@@ -59,6 +60,14 @@
100.00% |
0 / 0 |
CRAP |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 3 |
50.00% covered (danger)
@@ -80,6 +89,14 @@
100.00% |
1 / 1 |
0 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 1 |
100.00% covered (success)
@@ -109,6 +126,14 @@
100.00% |
1 / 1 |
1 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 1 |
100.00% covered (success)
@@ -130,6 +155,14 @@
100.00% |
1 / 1 |
1 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 1 |
100.00% covered (success)
@@ -159,6 +192,14 @@
100.00% |
1 / 1 |
1 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 1 |
100.00% covered (success)
@@ -180,6 +221,14 @@
100.00% |
1 / 1 |
1 |
+
+
+ 0.00% covered (danger)
+
+
+ |
+ 0.00% |
+ 0 / 1 |
100.00% covered (success)
diff --git a/tests/_files/Report/XML/CoverageForBankAccount/BankAccount.php.xml b/tests/_files/Report/XML/CoverageForBankAccount/BankAccount.php.xml
index d5c5d2e5f..3d7456d97 100644
--- a/tests/_files/Report/XML/CoverageForBankAccount/BankAccount.php.xml
+++ b/tests/_files/Report/XML/CoverageForBankAccount/BankAccount.php.xml
@@ -3,6 +3,7 @@
+
@@ -11,10 +12,10 @@
-
-
-
-
+
+
+
+
diff --git a/tests/_files/Report/XML/CoverageForBankAccount/index.xml b/tests/_files/Report/XML/CoverageForBankAccount/index.xml
index 27fc5b405..63f2f02d7 100644
--- a/tests/_files/Report/XML/CoverageForBankAccount/index.xml
+++ b/tests/_files/Report/XML/CoverageForBankAccount/index.xml
@@ -10,6 +10,7 @@
+
@@ -18,6 +19,7 @@
+
diff --git a/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/index.xml b/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/index.xml
index 6f9cd19c4..e8b6188f0 100644
--- a/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/index.xml
+++ b/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/index.xml
@@ -7,6 +7,7 @@
+
@@ -15,6 +16,7 @@
+
diff --git a/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.xml b/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.xml
index d42452474..6cfed67bf 100644
--- a/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.xml
+++ b/tests/_files/Report/XML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.xml
@@ -3,6 +3,7 @@
+
@@ -11,8 +12,8 @@
-
-
+
+
diff --git a/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/index.xml b/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/index.xml
index 35c0745d5..a466509e8 100644
--- a/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/index.xml
+++ b/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/index.xml
@@ -7,6 +7,7 @@
+
@@ -15,6 +16,7 @@
+
diff --git a/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/source_with_ignore.php.xml b/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/source_with_ignore.php.xml
index 509990f87..1b6a2f1e1 100644
--- a/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/source_with_ignore.php.xml
+++ b/tests/_files/Report/XML/CoverageForFileWithIgnoredLines/source_with_ignore.php.xml
@@ -3,6 +3,7 @@
+
@@ -11,14 +12,14 @@
-
+
-
+
-
+
diff --git a/tests/_files/class-with-anonymous-function-clover.xml b/tests/_files/class-with-anonymous-function-clover.xml
index d6a8b4085..2c33d0a50 100644
--- a/tests/_files/class-with-anonymous-function-clover.xml
+++ b/tests/_files/class-with-anonymous-function-clover.xml
@@ -3,7 +3,7 @@
-
+
@@ -15,8 +15,8 @@
-
+
-
+
diff --git a/tests/_files/class-with-anonymous-function-text.txt b/tests/_files/class-with-anonymous-function-text.txt
index 0eb257e5f..81d42abfb 100644
--- a/tests/_files/class-with-anonymous-function-text.txt
+++ b/tests/_files/class-with-anonymous-function-text.txt
@@ -7,6 +7,7 @@ Code Coverage Report:
Classes: 0.00% (0/1)
Methods: 50.00% (1/2)
Lines: 87.50% (7/8)
+ Paths: 0.00% (0/2)
CoveredClassWithAnonymousFunctionInStaticMethod
- Methods: 50.00% ( 1/ 2) Lines: 80.00% ( 4/ 5)
+ Methods: 50.00% ( 1/ 2) Lines: 80.00% ( 4/ 5) Paths: 0.00% ( 0/ 2)
diff --git a/tests/_files/ignored-lines-clover.xml b/tests/_files/ignored-lines-clover.xml
index 81a9aaa3d..bd72ae967 100644
--- a/tests/_files/ignored-lines-clover.xml
+++ b/tests/_files/ignored-lines-clover.xml
@@ -3,15 +3,15 @@
-
+
-
+
-
+
-
+
diff --git a/tests/_files/ignored-lines-text.txt b/tests/_files/ignored-lines-text.txt
index 428303873..5728c3b4c 100644
--- a/tests/_files/ignored-lines-text.txt
+++ b/tests/_files/ignored-lines-text.txt
@@ -7,4 +7,5 @@ Code Coverage Report:
Classes: 100.00% (2/2)
Methods: (0/0)
Lines: 50.00% (1/2)
+ Paths: 0.00% (0/3)
| | | | | | | | | | | | | | |