Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests on PHPUnit 9 and PHP 8 #130

Merged
merged 3 commits into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
strategy:
matrix:
php:
- 8.0
- 7.4
- 7.3
- 7.2
Expand All @@ -27,6 +28,9 @@ jobs:
coverage: xdebug
- run: composer install
- run: vendor/bin/phpunit --coverage-text
if: ${{ matrix.php >= 7.3 }}
- run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
if: ${{ matrix.php < 7.3 }}

PHPUnit-hhvm:
name: PHPUnit (HHVM)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
, "ratchet/rfc6455": "^0.3"
}
, "require-dev": {
"phpunit/phpunit": "~4.8"
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8"
}
, "suggest": {
"reactivex/rxphp": "~2.0"
Expand Down
30 changes: 14 additions & 16 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
forceCoversAnnotation="true"
mapTestClassNameToCoveredClassName="true"
bootstrap="tests/bootstrap.php"
colors="true"

<!-- PHPUnit configuration file with new format for PHPUnit 9.3+ -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
syntaxCheck="false"
stopOnError="false"
>

bootstrap="vendor/autoload.php"
cacheResult="false"
colors="true"
stopOnError="false">
<testsuites>
<testsuite name="unit">
<directory>./tests/unit/</directory>
<directory>./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<coverage>
<include>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
</include>
</coverage>
</phpunit>
22 changes: 22 additions & 0 deletions phpunit.xml.legacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- PHPUnit configuration file with old format for PHPUnit 9.2 or older -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
cacheResult="false"
colors="true"
stopOnError="false">
<testsuites>
<testsuite name="unit">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
3 changes: 0 additions & 3 deletions tests/bootstrap.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/unit/ConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function uriDataProvider() {
public function testSecureConnectionUsesTlsScheme($uri, $expectedConnectorUri) {
$loop = Factory::create();

$connector = $this->getMock('React\Socket\ConnectorInterface');
$connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock();

$connector->expects($this->once())
->method('connect')
Expand Down