Skip to content

Commit e8c60c7

Browse files
committed
Fix tests
1 parent 800227d commit e8c60c7

File tree

3 files changed

+381
-4
lines changed

3 files changed

+381
-4
lines changed

src/CodeCoverage.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public function merge(PHP_CodeCoverage $that)
355355
foreach ($that->getData() as $file => $fileData) {
356356
if (!isset($this->data[$file])) {
357357
if (!$that->filter()->isFiltered($file)) {
358-
$this->data[$file] = ['lines' => $fileData['lines']];
358+
$this->data[$file] = $fileData;
359359
}
360360

361361
continue;
@@ -512,7 +512,10 @@ private function applyCoversAnnotationFilter(array &$data, $linesToBeCovered, ar
512512
{
513513
if ($linesToBeCovered === false ||
514514
($this->forceCoversAnnotation && empty($linesToBeCovered))) {
515-
$data = ['lines' => []];
515+
$data = [
516+
'lines' => [],
517+
'functions' => [],
518+
];
516519

517520
return;
518521
}
@@ -638,7 +641,10 @@ private function addUncoveredFilesFromWhitelist()
638641
$uncoveredFiles
639642
);
640643
} else {
641-
$data[$uncoveredFile] = ['lines' => []];
644+
$data[$uncoveredFile] = [
645+
'lines' => [],
646+
'functions' => [],
647+
];
642648

643649
$lines = count(file($uncoveredFile));
644650

@@ -671,7 +677,7 @@ private function processUncoveredFileFromWhitelist($uncoveredFile, array &$data,
671677
}
672678
}
673679

674-
$data[$file] = ['lines' => $fileCoverage];
680+
$data[$file] = $fileCoverage;
675681
}
676682
}
677683
}

src/CodeCoverage/Driver/Xdebug.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ private function cleanup(array $data)
7878
if (!isset($data[$file]['lines'])) {
7979
$data[$file] = ['lines' => $data[$file]];
8080
}
81+
if (!isset($data[$file]['functions'])) {
82+
$data[$file]['functions'] = [];
83+
}
8184

8285
unset($data[$file]['lines'][0]);
8386

0 commit comments

Comments
 (0)