Skip to content

Custom code coverage driver support#6586

Draft
sebastianbergmann wants to merge 1 commit intomainfrom
feature/code-coverage-driver-configuration
Draft

Custom code coverage driver support#6586
sebastianbergmann wants to merge 1 commit intomainfrom
feature/code-coverage-driver-configuration

Conversation

@sebastianbergmann
Copy link
Copy Markdown
Owner

This proposes the ability to specify a custom code coverage driver class in the XML configuration file, instead of relying on php-code-coverage's automatic driver selection.

A driver attribute is to the <coverage> element:

<coverage driver="My\Custom\Driver">
    <!-- ... -->
</coverage>

The specified class must

  • exist and be autoloadable,
  • extend SebastianBergmann\CodeCoverage\Driver\Driver, and
  • be instantiable (not abstract)

If the driver's constructor requires parameters, PHPUnit will pass the coverage Filter as the first argument. If it takes no required parameters, it is instantiated with no arguments. Path coverage is automatically enabled on the driver if configured.

@sebastianbergmann sebastianbergmann added type/enhancement A new idea that should be implemented feature/code-coverage Issues related to code coverage (but not php-code-coverage) labels Apr 13, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 78.26087% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.57%. Comparing base (11c89af) to head (5f49d37).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/TextUI/Configuration/Configuration.php 66.66% 2 Missing ⚠️
...UI/Configuration/Xml/CodeCoverage/CodeCoverage.php 77.77% 2 Missing ⚠️
src/TextUI/Configuration/Merger.php 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6586      +/-   ##
============================================
- Coverage     96.59%   96.57%   -0.02%     
- Complexity     8026     8032       +6     
============================================
  Files           839      839              
  Lines         24830    24851      +21     
============================================
+ Hits          23984    24000      +16     
- Misses          846      851       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/code-coverage Issues related to code coverage (but not php-code-coverage) type/enhancement A new idea that should be implemented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant