Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpunit Coverage Check Laravel Package

rregeer/phpunit-coverage-check

View on GitHub
Deep Wiki
Context7

Build Status

phpunit-coverage-check

This php script will read the clover xml report from phpunit and calculates the coverage score. Based on the given threshold the script will exit ok of the coverage is higher then the threshold or exit with code 1 if the coverage is lower then the threshold. This script can be used in your continuous deployment environment or for example added to a pre-commit hook.

Installation

The script can be installed using composer. Add this repository as a dependency to the composer.json file.

composer require --dev rregeer/phpunit-coverage-check

Usage

The script has requires 2 parameters that are mandatory to return the code coverage.

  1. The location of the clover xml file, that's generated by phpunit.
  2. The coverage threshold that is acceptable. Min = 1, Max = 100

Generate the clover.xml file by using phpunit and run the coverage check script: Run the script:

vendor/bin/phpunit --coverage-clover clover.xml
vendor/bin/coverage-check clover.xml 80
vendor/bin/coverage-check clover.xml 80 --only-percentage

With the --only-percentage enabled, the CLI command will only return the resulting coverage percentage.

It's also possible to add the coverage report generation to the phpunit.xml.dist add to following lines to the xml file inside the <coverage> tag:

<report>
    <clover outputFile="clover.xml" />
</report>

For more information see the phpunit documentation. Information about the configuration file and commandline options.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium