/** * @dataProvider providerTestSetResponseThrowsResponseExceptionWhenRequestIsNotSuccess */ public function testSetResponseThrowsResponseExceptionWhenRequestIsNotSuccess($statusCode) { $this->setExpectedException('\\CurrencyExchange\\Exception\\ResponseException'); $fakeResponse = new GuzzleResponse($statusCode); $stubHttpClient = new Client(); $stubHttpClient->setResponse($fakeResponse); }
/** * Instantiates a new CurrencyExchange\HttpClient object and initializes it with http type of uri * * @param CurrencyExchange\Uri\UriAbstract $uri */ public function __construct(UriAbstract $uri) { $this->setUri($uri); /** @var CurrencyExchange\HttpClient */ $httpClient = new HttpClient(); $httpClient->getHttpRequest()->setHttpMethod($this->getUri()->getType()); // Set http method for this exchange method $this->setHttpClient($httpClient); }