/** * @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)); }
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('')); }
/** * Makes PUT request, uri can be relative to current context (without endpoint and API path) * Content is encoded to JSON or some other supported format * * @param string $uri * @param mixed $content * @param array $options * * @return mixed|null */ public function put($uri, $content = null, $options = array()) { return $this->client->put($uri, $content, $options); }