Skip to content

Commit 022a376

Browse files
authored
Merge pull request clue#108 from clue-labs/coverage
Update test suite to ensure 100% code coverage
2 parents 9434a04 + f48e144 commit 022a376

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/ci.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,16 @@ jobs:
3131
php-version: ${{ matrix.php }}
3232
coverage: xdebug
3333
- run: composer install
34-
- run: vendor/bin/phpunit --coverage-text
34+
- run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml
3535
if: ${{ matrix.php >= 7.3 }}
36-
- run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
36+
- run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml -c phpunit.xml.legacy
3737
if: ${{ matrix.php < 7.3 }}
38+
- name: Check 100% code coverage
39+
shell: php {0}
40+
run: |
41+
<?php
42+
$metrics = simplexml_load_file('clover.xml')->project->metrics;
43+
exit((int) $metrics['statements'] === (int) $metrics['coveredstatements'] ? 0 : 1);
3844
3945
PHPUnit-hhvm:
4046
name: PHPUnit (HHVM)

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# clue/reactphp-stdio
22

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

67
Async, event-driven and UTF-8 aware console input & output (STDIN, STDOUT) for
@@ -689,6 +690,14 @@ To run the test suite, go to the project root and run:
689690
vendor/bin/phpunit
690691
```
691692

693+
The test suite is set up to always ensure 100% code coverage across all
694+
supported environments. If you have the Xdebug extension installed, you can also
695+
generate a code coverage report locally like this:
696+
697+
```bash
698+
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text
699+
```
700+
692701
## License
693702

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

0 commit comments

Comments
 (0)