Skip to content

Commit 9dd8ca1

Browse files
committed
Update test suite to ensure 100% code coverage
1 parent fa80702 commit 9dd8ca1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ jobs:
3333
php-version: ${{ matrix.php }}
3434
coverage: xdebug
3535
- run: composer install
36-
- run: vendor/bin/phpunit --coverage-text ${{ matrix.php < 7.3 && '-c phpunit.xml.legacy' || '' }}
36+
- run: vendor/bin/phpunit --coverage-text --coverage-clover clover.xml ${{ matrix.php < 7.3 && '-c phpunit.xml.legacy' || '' }}
37+
- name: Check 100% code coverage
38+
shell: php {0}
39+
run: |
40+
<?php
41+
$metrics = simplexml_load_file('clover.xml')->project->metrics;
42+
exit((int) $metrics['statements'] === (int) $metrics['coveredstatements'] ? 0 : 1);
3743
3844
PHPUnit-hhvm:
3945
name: PHPUnit (HHVM)

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# clue/reactphp-connection-manager-extra
22

33
[![CI status](https://github.com/clue/reactphp-connection-manager-extra/actions/workflows/ci.yml/badge.svg)](https://github.com/clue/reactphp-connection-manager-extra/actions)
4+
[![code coverage](https://img.shields.io/badge/code%20coverage-100%25-success)](#tests)
45
[![installs on Packagist](https://img.shields.io/packagist/dt/clue/connection-manager-extra?color=blue&label=installs%20on%20Packagist)](https://packagist.org/packages/clue/connection-manager-extra)
56

67
This project provides _extra_ (in terms of "additional", "extraordinary", "special" and "unusual") decorators,
@@ -279,6 +280,14 @@ To run the test suite, go to the project root and run:
279280
vendor/bin/phpunit
280281
```
281282

283+
The test suite is set up to always ensure 100% code coverage across all
284+
supported environments. If you have the Xdebug extension installed, you can also
285+
generate a code coverage report locally like this:
286+
287+
```bash
288+
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text
289+
```
290+
282291
## License
283292

284293
This project is released under the permissive [MIT license](LICENSE).

0 commit comments

Comments
 (0)