Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Commit 5e1dd61

Browse files
authored
Merge pull request #35 from timoschinkel/support-psr-18
Support psr 18
2 parents 8559635 + b69bb8d commit 5e1dd61

File tree

5 files changed

+42
-22
lines changed

5 files changed

+42
-22
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ cache:
77
- $HOME/.composer/cache/files
88

99
php:
10-
- 5.5
11-
- 5.6
1210
- 7.0
11+
- 7.1
12+
- 7.2
13+
- 7.3
1314
- hhvm
1415

1516
env:
@@ -25,7 +26,7 @@ matrix:
2526
- php: hhvm
2627
fast_finish: true
2728
include:
28-
- php: 5.5
29+
- php: 7.0
2930
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci"
3031

3132
before_install:

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Change Log
22

3+
## [2.0.0] - 2019-02-02
4+
5+
### Added
6+
7+
- Support for HTTPlug 2.0 and PSR-18
8+
9+
### Changed
10+
11+
- `\Http\Adapter\Guzzle5\Tests\ExceptionTest` extends `\PHPUnit\Framework\TestCase` instead of `PHPUnit_Framework_TestCase`
12+
13+
### Removed
14+
15+
- Support for PHP <7.0
16+
- Support for PHPUnit <6.0
17+
318
## 1.0.1 - 2017-07-11
419

