leanphp/phpspec-code-coverage
leanphp/phpspec-code-coverage) bridges a gap in Laravel’s testing ecosystem by providing PhpSpec-specific code coverage reports, which is valuable for teams using BDD-style testing alongside traditional unit/feature tests. Laravel’s built-in testing tools (e.g., phpunit/phpunit) lack native PhpSpec support, making this a complementary tool rather than a replacement.phpunit/phpunit) and Xdebug for coverage analysis, aligning with Laravel’s default testing stack. No conflicts with Laravel Mix, Forge, or Envoyer.spec_helper.php, and extend Laravel’s phpunit.xml to include PhpSpec commands.<phpunit>
<extensions>
<extension class="leanphp\PhpSpecCodeCoverage\PhpSpecCodeCoverageExtension"/>
</extensions>
</phpunit>
phpunit config may need adjustments to include PhpSpec.composer require phpspec/phpspec).--coverage-text flag).# PHPUnit (default)
vendor/bin/phpunit --coverage-clover coverage.xml
# PhpSpec + Coverage
vendor/bin/phpspec run --format=pretty --coverage --coverage-report=clover
spec_helper.php and update phpunit.xml to include the extension.- name: Run PhpSpec with Coverage
run: vendor/bin/phpspec run --coverage --coverage-report=clover
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
file: ./coverage-clover.xml
tests/ structure or TestCase classes.spec/ (convention) or alongside PHPUnit tests.composer require leanphp/phpspec-code-coverage
phpspec.yml:
extensions:
leanphp\PhpSpecCodeCoverage\PhpSpecCodeCoverageExtension:
format: [clover, html]
spec_helper.php or phpspec.yml may diverge from team standards.php -m to verify extensions).describe(), it()).How can I help you explore Laravel packages today?