Skip to content

Commit de886e8

Browse files
authored
Merge pull request #39 from clue-labs/coverage
Update test suite to ensure 100% code coverage
2 parents e43d85c + fa4b948 commit de886e8

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,7 +30,13 @@ jobs:
3030
coverage: xdebug
3131
ini-file: development
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);

README.md

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

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

67
Mini Queue, the lightweight in-memory message queue to concurrently do many (but not too many) things at once,
@@ -509,6 +510,14 @@ To run the test suite, go to the project root and run:
509510
vendor/bin/phpunit
510511
```
511512

513+
The test suite is set up to always ensure 100% code coverage across all
514+
supported environments. If you have the Xdebug extension installed, you can also
515+
generate a code coverage report locally like this:
516+
517+
```bash
518+
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text
519+
```
520+
512521
## License
513522

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

0 commit comments

Comments
 (0)