Skip to content

CoverageTracker/example-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

example-php

coverage badge complexity badge

A small, idiomatic PHP invoicing library used as the PHP reference example for Coverage Tracker. It exists to give the PHP row in the coverage report generation guide a live, working reference, and to populate the demo dashboard with real trend data.

This is a demo/marketing repo, not a test suite for Coverage Tracker itself.

What's here

  • src/Money (integer-cents value object), Discount (percentage/fixed, promo-code lookup), TaxCalculator (tiered jurisdiction rates with a de-minimis exemption), LineItem, and Invoice, each with real branching logic.
  • tests/ — a PHPUnit suite with several deliberately uncovered branches (unknown promo codes, unknown tax jurisdictions, guard-clause validation), so branch_coverage < line_coverage shows up on the dashboard.
  • .github/workflows/coverage.yml — runs the suite under PHPUnit with Xdebug's path-coverage mode, generates a Lizard complexity report, then reports both to the demo instance via the coverage-tracker reporting Action with coverage-tool: phpunit (Cobertura's XML shape doesn't self-identify its generator, so the reporter needs to be told to trust branch-rate).

Running locally

composer install
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-cobertura=coverage.xml   # writes coverage.xml
python -m lizard src --xml > lizard-report.xml

phpunit.xml sets <coverage pathCoverage="true"/> — Xdebug only emits branch data when path coverage is requested; without it PHPUnit's Cobertura report always writes branch-rate="0".

About

PHP demo project reporting Cobertura coverage and complexity to CoverageTracker via the reporting Action.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages