Skip to content

Commit ee812f5

Browse files
authored
WIP: Support PHP8 (#6)
1 parent 9eee02b commit ee812f5

7 files changed

+35
-27
lines changed

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^7.2",
14+
"php": "^7.2 | ^8.0",
1515
"php-http/httplug": "^2.0",
1616
"psr/http-client": "^1.0",
1717
"guzzlehttp/guzzle": "^7.0"
1818
},
1919
"require-dev": {
20-
"phpunit/phpunit": "^7.4",
21-
"php-http/client-integration-tests": "^2.0"
20+
"phpunit/phpunit": "^8.0|^9.3",
21+
"php-http/client-integration-tests": "^3.0"
2222
},
2323
"provide": {
2424
"php-http/client-implementation": "1.0",

phpunit.xml.dist

+18-14
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit colors="true" bootstrap="vendor/autoload.php">
3-
<testsuites>
4-
<testsuite name="Guzzle 7 HTTP Adapter Test Suite">
5-
<directory>tests/</directory>
6-
</testsuite>
7-
</testsuites>
8-
<php>
9-
<server name="TEST_SERVER" value="http://127.0.0.1:10000/server.php" />
10-
</php>
11-
<filter>
12-
<whitelist>
13-
<directory suffix=".php">src/</directory>
14-
</whitelist>
15-
</filter>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
colors="true"
5+
bootstrap="vendor/autoload.php"
6+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
7+
<coverage>
8+
<include>
9+
<directory suffix=".php">src/</directory>
10+
</include>
11+
</coverage>
12+
<testsuites>
13+
<testsuite name="Guzzle 7 HTTP Adapter Test Suite">
14+
<directory>tests/</directory>
15+
</testsuite>
16+
</testsuites>
17+
<php>
18+
<server name="TEST_SERVER" value="http://127.0.0.1:10000/server.php"/>
19+
</php>
1620
</phpunit>

tests/DefaultHttpAdapterTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Http\Adapter\Guzzle7\Client;
88
use Http\Client\Tests\HttpClientTest;
9+
use Psr\Http\Client\ClientInterface;
910

1011
/**
1112
* @author David Buchmann <[email protected]>
@@ -15,7 +16,7 @@ class DefaultHttpAdapterTest extends HttpClientTest
1516
/**
1617
* {@inheritdoc}
1718
*/
18-
protected function createHttpAdapter()
19+
protected function createHttpAdapter(): ClientInterface
1920
{
2021
return new Client();
2122
}

tests/HttpAdapterTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use GuzzleHttp\Client as GuzzleClient;
88
use Http\Adapter\Guzzle7\Client;
99
use Http\Client\Tests\HttpClientTest;
10+
use Psr\Http\Client\ClientInterface;
1011

1112
/**
1213
* @author GeLo <[email protected]>
@@ -16,7 +17,7 @@ abstract class HttpAdapterTest extends HttpClientTest
1617
/**
1718
* {@inheritdoc}
1819
*/
19-
protected function createHttpAdapter()
20+
protected function createHttpAdapter(): ClientInterface
2021
{
2122
return new Client(new GuzzleClient(['handler' => $this->createHandler()]));
2223
}

tests/HttpAsyncAdapterTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use GuzzleHttp\Client as GuzzleClient;
88
use Http\Adapter\Guzzle7\Client;
9+
use Http\Client\HttpAsyncClient;
910
use Http\Client\Tests\HttpAsyncClientTest;
1011

1112
/**
@@ -16,7 +17,7 @@ abstract class HttpAsyncAdapterTest extends HttpAsyncClientTest
1617
/**
1718
* {@inheritdoc}
1819
*/
19-
protected function createHttpAsyncClient()
20+
protected function createHttpAsyncClient(): HttpAsyncClient
2021
{
2122
return new Client(new GuzzleClient(['handler' => $this->createHandler()]));
2223
}

tests/PromiseExceptionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testExceptionThatIsThrownForGuzzleException(
2828
RequestInterface $request,
2929
$reason,
3030
string $adapterExceptionClass
31-
) {
31+
): void {
3232
$guzzlePromise = new \GuzzleHttp\Promise\Promise();
3333
$guzzlePromise->reject($reason);
3434
$promise = new Promise($guzzlePromise, $request);

tests/PromiseTest.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@
44

55
namespace Http\Adapter\Guzzle7\Tests;
66

7+
use Exception;
78
use GuzzleHttp\Promise\RejectedPromise;
89
use Http\Adapter\Guzzle7\Promise;
910
use PHPUnit\Framework\TestCase;
11+
use Psr\Http\Message\RequestInterface;
1012

1113
/**
1214
* @author Márk Sági-Kazár <[email protected]>
1315
*/
1416
class PromiseTest extends TestCase
1517
{
16-
/**
17-
* @expectedException \Exception
18-
*/
19-
public function testNonDomainExceptionIsHandled()
18+
public function testNonDomainExceptionIsHandled(): void
2019
{
21-
$request = $this->prophesize('Psr\Http\Message\RequestInterface');
22-
$promise = new RejectedPromise(new \Exception());
20+
$this->expectException(Exception::class);
21+
22+
$request = $this->prophesize(RequestInterface::class);
23+
$promise = new RejectedPromise(new Exception());
2324

2425
$guzzlePromise = new Promise($promise, $request->reveal());
2526

0 commit comments

Comments
 (0)