pcov/clobber
Clobber PHPUnit 5–7’s Xdebug code coverage driver to use PCOV instead. Install with composer and run vendor/bin/pcov clobber or unclobber (optionally targeting another directory). Useful when upgrading to PHPUnit 8 isn’t feasible.
pcov/clobber package provides a targeted workaround for PHPUnit 5/6/7 users who require PCOV support but cannot upgrade due to strict type system constraints or legacy dependencies. It aligns with Laravel projects still using older PHPUnit versions (e.g., Laravel 5.x–7.x) where migration to PHPUnit 8+ is blocked by void return type issues or third-party constraints.phpunit.xml, TestCase classes) is compatible with this package, as it operates at the PHPUnit layer rather than the framework layer. It is particularly useful for:
pcov/clobber as a dev dependency.vendor/bin/pcov clobber pre-test (e.g., in CI scripts or phpunit.xml).vendor/bin/pcov unclobber post-test if needed.phpunit/phpunit ≥8.0, theseer/tokenizer).composer.json.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Breakage with PHPUnit 8+ | Low | Explicitly document as a legacy-only tool. |
| Xdebug Version Incompatibility | Medium | Test with target Xdebug versions (2.9–3.2). |
| CI/CD Pipeline Failures | High | Add pcov clobber to pre-test hooks; monitor coverage reports. |
| False Positives in Coverage | Medium | Validate coverage accuracy post-integration. |
| Lack of Active Maintenance | Medium | Fork or patch if issues arise (MIT license). |
| State Corruption | High | Backup original Xdebug configs; test rollback. |
void/type system blockers (e.g., laravel/framework <8.0, custom test suites).pcov/clobber.phpunit --coverage-text outputs).pcov clobber slow down test suites? (Profile locally with time vendor/bin/phpunit.)phpunit --parallel)? (Clobbering may cause race conditions.)phpunit.xml or custom configurations.laravel/testbench or phpunit-db-unit if they rely on legacy PHPUnit.composer why-not phpunit/phpunit:^8.0 to identify blockers.pcov/clobber in a staging branch with a subset of tests.composer require --dev pcov/clobber
vendor/bin/pcov clobber # Add to pre-test script (e.g., in package.json or CI)
phpunit.xml to enforce PCOV:
<php>
<env name="PHPUNIT_USE_PCOV" value="1"/>
<env name="XDEBUG_MODE" value="off"/> <!-- Disable Xdebug -->
</php>
phpunit --coverage-text) before/after.FeatureTestCase).pcov unclobber in post-test hooks.xdebug.ini).CONTRIBUTING.md.| Component | Version Range | Notes |
|---|---|---|
| Laravel | 5.8–8.x | PHPUnit 5–7.x compatible. |
| PHPUnit | 5.0–7.5.20 | Avoid ≥8.0. |
| PHP | 5.6–7.4 | PHP 8.0+ unsupported. |
| Xdebug | 2.9–3.2 | Package targets these versions. |
| PCOV | 1.0.0–2.0.0 | Ensure no conflicts with other PCOV tools. |
| Laravel Testbench | 3.x–4.x | May require additional configuration. |
php -m | grep xdebug).pcov clobber → Run PHPUnit → pcov unclobber.before_script (GitHub Actions) or before_all (Jenkins).Makefile or composer script for convenience:
{
"scripts": {
"test:coverage": "pcov clobber && phpunit --coverage-clover=coverage.xml && pcov unclobber"
}
}
--group flags instead.composer.json (e.g., "pcov/clobber": "1.0.0").README.md or Testing.md:
## Legacy PCOV Support
This project uses `pcov/clobber` for PHPUnit <8.0 compatibility.
Run `vendor/bin/pcov clobber` before tests; see [pcov-clobber](https://github.com/krakjoe/pcov-clobber) for details.
How can I help you explore Laravel packages today?