public function testDoubleInvalidResponse() { $this->webClient->expects($this->exactly(2))->method('makeRequest')->with(new Paysera_WalletApi_Http_Request(''))->will($this->returnValue(new Paysera_WalletApi_Http_Response(502, array(), '<html> <head><title>502 Bad Gateway</title></head> <body bgcolor="white"> <center><h1>502 Bad Gateway</h1></center> <hr><center>nginx/1.0.15</center> </body> </html> '))); $this->setExpectedException('Paysera_WalletApi_Exception_ResponseException'); $this->service->makeRequest(new Paysera_WalletApi_Http_Request('')); }
/** * @dataProvider test_makeRequest_correctly_handles_makeRequest_return_value_provider * * @param int $status * @param string $content * * @throws Paysera_WalletApi_Exception_ResponseException */ public function test_makeRequest_correctly_handles_webClient_makeRequest_corrupt_response($status, $content) { $webClient = $this->getMock('\\Paysera_WalletApi_Http_ClientInterface', array('makeRequest')); $webClient->expects($this->any())->method('makeRequest')->will($this->returnValue(new Paysera_WalletApi_Http_Response($status, array(), $content))); $basicClient = new Paysera_WalletApi_Client_BasicClient($webClient, $this->getMock('\\Paysera_WalletApi_EventDispatcher_EventDispatcher')); $this->setExpectedException('\\Paysera_WalletApi_Exception_ApiException'); $basicClient->makeRequest(new Paysera_WalletApi_Http_Request('http://example.com/', \Paysera_WalletApi_Http_Request::METHOD_GET)); }
/** * Makes specified request. * URI in request object can be relative to current context (without endpoint and API path). * Content of request is not encoded or otherwise modified by the client * * @param Paysera_WalletApi_Http_Request $request * @param array $options * * @throws Paysera_WalletApi_Exception_ApiException * @return mixed|null */ public function makeRequest(Paysera_WalletApi_Http_Request $request, $options = array()) { return $this->client->makeRequest($request, $options); }