function it_should_format_header_without_compression(ClientInterface $mockedClient, SessionInterface $mockedSession, RequestInterface $mockedRequest, ResponseInterface $mockedResponse) { $mockedSession->getToken()->willReturn(array('access_token' => 'accesstoken', 'instance_url' => 'def', 'token_type' => 'bearer')); $mockedClient->createRequest("get", "uri", ['headers' => ["Authorization" => "bearer accesstoken", "Accept" => "application/json", "Content-Type" => "application/json"]])->shouldBeCalled()->willReturn($mockedRequest); $mockedClient->send(Argument::any())->willReturn($mockedResponse); $mockedResponse->json()->shouldBeCalled()->willReturn('jsonResource'); $this->request('uri', ['compression' => false])->shouldReturn('jsonResource'); }
function it_returns_a_resource(ClientInterface $mockedClient, SessionInterface $mockedSession, RequestInterface $mockedRequest, ResponseInterface $mockedResponse) { $mockedClient->createRequest(Argument::type('string'), Argument::type('string'), Argument::type('array'))->willReturn($mockedRequest); $mockedClient->send(Argument::any())->willReturn($mockedResponse); $mockedResponse->json()->shouldBeCalled()->willReturn('jsonResource'); $mockedResponse->xml()->shouldBeCalled()->willReturn('xmlResource'); $mockedSession->getToken()->willReturn(array('access_token' => 'abc', 'instance_url' => 'def', 'token_type' => 'bearer')); $this->request('uri', [])->shouldReturn('jsonResource'); $this->request('uri', ['format' => 'xml'])->shouldReturn('xmlResource'); }