xp-forge/coverage

Coverage for the XP Framework

v1.1.3 2021-10-21 20:59 UTC

This package is auto-updated.

Last update: 2024-10-22 03:50:26 UTC


README

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.0+ Supports PHP 8.0+ Latest Stable Version

Code coverage for XP using XDebug. Based on Sebastian Bergmann's Code coverage library.

Installation

$ composer global require xp-forge/coverage

Next, make sure you have the XDebug Zend extension loaded via zend_extension.

Usage

$ xp coverage -p src/main/php/unittest/ src/test/php
[.....................]

♥: 21/21 run (0 skipped), 21 succeeded, 0 failed
Memory used: 3839.68 kB (4050.93 kB peak)
Time taken: 0.246 seconds
Coverage: 84.72% lines covered (61/72)

┌──────────────────────────────────────────────────────┬─────────┬──────┐
│ Class                                                │ % Lines │  Not │
╞══════════════════════════════════════════════════════╪═════════╪══════╡
│ unittest.coverage.ClassName                          │ 100.00% │      │
│ unittest.coverage.CoverageDetails                    │ 100.00% │      │
│ unittest.coverage.CoverageListener                   │  60.71% │   11 │
└──────────────────────────────────────────────────────┴─────────┴──────┘

HTML Report

An optional HTML report can be generated like this.

$ xp coverage -p src/main/php -r ./coverage-report src/test/php/

Use it in order to find out how to improve your coverage.

Clover report

A clover report can be generated as well.

$ xp coverage -p src/main/php -c clover.xml src/test/php/