Skip to content

Commit 8c84258

Browse files
authored
Merge pull request #27 from clue-labs/coverage
Update test suite to ensure 100% code coverage
2 parents f178d40 + 1cf17b9 commit 8c84258

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ jobs:
3030
php-version: ${{ matrix.php }}
3131
coverage: xdebug
3232
- run: composer install
33-
- run: vendor/bin/phpunit --coverage-text
33+
- run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml
3434
if: ${{ matrix.php >= 7.3 }}
35-
- run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
35+
- run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml -c phpunit.xml.legacy
3636
if: ${{ matrix.php < 7.3 }}
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-flux
22

33
[![CI status](https://github.com/clue/reactphp-flux/actions/workflows/ci.yml/badge.svg)](https://github.com/clue/reactphp-flux/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/reactphp-flux?color=blue&label=installs%20on%20Packagist)](https://packagist.org/packages/clue/reactphp-flux)
56

67
Flux, the lightweight stream processor to concurrently do many (but not too many) things at once,
@@ -683,6 +684,14 @@ To run the test suite, go to the project root and run:
683684
vendor/bin/phpunit
684685
```
685686

687+
The test suite is set up to always ensure 100% code coverage across all
688+
supported environments. If you have the Xdebug extension installed, you can also
689+
generate a code coverage report locally like this:
690+
691+
```bash
692+
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text
693+
```
694+
686695
## License
687696

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

0 commit comments

Comments
 (0)