From f48e1444fb4c0ecbb8a7855ae6d26df75b09cb97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Sat, 2 Sep 2023 14:18:21 +0200 Subject: [PATCH] Update test suite to ensure 100% code coverage --- .github/workflows/ci.yml | 10 ++++++++-- README.md | 9 +++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6239b6..725b4da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,10 +31,16 @@ jobs: php-version: ${{ matrix.php }} coverage: xdebug - run: composer install - - run: vendor/bin/phpunit --coverage-text + - run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml if: ${{ matrix.php >= 7.3 }} - - run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy + - run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml -c phpunit.xml.legacy if: ${{ matrix.php < 7.3 }} + - name: Check 100% code coverage + shell: php {0} + run: | + project->metrics; + exit((int) $metrics['statements'] === (int) $metrics['coveredstatements'] ? 0 : 1); PHPUnit-hhvm: name: PHPUnit (HHVM) diff --git a/README.md b/README.md index c1685b6..a81469e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # clue/reactphp-stdio [![CI status](https://github.com/clue/reactphp-stdio/actions/workflows/ci.yml/badge.svg)](https://github.com/clue/reactphp-stdio/actions) +[![code coverage](https://img.shields.io/badge/code%20coverage-100%25-success)](#tests) [![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) 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: vendor/bin/phpunit ``` +The test suite is set up to always ensure 100% code coverage across all +supported environments. If you have the Xdebug extension installed, you can also +generate a code coverage report locally like this: + +```bash +XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text +``` + ## License This project is released under the permissive [MIT license](LICENSE).