Skip to content

Commit

Permalink
Align implementation with addUncoveredFilesFromFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug authored and sebastianbergmann committed Aug 24, 2020
1 parent 7e91099 commit 0a39bae
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/CodeCoverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use function explode;
use function file_exists;
use function get_class;
use function in_array;
use function is_array;
use function sort;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -503,7 +502,7 @@ private function addUncoveredFilesFromFilter(): void
{
$uncoveredFiles = array_diff(
$this->filter->files(),
array_keys($this->data->lineCoverage())
$this->data->coveredFiles()
);

foreach ($uncoveredFiles as $uncoveredFile) {
Expand All @@ -524,13 +523,18 @@ private function addUncoveredFilesFromFilter(): void
*/
private function processUncoveredFilesFromFilter(): void
{
$coveredFiles = $this->data->coveredFiles();
$uncoveredFiles = array_diff(
$this->filter->files(),
$this->data->coveredFiles()
);

$this->driver->start();

foreach ($this->filter->files() as $file) {
if (!in_array($file, $coveredFiles, true) && $this->filter->isFile($file)) {
include_once $file;
foreach ($uncoveredFiles as $uncoveredFile) {
if (file_exists($uncoveredFile)) {
include_once $file;
}
}
}

Expand Down

0 comments on commit 0a39bae

Please sign in to comment.