@@ 52-62 (lines=11) @@ | ||
49 | * |
|
50 | * @param int $code |
|
51 | */ |
|
52 | public function testCreateClientException($code) |
|
53 | { |
|
54 | $this->request->shouldReceive('getRequestTarget')->once()->withNoArgs()->andReturn('http://foo'); |
|
55 | $this->request->shouldReceive('getRpcMethod')->once()->withNoArgs()->andReturn('foo'); |
|
56 | $this->response->shouldReceive('getRpcErrorCode')->once()->withNoArgs()->andReturn($code); |
|
57 | $this->response->shouldReceive('getRpcErrorMessage')->once()->withNoArgs()->andReturn('bar'); |
|
58 | $this->response->shouldReceive('getStatusCode')->once()->withNoArgs()->andReturn(200); |
|
59 | ||
60 | $exception = RequestException::create($this->request, $this->response); |
|
61 | $this->assertInstanceOf('Graze\GuzzleHttp\JsonRpc\Exception\ClientException', $exception); |
|
62 | } |
|
63 | ||
64 | /** |
|
65 | * @dataProvider dataCreateServerException |
|
@@ 69-79 (lines=11) @@ | ||
66 | * |
|
67 | * @param int $code |
|
68 | */ |
|
69 | public function testCreateServerException($code) |
|
70 | { |
|
71 | $this->request->shouldReceive('getRequestTarget')->once()->withNoArgs()->andReturn('http://foo'); |
|
72 | $this->request->shouldReceive('getRpcMethod')->once()->withNoArgs()->andReturn('foo'); |
|
73 | $this->response->shouldReceive('getRpcErrorCode')->once()->withNoArgs()->andReturn($code); |
|
74 | $this->response->shouldReceive('getRpcErrorMessage')->once()->withNoArgs()->andReturn('bar'); |
|
75 | $this->response->shouldReceive('getStatusCode')->once()->withNoArgs()->andReturn(200); |
|
76 | ||
77 | $exception = RequestException::create($this->request, $this->response); |
|
78 | $this->assertInstanceOf('Graze\GuzzleHttp\JsonRpc\Exception\ServerException', $exception); |
|
79 | } |
|
80 | } |
|
81 |