Skip to content

Commit c0cdc2c

Browse files
committed
Update test suite to ensure 100% code coverage
1 parent 28b107d commit c0cdc2c

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@ 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+
if ((int) $metrics['statements'] !== (int) $metrics['coveredstatements']) {
43+
echo file_get_contents('clover.xml');
44+
exit(1);
45+
}
3746
3847
PHPUnit-hhvm:
3948
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-http-proxy
22

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

67
Async HTTP proxy connector, tunnel any TCP/IP-based protocol through an HTTP
@@ -483,6 +484,14 @@ alternatively you can also run it like this:
483484
vendor/bin/phpunit --exclude-group internet
484485
```
485486

487+
The test suite is set up to always ensure 100% code coverage across all
488+
supported environments. If you have the Xdebug extension installed, you can also
489+
generate a code coverage report locally like this:
490+
491+
```bash
492+
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text
493+
```
494+
486495
## License
487496

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

src/ProxyConnector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function connect($uri)
262262
// what a lovely piece of code!
263263
$r = new \ReflectionProperty('Exception', 'trace');
264264
if (PHP_VERSION_ID < 80100) {
265-
$r->setAccessible(true);
265+
$r->setAccessible(true); // @codeCoverageIgnore
266266
}
267267
$trace = $r->getValue($e);
268268

0 commit comments

Comments
 (0)