Skip to content

Commit

Permalink
Use PCOV's built-in filter
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug authored and sebastianbergmann committed May 13, 2020
1 parent 48b9ad2 commit c0fb088
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/CodeCoverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ private function selectDriver(Filter $filter): Driver
}

if ($runtime->hasPCOV()) {
return new PCOV;
return new PCOV($filter);
}

if ($runtime->hasXdebug()) {
Expand Down
21 changes: 14 additions & 7 deletions src/Driver/PCOV.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@
*/
namespace SebastianBergmann\CodeCoverage\Driver;

use SebastianBergmann\CodeCoverage\Filter;

/**
* Driver for PCOV code coverage functionality.
*/
final class PCOV implements Driver
{
/**
* @var Filter
*/
private $filter;

public function __construct(Filter $filter)
{
$this->filter = $filter;
}

/**
* Start collection of code coverage information.
*/
Expand All @@ -29,14 +41,9 @@ public function stop(): array
{
\pcov\stop();

$waiting = \pcov\waiting();
$collect = [];

if ($waiting) {
$collect = \pcov\collect(\pcov\inclusive, $waiting);
$collect = \pcov\collect(\pcov\inclusive, $this->filter->getWhitelist());

\pcov\clear();
}
\pcov\clear();

return $collect;
}
Expand Down

0 comments on commit c0fb088

Please sign in to comment.