Download the PHP package esi/phpunit-coverage-check without Composer

On this page you can find all versions of the php package esi/phpunit-coverage-check. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpunit-coverage-check

PHPUnit Coverage Check

Build Status Code Coverage Scrutinizer Code Quality Continuous Integration SymfonyInsight Latest Stable Version Downloads per Month License

PHPUnit Coverage Check - Check the code coverage using the clover report of PHPUnit.

This php script will read the clover xml report from PHPUnit and calculate the coverage score. Based on the given threshold the script will exit ok if the coverage is higher than the threshold or exit with code 1 if the coverage is lower than the threshold.

This script can be used in your continuous deployment environment or for example added to a pre-commit hook.

GitHub Action

A GitHub action has been created for this library and can be found in the PHPUnit Coverage Check Action repository, or on the GitHub Marketplace.

Acknowledgements/Credits

This library is a fork of/based upon rregeer/phpunit-coverage-check by Richard Regeer.

Most of this library has been rewritten from the ground up, to replace and improve a majority of the original library. The overall idea, and key pieces of the calculation, are thanks to the original library. Many thanks and much appreciation to Richard Regeer for his wonderful work.

Please see LICENSE file for more information.

For more information on changes made in this library, in comparison to the original by Richard Regeer, please see the CHANGELOG file.

Phar generation is handled by using Box. My implementation of the coverage:check command, with Symfony\Console, was inspired by SensioLabs Security Checker.

Important Note

This project is not in any way an official PHPUnit project. Meaning, that it is not associated with, or endorsed by, the PHPUnit project or its author Sebastian Bergmann.

Installation

Composer

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

To use PHPUnit Coverage Check on PHP 8.1, use version 1.0.0 (and check 1.x's readme as usage is slightly different):

Phar

Download the phpunit-coverage-check.phar from an available release. It is recommended to check the signature when downloading the Phar from a GitHub Release (with phpunit-coverage-check.phar.asc).

The Phar files of PHPUnit Coverage Check are signed with a public key associated to [email protected].. The key(s) associated with this E-Mail address can be queried at keys.openpgp.org.

Install with Phive

You can also install the PHPUnit Coverage Check Phar with Phive.

If not already using Phive, you can read more about it here, also Phive installation and usage.

Usage

The script has 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:

It's also possible to add the coverage report generation to your PHPUnit configuration file (phpunit.xml.dist for example). You would add to following lines to the xml file inside the <coverage> tag:

If installed with Composer

You can also use the Api directly if you wish. I created a function called nonConsoleCall that will process and return the data, similar to how the console application displays it.

An example usage:

If using the Phar

With --only-percentage (or -O) enabled, the CLI command will only return the resulting coverage percentage.

--show-files

With --show-files (or -F), --only-percentage will be ignored. This option parses the clover file for coverage information for each file in the project/package, determine coverage, and display the information in a table. For example:

Passing coverage
Mixed pass/fail coverage

About

Requirements

Submitting bugs and feature requests

Bugs and feature requests are tracked on GitHub

Issues are the quickest way to report a bug. If you find a bug or documentation error, please check the following first:

Contributing

See CONTRIBUTING

Backward Compatibility Promise

Credits

Author

Eric Sizemore - https://www.secondversion.com

License

PHPUnit Coverage Check is licensed under the MIT License.


All versions of phpunit-coverage-check with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2 <8.5
ext-libxml Version *
ext-simplexml Version *
symfony/console Version ^7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package esi/phpunit-coverage-check contains the following files

Loading the files please wait ....