Skip to content

Commit 27df4ca

Browse files
authored
Merge pull request #103 from clue-labs/php8.2
Test on PHP 8.2 and update test environment
2 parents 1f74dc3 + 7e91f1f commit 27df4ca

File tree

7 files changed

+41
-33
lines changed

7 files changed

+41
-33
lines changed

.github/workflows/ci.yml

+13-9
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ on:
77
jobs:
88
PHPUnit:
99
name: PHPUnit (PHP ${{ matrix.php }})
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111
strategy:
1212
matrix:
1313
php:
14+
- 8.2
1415
- 8.1
1516
- 8.0
1617
- 7.4
@@ -23,7 +24,7 @@ jobs:
2324
- 5.4
2425
- 5.3
2526
steps:
26-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v3
2728
- uses: shivammathur/setup-php@v2
2829
with:
2930
php-version: ${{ matrix.php }}
@@ -36,13 +37,16 @@ jobs:
3637

3738
PHPUnit-hhvm:
3839
name: PHPUnit (HHVM)
39-
runs-on: ubuntu-18.04
40+
runs-on: ubuntu-22.04
4041
continue-on-error: true
4142
steps:
42-
- uses: actions/checkout@v2
43-
- uses: azjezz/setup-hhvm@v1
43+
- uses: actions/checkout@v3
44+
- run: cp "$(which composer)" composer.phar && ./composer.phar self-update --2.2 # downgrade Composer for HHVM
45+
- name: Run hhvm composer.phar install
46+
uses: docker://hhvm/hhvm:3.30-lts-latest
4447
with:
45-
version: lts-3.30
46-
- run: composer self-update --2.2 # downgrade Composer for HHVM
47-
- run: hhvm $(which composer) install
48-
- run: hhvm vendor/bin/phpunit
48+
args: hhvm composer.phar install
49+
- name: Run hhvm vendor/bin/phpunit
50+
uses: docker://hhvm/hhvm:3.30-lts-latest
51+
with:
52+
args: hhvm vendor/bin/phpunit

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ This project follows [SemVer](https://semver.org/).
642642
This will install the latest supported version:
643643

644644
```bash
645-
$ composer require clue/stdio-react:^2.6
645+
composer require clue/stdio-react:^2.6
646646
```
647647

648648
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
@@ -680,13 +680,13 @@ To run the test suite, you first need to clone this repo and then install all
680680
dependencies [through Composer](https://getcomposer.org/):
681681

682682
```bash
683-
$ composer install
683+
composer install
684684
```
685685

686686
To run the test suite, go to the project root and run:
687687

688688
```bash
689-
$ vendor/bin/phpunit
689+
vendor/bin/phpunit
690690
```
691691

692692
## License

composer.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,19 @@
2020
"require-dev": {
2121
"clue/arguments": "^2.0",
2222
"clue/commander": "^1.2",
23-
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35"
23+
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
2424
},
2525
"suggest": {
2626
"ext-mbstring": "Using ext-mbstring should provide slightly better performance for handling I/O"
2727
},
28-
"config": {
29-
"sort-packages": true
30-
},
3128
"autoload": {
32-
"psr-4": { "Clue\\React\\Stdio\\": "src/" }
29+
"psr-4": {
30+
"Clue\\React\\Stdio\\": "src/"
31+
}
3332
},
3433
"autoload-dev": {
35-
"psr-4": { "Clue\\Tests\\React\\Stdio\\": "tests/" }
34+
"psr-4": {
35+
"Clue\\Tests\\React\\Stdio\\": "tests/"
36+
}
3637
}
3738
}

phpunit.xml.dist

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<!-- PHPUnit configuration file with new format for PHPUnit 9.3+ -->
4-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
3+
<!-- PHPUnit configuration file with new format for PHPUnit 9.6+ -->
4+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
66
bootstrap="vendor/autoload.php"
7-
colors="true"
87
cacheResult="false"
8+
colors="true"
99
convertDeprecationsToExceptions="true">
1010
<testsuites>
11-
<testsuite name="Stdio React Test Suite">
11+
<testsuite name="Stdio Test Suite">
1212
<directory>./tests/</directory>
1313
</testsuite>
1414
</testsuites>
@@ -17,4 +17,7 @@
1717
<directory>./src/</directory>
1818
</include>
1919
</coverage>
20+
<php>
21+
<ini name="error_reporting" value="-1" />
22+
</php>
2023
</phpunit>

phpunit.xml.legacy

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<!-- PHPUnit configuration file with old format for PHPUnit 9.2 or older -->
3+
<!-- PHPUnit configuration file with old format for legacy PHPUnit -->
44
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
66
bootstrap="vendor/autoload.php"
77
colors="true">
88
<testsuites>
9-
<testsuite name="Stdio React Test Suite">
9+
<testsuite name="Stdio Test Suite">
1010
<directory>./tests/</directory>
1111
</testsuite>
1212
</testsuites>

tests/FunctionalExampleTest.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public function testPeriodicExampleWithClosedInputQuitsImmediately()
3838
$this->markTestSkipped('Test fails for Github CI with PHP >= 7.0 and HHVM');
3939
}
4040

41+
if (PHP_VERSION_ID === 80108 || PHP_VERSION_ID === 80107 || PHP_VERSION_ID === 80020) {
42+
$this->markTestSkipped('Skip bugged PHP version: https://github.com/php/php-src/issues/8827');
43+
}
44+
4145
$output = $this->execExample('php 01-periodic.php <&-');
4246

4347
if (strpos($output, 'said') !== false) {
@@ -53,6 +57,10 @@ public function testPeriodicExampleWithClosedInputAndOutputQuitsImmediatelyWitho
5357
$this->markTestSkipped('Test fails for Github CI with PHP >= 7.0 and HHVM');
5458
}
5559

60+
if (PHP_VERSION_ID === 80108 || PHP_VERSION_ID === 80107 || PHP_VERSION_ID === 80020) {
61+
$this->markTestSkipped('Skip bugged PHP version: https://github.com/php/php-src/issues/8827');
62+
}
63+
5664
$output = $this->execExample('php 01-periodic.php <&- >&- 2>&-');
5765

5866
if (strpos($output, 'said') !== false) {
@@ -113,10 +121,6 @@ public function testStubCanEndWithoutReadlineFunctions()
113121

114122
public function testPeriodicExampleViaInteractiveModeQuitsImmediately()
115123
{
116-
if (getenv('CI') === 'true' && PHP_VERSION_ID >= 70000) {
117-
$this->markTestSkipped('Test fails for Github CI with PHP >= 7.0');
118-
}
119-
120124
if (defined('HHVM_VERSION')) {
121125
$this->markTestSkipped('Skipped interactive mode on HHVM');
122126
}

tests/TestCase.php

-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
use PHPUnit\Framework\TestCase as BaseTestCase;
66

7-
require_once __DIR__ . '/../vendor/autoload.php';
8-
9-
error_reporting(-1);
10-
117
class TestCase extends BaseTestCase
128
{
139
protected function expectCallableOnce()

0 commit comments

Comments
 (0)