Skip to content

Commit ca5b11c

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

File tree

6 files changed

+61
-2
lines changed

6 files changed

+61
-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).

clover56.xml

Whitespace-only changes.

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,10 @@
3232
"psr-4": {
3333
"Clue\\Tests\\React\\HttpProxy\\": "tests/"
3434
}
35+
},
36+
"config": {
37+
"platform": {
38+
"php": "5.6.0"
39+
}
3540
}
3641
}

composer.json.bak

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "clue/http-proxy-react",
3+
"description": "Async HTTP proxy connector, tunnel any TCP/IP-based protocol through an HTTP CONNECT proxy server, built on top of ReactPHP",
4+
"keywords": ["HTTP", "CONNECT", "proxy", "ReactPHP", "async"],
5+
"homepage": "https://github.com/clue/reactphp-http-proxy",
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "Christian Lück",
10+
"email": "christian@clue.engineering"
11+
}
12+
],
13+
"require": {
14+
"php": ">=5.3",
15+
"react/promise": "^3.3 || ^2.1 || ^1.2.1",
16+
"react/socket": "^1.17",
17+
"ringcentral/psr7": "^1.2"
18+
},
19+
"require-dev": {
20+
"phpunit/phpunit": "^9.6 || ^8.5 || ^5.7 || ^4.8.36",
21+
"react/async": "^4.3 || ^3 || ^2",
22+
"react/event-loop": "^1.6",
23+
"react/http": "^1.11",
24+
"react/promise-timer": "^1.11"
25+
},
26+
"autoload": {
27+
"psr-4": {
28+
"Clue\\React\\HttpProxy\\": "src/"
29+
}
30+
},
31+
"autoload-dev": {
32+
"psr-4": {
33+
"Clue\\Tests\\React\\HttpProxy\\": "tests/"
34+
}
35+
}
36+
}

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)