mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-24 10:03:27 +01:00
Adding another test
This commit is contained in:
parent
123fdd4d1a
commit
95d7473d9e
@ -249,13 +249,13 @@ class Client implements ClientInterface
|
||||
throw $this->getNoRingResponseException($trans->request);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->wrapException($request, $e);
|
||||
throw $this->wrapException($request, $e);
|
||||
}
|
||||
}
|
||||
|
||||
private function wrapException(RequestInterface $request, \Exception $e)
|
||||
{
|
||||
throw $e instanceof RequestException
|
||||
return $e instanceof RequestException
|
||||
? $e
|
||||
: new RequestException($e->getMessage(), $request, null, $e);
|
||||
}
|
||||
@ -274,7 +274,7 @@ class Client implements ClientInterface
|
||||
// Exceptions need to be removed when intercepting errors,
|
||||
// otherwise, they're thrown.
|
||||
if ($trans->exception) {
|
||||
$this->wrapException($trans->request, $trans->exception);
|
||||
throw $this->wrapException($trans->request, $trans->exception);
|
||||
}
|
||||
// No exception, so the transaction should have a response.
|
||||
if ($trans->response) {
|
||||
|
@ -338,6 +338,19 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
$client->get('http://httpbin.org');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \GuzzleHttp\Exception\RequestException
|
||||
* @expectedExceptionMessage incorrectly implemented Guzzle Ring adapter
|
||||
*/
|
||||
public function testEnsuresResponseIsPresentAfterDereferencing()
|
||||
{
|
||||
$adapter = function () {
|
||||
return new Future(function () { return []; });
|
||||
};
|
||||
$client = new Client(['adapter' => $adapter]);
|
||||
$client->get('http://httpbin.org')->deref();
|
||||
}
|
||||
|
||||
public function testClientHandlesErrorsDuringBeforeSend()
|
||||
{
|
||||
$client = new Client();
|
||||
|
Loading…
x
Reference in New Issue
Block a user