Skip to content

Commit a2a11bb

Browse files
authored
Add support for PHP 8 (#41)
* Drop hhvm from build matrix * Bump minimal PHP version to 7.1 * Remove PHP 7.3 from allowed failures * Add PHP 7.4 to build matrix * Check platform requirements * Replace `\PHPUnit_Framework_TestCase` with `\PHPUnit\Framework\TestCase` * Bump PHPUnit to version 7.5 * Bump `webonyx/graphql-php` to version 0.13 * Prefer package sources on `composer update` `tests/StarWarsData.php` is no longer part of `webonyx/graphql-php` package * Fix deprecation for `GraphQL\Schema` * Suppress deprecation errors in tests * Bump `webonyx/graphql-php` to version 14 * Bump PHPUnit to version 8.5 * Allow PHPUnit 7 for compatibility with PHP 7.1 * Allow PHP 8 * Use current version of `php-cs-fixer` * Switch Travis CI from `trusty` to `bionic` * Add PHP 8.0 to the build matrix * Don't run `php-cs-fixer` for PHP 8.0 Resolves #40. Minimal PHP version increased to 7.1. (So that supported versions are same as in webonyx/graphql-php. Going up to 7.2 would make things easier regarding PHPUnit.) Installation on PHP 8 allowed. composer check-platform-reqs added to build steps PHPUnit bumped to ^7.5|^8.5 to support PHP 7.1-8.0 webonyx/graphql-php updated to the current version 14 --prefer-source used for composer update as tests/StarWarsData.php is no longer part of webonyx/graphql-php package. Alternative options would be to create a local copy of the file in this repository or download it from webonyx/graphql-php repo with wget in before_install. The current version of php-cs-fixer (2.16) used, however, it doesn't allow installation on PHP 8 yet (see PHP-CS-Fixer/PHP-CS-Fixer#4702). PHPUnit option convertDeprecationsToExceptions disabled to deal with deprecated GraphQL::execute() (related to #39).
1 parent b557de1 commit a2a11bb

File tree

7 files changed

+18
-22
lines changed

7 files changed

+18
-22
lines changed

.travis.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
dist: trusty
1+
dist: bionic
22

33
language: php
44

55
php:
6-
- 5.5
7-
- 5.6
8-
- 7.0
96
- 7.1
107
- 7.2
118
- 7.3
9+
- 7.4
10+
- 8.0
1211
- nightly
13-
- hhvm
1412

1513
branches:
1614
only:
@@ -20,21 +18,18 @@ branches:
2018
matrix:
2119
allow_failures:
2220
- php: nightly
23-
- php: 7.3
2421

2522
cache:
2623
directories:
2724
- $HOME/.composer/cache
2825

2926
before_install:
30-
- if [[ "$TRAVIS_PHP_VERSION" != "5.6" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini || true; fi
27+
- phpenv config-rm xdebug.ini || true
3128
- composer selfupdate
3229

33-
install: composer update --prefer-dist --no-interaction
30+
install: composer update --prefer-source --no-interaction
3431

3532
script:
36-
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then bin/phpunit --debug --coverage-clover build/logs/clover.xml; else bin/phpunit --debug; fi
37-
- if [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then composer require "friendsofphp/php-cs-fixer:^2.0" && bin/php-cs-fixer fix --diff --dry-run -v; fi;
38-
39-
after_success:
40-
- if [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then composer require "satooshi/php-coveralls:^1.0" && travis_retry php bin/coveralls -v; fi
33+
- composer check-platform-reqs
34+
- bin/phpunit --debug
35+
- if [ "$TRAVIS_PHP_VERSION" != "8.0" ]; then composer require "friendsofphp/php-cs-fixer:^2.16" && bin/php-cs-fixer fix --diff --dry-run -v; fi

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
"overblog/promise-adapter": "self.version"
2828
},
2929
"require": {
30-
"php": "^5.5|^7.0"
30+
"php": "^7.1|^8.0"
3131
},
3232
"require-dev": {
3333
"guzzlehttp/promises": "^1.3.0",
34-
"phpunit/phpunit": "^4.1|^5.1",
34+
"phpunit/phpunit": "^7.5|^8.5",
3535
"react/promise": "^2.5.0",
36-
"webonyx/graphql-php": "^0.11.0"
36+
"webonyx/graphql-php": "^14.0"
3737
},
3838
"suggest": {
3939
"guzzlehttp/promises": "To use with Guzzle promise",

lib/promise-adapter/tests/AdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Overblog\PromiseAdapter\Adapter\WebonyxGraphQLSyncPromiseAdapter;
1717
use Overblog\PromiseAdapter\PromiseAdapterInterface;
1818

19-
class AdapterTest extends \PHPUnit_Framework_TestCase
19+
class AdapterTest extends \PHPUnit\Framework\TestCase
2020
{
2121
/**
2222
* @dataProvider AdapterDataProvider

phpunit.xml.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
<!-- http://phpunit.de/manual/4.1/en/appendixes.configuration.html -->
44
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
66
backupGlobals="false"
77
colors="true"
88
bootstrap="./vendor/autoload.php"
9+
convertDeprecationsToExceptions="false"
910
>
1011
<php>
1112
<ini name="error_reporting" value="-1" />

tests/Functional/Webonyx/GraphQL/Schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ public static function build(DataLoader $dataLoader)
8181
]
8282
]);
8383

84-
return new \GraphQL\Schema(['query' => $queryType]);
84+
return new \GraphQL\Type\Schema(['query' => $queryType]);
8585
}
8686
}

tests/Functional/Webonyx/GraphQL/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Overblog\DataLoader\DataLoader;
1919
use Overblog\PromiseAdapter\PromiseAdapterInterface;
2020

21-
abstract class TestCase extends \PHPUnit_Framework_TestCase
21+
abstract class TestCase extends \PHPUnit\Framework\TestCase
2222
{
2323
private static $fixtures = null;
2424

tests/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
use Overblog\PromiseAdapter\Adapter\ReactPromiseAdapter;
1515
use Overblog\PromiseAdapter\PromiseAdapterInterface;
1616

17-
abstract class TestCase extends \PHPUnit_Framework_TestCase
17+
abstract class TestCase extends \PHPUnit\Framework\TestCase
1818
{
1919
/**
2020
* @var PromiseAdapterInterface
2121
*/
2222
protected static $promiseAdapter;
2323

24-
public function setUp()
24+
public function setUp(): void
2525
{
2626
self::$promiseAdapter = new ReactPromiseAdapter();
2727
}

0 commit comments

Comments
 (0)