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