520
### Fixed

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^5.5 || ^7.0",
19-
"php-http/httplug": "^1.0",
18+
"php": "^7.0",
19+
"php-http/httplug": "^2.0",
2020
"guzzlehttp/guzzle": "^5.1",
2121
"php-http/discovery": "^1.0"
2222
},
2323
"require-dev": {
2424
"ext-curl": "*",
25-
"php-http/client-integration-tests": "^0.5.1",
25+
"phpunit/phpunit": "^6.0 || ^7.0",
26+
"php-http/client-integration-tests": "^2.0",
2627
"guzzlehttp/ringphp": "^1.1"
2728
},
2829
"provide": {
29-
"php-http/client-implementation": "1.0"
30+
"php-http/client-implementation": "1.0",
31+
"psr/http-client-implementation": "1.0"
3032
},
3133
"autoload": {
3234
"psr-4": {
@@ -44,7 +46,7 @@
4446
},
4547
"extra": {
4648
"branch-alias": {
47-
"dev-master": "1.0-dev"
49+
"dev-master": "2.0-dev"
4850
}
4951
}
5052
}

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(ClientInterface $client = null, ResponseFactory $res
4343
/**
4444
* {@inheritdoc}
4545
*/
46-
public function sendRequest(RequestInterface $request)
46+
public function sendRequest(RequestInterface $request): ResponseInterface
4747
{
4848
$guzzleRequest = $this->createRequest($request);
4949

tests/ExceptionTest.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
use GuzzleHttp\Stream\Stream;
1010
use Http\Adapter\Guzzle5\Client;
1111
use Http\Message\MessageFactory\GuzzleMessageFactory;
12+
use PHPUnit\Framework\TestCase;
1213

1314
/**
1415
* @author Tobias Nyholm <[email protected]>
1516
*/
16-
class ExceptionTest extends \PHPUnit_Framework_TestCase
17+
class ExceptionTest extends TestCase
1718
{
1819
private $guzzleRequest;
20+
1921
private $guzzleResponse;
2022

2123
public function setUp()
@@ -37,84 +39,84 @@ protected function makeRequest(GuzzleExceptions\TransferException $exception)
3739
public function testConnectException()
3840
{
3941
// Guzzle's ConnectException should be converted to a NetworkException
40-
$this->setExpectedException('Http\Client\Exception\NetworkException');
42+
$this->expectException('Http\Client\Exception\NetworkException');
4143
$this->makeRequest(new GuzzleExceptions\ConnectException('foo', $this->guzzleRequest));
4244
}
4345

4446
public function testTooManyRedirectsException()
4547
{
4648
// Guzzle's TooManyRedirectsException should be converted to a RequestException
47-
$this->setExpectedException('Http\Client\Exception\RequestException');
49+
$this->expectException('Http\Client\Exception\RequestException');
4850
$this->makeRequest(new GuzzleExceptions\TooManyRedirectsException('foo', $this->guzzleRequest));
4951
}
5052

5153
public function testRequestException()
5254
{
5355
// Guzzle's RequestException should be converted to a HttpException
54-
$this->setExpectedException('Http\Client\Exception\HttpException');
56+
$this->expectException('Http\Client\Exception\HttpException');
5557
$this->makeRequest(new GuzzleExceptions\RequestException('foo', $this->guzzleRequest, $this->guzzleResponse));
5658
}
5759

5860
public function testRequestExceptionWithoutResponse()
5961
{
6062
// Guzzle's RequestException with no response should be converted to a RequestException
61-
$this->setExpectedException('Http\Client\Exception\RequestException');
63+
$this->expectException('Http\Client\Exception\RequestException');
6264
$this->makeRequest(new GuzzleExceptions\RequestException('foo', $this->guzzleRequest));
6365
}
6466

6567
public function testBadResponseException()
6668
{
6769
// Guzzle's BadResponseException should be converted to a HttpException
68-
$this->setExpectedException('Http\Client\Exception\HttpException');
70+
$this->expectException('Http\Client\Exception\HttpException');
6971
$this->makeRequest(new GuzzleExceptions\BadResponseException('foo', $this->guzzleRequest, $this->guzzleResponse));
7072
}
7173

7274
public function testBadResponseExceptionWithoutResponse()
7375
{
7476
// Guzzle's BadResponseException with no response should be converted to a RequestException
75-
$this->setExpectedException('Http\Client\Exception\RequestException');
77+
$this->expectException('Http\Client\Exception\RequestException');
7678
$this->makeRequest(new GuzzleExceptions\BadResponseException('foo', $this->guzzleRequest));
7779
}
7880

7981
public function testClientException()
8082
{
8183
// Guzzle's ClientException should be converted to a HttpException
82-
$this->setExpectedException('Http\Client\Exception\HttpException');
84+
$this->expectException('Http\Client\Exception\HttpException');
8385
$this->makeRequest(new GuzzleExceptions\ClientException('foo', $this->guzzleRequest, $this->guzzleResponse));
8486
}
8587

8688
public function testClientExceptionWithoutResponse()
8789
{
8890
// Guzzle's ClientException with no response should be converted to a RequestException
89-
$this->setExpectedException('Http\Client\Exception\RequestException');
91+
$this->expectException('Http\Client\Exception\RequestException');
9092
$this->makeRequest(new GuzzleExceptions\ClientException('foo', $this->guzzleRequest));
9193
}
9294

9395
public function testServerException()
9496
{
9597
// Guzzle's ServerException should be converted to a HttpException
96-
$this->setExpectedException('Http\Client\Exception\HttpException');
98+
$this->expectException('Http\Client\Exception\HttpException');
9799
$this->makeRequest(new GuzzleExceptions\ServerException('foo', $this->guzzleRequest, $this->guzzleResponse));
98100
}
99101

100102
public function testServerExceptionWithoutResponse()
101103
{
102104
// Guzzle's ServerException with no response should be converted to a RequestException
103-
$this->setExpectedException('Http\Client\Exception\RequestException');
105+
$this->expectException('Http\Client\Exception\RequestException');
104106
$this->makeRequest(new GuzzleExceptions\BadResponseException('foo', $this->guzzleRequest));
105107
}
106108

107109
public function testTransferException()
108110
{
109111
// Guzzle's TransferException should be converted to a TransferException
110-
$this->setExpectedException('Http\Client\Exception\TransferException');
112+
$this->expectException('Http\Client\Exception\TransferException');
111113
$this->makeRequest(new GuzzleExceptions\TransferException('foo'));
112114
}
113115

114116
public function testParseException()
115117
{
116118
// Guzzle's ParseException should be converted to a TransferException
117-
$this->setExpectedException('Http\Client\Exception\TransferException');
119+
$this->expectException('Http\Client\Exception\TransferException');
118120
$this->makeRequest(new GuzzleExceptions\ParseException('foo', $this->guzzleResponse));
119121
}
120122
}

0 commit comments

Comments
 (0)