Skip to content

Commit

Permalink
Additional cleanup now that php-code-coverage v9 isn't supported anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug committed Apr 3, 2024
1 parent dc85876 commit 936e515
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
4 changes: 0 additions & 4 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ By default uncovered files are **included** but not **processed**.
DVDoug\Behat\CodeCoverage\Extension:
filter:
includeUncoveredFiles: true # defaults to true
processUncoveredFiles: false # defaults to false
* *Included* means that the file is incorporated into the reporting, showing up as 0% covered. This allows you to see
files that you haven't written any tests for yet. If you choose not to include uncovered files, then only files that
Expand All @@ -78,9 +77,6 @@ By default uncovered files are **included** but not **processed**.
may have runtime side-effects. Because Behat Code Coverage cannot know the structure of your codebase and which files
are safe to ``include()`` and which are not, by default uncovered file processing is disabled for safety reasons.

.. note::
The ``processUncoveredFiles`` setting has been removed in php-code-coverage v10, configuring it here is deprecated

Reports
-------
Behat Code Coverage allows you to generate reports in any/all of the report formats provided by ``php-code-coverage``.
Expand Down
12 changes: 1 addition & 11 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
use DVDoug\Behat\CodeCoverage\Subscriber\EventSubscriber;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\Selector;
use SebastianBergmann\CodeCoverage\Driver\Xdebug2NotEnabledException;
use SebastianBergmann\CodeCoverage\Driver\Xdebug3NotEnabledException;
use SebastianBergmann\CodeCoverage\Driver\XdebugNotAvailableException;
use SebastianBergmann\CodeCoverage\Driver\XdebugNotEnabledException;
use SebastianBergmann\CodeCoverage\Filter;
Expand Down Expand Up @@ -202,7 +200,7 @@ public function process(ContainerBuilder $container): void
$filterDefinition = $container->getDefinition(Filter::class);
$codeCoverageDefinition->setFactory([new Reference(self::class), 'initCodeCoverage']);
$codeCoverageDefinition->setArguments([$filterDefinition, $filterConfig, $branchPathConfig, $cacheDir, $output]);
} catch (NoCodeCoverageDriverAvailableException|Xdebug2NotEnabledException|Xdebug3NotEnabledException|XdebugNotEnabledException|XdebugNotAvailableException $e) {
} catch (NoCodeCoverageDriverAvailableException|XdebugNotEnabledException|XdebugNotAvailableException $e) {
$output->writeln("<comment>No code coverage driver is available. {$e->getMessage()}</comment>");
$canCollectCodeCoverage = false;
}
Expand Down Expand Up @@ -265,14 +263,6 @@ public function initCodeCoverage(Filter $filter, array $filterConfig, ?bool $bra
$codeCoverage->excludeUncoveredFiles();
}

if (InstalledVersions::satisfies(new VersionParser(), 'phpunit/php-code-coverage', '^9.0')) {
if ($filterConfig['processUncoveredFiles']) {
$codeCoverage->processUncoveredFiles();
} else {
$codeCoverage->doNotProcessUncoveredFiles();
}
}

return $codeCoverage;
}
}

0 comments on commit 936e515

Please sign in to comment.