Skip to content

Custom code coverage driver support#6544

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

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

Conversation

@sebastianbergmann
Copy link
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 Mar 17, 2026
@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 78.26087% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.85%. Comparing base (675f9d8) to head (d3b8bad).
✅ 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    #6544      +/-   ##
============================================
- Coverage     95.87%   95.85%   -0.02%     
- Complexity     7561     7567       +6     
============================================
  Files           817      817              
  Lines         23407    23428      +21     
============================================
+ Hits          22442    22458      +16     
- Misses          965      970       +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