|
2 | 2 |
|
3 | 3 | namespace spec\Http\Client\Utils; |
4 | 4 |
|
5 | | -use Http\Client\HttpPsrClient; |
| 5 | +use Http\Client\HttpClient; |
6 | 6 | use Http\Client\Utils\BatchRequest; |
7 | 7 | use PhpSpec\ObjectBehavior; |
8 | 8 | use Psr\Http\Message\RequestInterface; |
9 | 9 | use Psr\Http\Message\ResponseInterface; |
10 | 10 |
|
11 | 11 | class BatchRequestSpec extends ObjectBehavior |
12 | 12 | { |
13 | | - function let(HttpPsrClient $client) |
| 13 | + function let(HttpClient $client) |
14 | 14 | { |
15 | 15 | $this->beAnInstanceOf('spec\Http\Client\Utils\BatchRequestStub', [$client]); |
16 | 16 | } |
17 | 17 |
|
18 | | - function it_send_multiple_request_using_send_request(HttpPsrClient $client, RequestInterface $request1, RequestInterface $request2, ResponseInterface $response1, ResponseInterface $response2) |
| 18 | + function it_send_multiple_request_using_send_request(HttpClient $client, RequestInterface $request1, RequestInterface $request2, ResponseInterface $response1, ResponseInterface $response2) |
19 | 19 | { |
20 | | - $client->sendRequest($request1, [])->willReturn($response1); |
21 | | - $client->sendRequest($request2, [])->willReturn($response2); |
| 20 | + $client->sendRequest($request1)->willReturn($response1); |
| 21 | + $client->sendRequest($request2)->willReturn($response2); |
22 | 22 |
|
23 | | - $this->sendRequests([$request1, $request2], [])->shouldReturnAnInstanceOf('\Http\Client\BatchResult'); |
| 23 | + $this->sendRequests([$request1, $request2])->shouldReturnAnInstanceOf('Http\Client\BatchResult'); |
24 | 24 | } |
25 | 25 |
|
26 | | - function it_throw_batch_exception_if_one_or_more_request_failed(HttpPsrClient $client, RequestInterface $request1, RequestInterface $request2, ResponseInterface $response) |
| 26 | + function it_throw_batch_exception_if_one_or_more_request_failed(HttpClient $client, RequestInterface $request1, RequestInterface $request2, ResponseInterface $response) |
27 | 27 | { |
28 | | - $client->sendRequest($request1, [])->willReturn($response); |
29 | | - $client->sendRequest($request2, [])->willThrow('\Http\Client\Exception\HttpException'); |
| 28 | + $client->sendRequest($request1)->willReturn($response); |
| 29 | + $client->sendRequest($request2)->willThrow('Http\Client\Exception\HttpException'); |
30 | 30 |
|
31 | | - $this->shouldThrow('\Http\Client\Exception\BatchException')->duringSendRequests([$request1, $request2], []); |
| 31 | + $this->shouldThrow('Http\Client\Exception\BatchException')->duringSendRequests([$request1, $request2]); |
32 | 32 | } |
33 | 33 | } |
34 | 34 |
|
35 | | -class BatchRequestStub implements HttpPsrClient |
| 35 | +class BatchRequestStub implements HttpClient |
36 | 36 | { |
37 | 37 | use BatchRequest; |
38 | 38 |
|
39 | 39 | protected $client; |
40 | 40 |
|
41 | | - public function __construct(HttpPsrClient $client) |
| 41 | + public function __construct(HttpClient $client) |
42 | 42 | { |
43 | 43 | $this->client = $client; |
44 | 44 | } |
45 | 45 |
|
46 | 46 | /** |
47 | 47 | * {@inheritdoc} |
48 | 48 | */ |
49 | | - public function sendRequest(RequestInterface $request, array $options = []) |
| 49 | + public function sendRequest(RequestInterface $request) |
50 | 50 | { |
51 | | - return $this->client->sendRequest($request, $options); |
| 51 | + return $this->client->sendRequest($request); |
52 | 52 | } |
53 | 53 | } |
0 commit comments