willpower232/cloverparser

An extensible class for totalling the unit test coverage from Clover files

v1.1.0 2024-03-11 17:45 UTC

This package is auto-updated.

Last update: 2024-11-11 19:11:29 UTC


README

run-tests Coverage

This is a parser for one or more clover coverage files, as generated by phpunit/phpunit, with the aim of producing a percentage for code coverage.

This is intended to be the basis of parsing some clover files for use in other ways such as willpower232/cloverparser-laravel which creates an SVG from the coverage percentage and stores it using Laravels framework.

A former casual user of codecov and interested in controlling my own data, I decided to see how complicated it would be to operate a similar setup myself after their uploader script was compromised.

This is the first part of this project, discovering how to get the coverage values out of a clover file.

Installation

composer require willpower232/cloverparser

Usage

use WillPower232\CloverParser\CloverParser;

$parser = new CloverParser;

$parser->addFile($pathToCloverFile);

$percentage = $parser->getPercentage();