Skip to content

Conversation

@priethor
Copy link
Contributor

@priethor priethor commented Jan 2, 2026

What

Adds PHP code coverage collection during e2e test runs, with Codecov integration.

Why

Currently, only JavaScript coverage is collected during e2e tests. This adds visibility into which PHP code paths are exercised by the e2e test suite, helping identify untested server-side code.

How

  1. Adding an mu-plugin that uses Xdebug's coverage mode to collect PHP coverage data.
  2. When Playwright tests run with PHP_COVERAGE_ENABLED=true, they send an X-PHP-Coverage header that triggers the mu-plugin to record coverage for each request.
  3. Since PHP processes are stateless and each request is a new process, coverage is written to individual JSON files, which are then merged into LCOV format by a Node.js script
  4. Finally, the merged report is uploaded to Codecov.

Testing Instructions

If everything goes well, the Codecov comment in this PR should show a significant increase in PHP coverage.

@priethor priethor added this to the 6.9.0 milestone Jan 2, 2026
@priethor priethor self-assigned this Jan 2, 2026
@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.46%. Comparing base (1e1f998) to head (4636f28).
⚠️ Report is 2 commits behind head on trunk.

Additional details and impacted files
@@              Coverage Diff              @@
##              trunk     #343       +/-   ##
=============================================
+ Coverage     34.07%   62.46%   +28.38%     
  Complexity     4410     4410               
=============================================
  Files           291      296        +5     
  Lines         36914    26261    -10653     
=============================================
+ Hits          12578    16403     +3825     
+ Misses        24336     9858    -14478     
Flag Coverage Δ
e2e ?
e2e-js 44.17% <ø> (?)
e2e-php 99.85% <ø> (?)
javascript 15.07% <ø> (ø)
phpunit 29.97% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props priethor.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@priethor priethor force-pushed the add/php-coverage-e2e branch from ebad439 to ed0f59f Compare January 3, 2026 00:28
@priethor priethor merged commit 939c314 into trunk Jan 3, 2026
9 checks passed
@priethor priethor deleted the add/php-coverage-e2e branch January 3, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants