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

Add spec for sending request with underlying client #15

Merged
merged 2 commits into from
Oct 24, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions spec/HttpMethodsClientSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

namespace spec\Http\Client\Utils;

use Http\Client\BatchResult;
use Http\Client\HttpClient;
use Http\Client\Utils\HttpMethodsClient;
use Http\Message\MessageFactory;
use PhpSpec\ObjectBehavior;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

class HttpMethodsClientSpec extends ObjectBehavior
{
Expand Down Expand Up @@ -74,6 +77,22 @@ function it_sends_a_options_request()

$this->options($data['uri'], $data['headers'], $data['body'])->shouldReturn(true);
}

function it_should_send_request_with_underlying_client(HttpClient $client, MessageFactory $messageFactory, RequestInterface $request, ResponseInterface $response)
{
$client->sendRequest($request)->shouldBeCalled()->willReturn($response);

$this->beConstructedWith($client, $messageFactory);
$this->sendRequest($request)->shouldReturn($response);
}

function it_should_send_requests_with_underlying_client(HttpClient $client, MessageFactory $messageFactory, RequestInterface $request1, RequestInterface $request2, BatchResult $batchResult)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pleas follow the language conventions above? it_sends_...

Thank you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

{
$client->sendRequests([$request1, $request2])->shouldBeCalled()->willReturn($batchResult);

$this->beConstructedWith($client, $messageFactory);
$this->sendRequests([$request1, $request2])->shouldReturn($batchResult);
}
}

class HttpMethodsClientStub extends HttpMethodsClient
Expand Down