Skip to content

Commit

Permalink
test error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-gribanov committed Jul 31, 2017
1 parent 0f0a1f4 commit da71cc5
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tests/Service/ErrorDetectorTest.php
Expand Up @@ -101,12 +101,30 @@ public function testBadJson()
$this->detector->detect($this->response);
}

/**
* @return array
*/
public function errorResponses()
{
return [
[
['code' => 404],
],
[
['code' => 500, 'message' => 'Some error message.'],
],
];
}

/**
* @expectedException \AnimeDb\Bundle\ShikimoriBrowserBundle\Exception\ErrorException
* @dataProvider errorResponses
*
* @param array $response
*/
public function testResponseFailed()
public function testResponseFailed(array $response)
{
$json = json_encode(['code' => 404]);
$json = json_encode($response);

$this->response
->expects($this->once())
Expand Down

0 comments on commit da71cc5

Please sign in to comment.