Skip to content

Commit

Permalink
Merge pull request #130 from SimonFrings/phpunit
Browse files Browse the repository at this point in the history
 Run tests on PHPUnit 9 and PHP 8
  • Loading branch information
mbonneau authored Nov 1, 2021
2 parents 18a179a + 4c88924 commit 2946751
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 21 deletions.
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

0 comments on commit 2946751

Please sign in to comment.