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