|
@@ 35-44 (lines=10) @@
|
| 32 |
|
/** |
| 33 |
|
* @expectedException \Graze\GuzzleHttp\JsonRpc\Exception\ClientException |
| 34 |
|
*/ |
| 35 |
|
public function testApplyResponseThrowsClientException() |
| 36 |
|
{ |
| 37 |
|
$this->response->shouldReceive('getRpcErrorCode')->times(2)->withNoArgs()->andReturn(-32600); |
| 38 |
|
$this->request->shouldReceive('getRequestTarget')->once()->withNoArgs()->andReturn('http://foo'); |
| 39 |
|
$this->request->shouldReceive('getRpcMethod')->once()->withNoArgs()->andReturn('foo'); |
| 40 |
|
$this->response->shouldReceive('getRpcErrorMessage')->once()->withNoArgs()->andReturn('bar'); |
| 41 |
|
$this->response->shouldReceive('getStatusCode')->once()->withNoArgs()->andReturn(200); |
| 42 |
|
|
| 43 |
|
$this->middleware->applyResponse($this->request, $this->response, ['rpc_error' => true]); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
/** |
| 47 |
|
* @expectedException \Graze\GuzzleHttp\JsonRpc\Exception\ServerException |
|
@@ 49-58 (lines=10) @@
|
| 46 |
|
/** |
| 47 |
|
* @expectedException \Graze\GuzzleHttp\JsonRpc\Exception\ServerException |
| 48 |
|
*/ |
| 49 |
|
public function testApplyResponseThrowsServerException() |
| 50 |
|
{ |
| 51 |
|
$this->response->shouldReceive('getRpcErrorCode')->times(2)->withNoArgs()->andReturn(-32000); |
| 52 |
|
$this->request->shouldReceive('getRequestTarget')->once()->withNoArgs()->andReturn('http://foo'); |
| 53 |
|
$this->request->shouldReceive('getRpcMethod')->once()->withNoArgs()->andReturn('foo'); |
| 54 |
|
$this->response->shouldReceive('getRpcErrorMessage')->once()->withNoArgs()->andReturn('bar'); |
| 55 |
|
$this->response->shouldReceive('getStatusCode')->once()->withNoArgs()->andReturn(200); |
| 56 |
|
|
| 57 |
|
$this->middleware->applyResponse($this->request, $this->response, ['rpc_error' => true]); |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
public function testApplyResponseNoError() |
| 61 |
|
{ |