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

Commit 5f0a8b8

Browse files
committed
Add spec for sending request with underlying client
1 parent fa9ccd9 commit 5f0a8b8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec/HttpMethodsClientSpec.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
namespace spec\Http\Client\Utils;
44

5+
use Http\Client\BatchResult;
56
use Http\Client\HttpClient;
67
use Http\Client\Utils\HttpMethodsClient;
78
use Http\Message\MessageFactory;
89
use PhpSpec\ObjectBehavior;
10+
use Psr\Http\Message\RequestInterface;
11+
use Psr\Http\Message\ResponseInterface;
912

1013
class HttpMethodsClientSpec extends ObjectBehavior
1114
{
@@ -74,6 +77,22 @@ function it_sends_a_options_request()
7477

7578
$this->options($data['uri'], $data['headers'], $data['body'])->shouldReturn(true);
7679
}
80+
81+
function it_should_send_request_with_underlying_client(HttpClient $client, MessageFactory $messageFactory, RequestInterface $request, ResponseInterface $response)
82+
{
83+
$client->sendRequest($request)->shouldBeCalled()->willReturn($response);
84+
85+
$this->beConstructedWith($client, $messageFactory);
86+
$this->sendRequest($request)->shouldReturn($response);
87+
}
88+
89+
function it_should_send_requests_with_underlying_client(HttpClient $client, MessageFactory $messageFactory, RequestInterface $request1, RequestInterface $request2, BatchResult $batchResult)
90+
{
91+
$client->sendRequests([$request1, $request2])->shouldBeCalled()->willReturn($batchResult);
92+
93+
$this->beConstructedWith($client, $messageFactory);
94+
$this->sendRequests([$request1, $request2])->shouldReturn($batchResult);
95+
}
7796
}
7897

7998
class HttpMethodsClientStub extends HttpMethodsClient

0 commit comments

Comments
 (0)