/** * @covers \jones\novaposhta\http\Client::execute * @expectedException \jones\novaposhta\http\ClientException * @expectedExceptionMessage Exception thrown by Guzzle client and has response */ public function testExecuteWithClientExceptionAndHasResponse() { $message = 'Exception thrown by Guzzle client and has response'; /** @var \GuzzleHttp\Psr7\Request $request */ $request = $this->getMockBuilder(GuzzleRequest::class)->disableOriginalConstructor()->getMock(); $exception = new ClientException($message, $request, $this->response); $this->guzzleClient->expects(static::once())->method('post')->willThrowException($exception); $this->response->expects(static::never())->method('getBody'); $this->client->execute($this->request, ConverterInterface::FORMAT_XML, Request::API_URL_XML); }