blob: 6180bca306fe89c3db1179ea802022c2d11d3967 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<?php
class RequestExceptionTest extends PHPUnit_Framework_TestCase
{
public function provider()
{
$class_name = 'Tumblr\API\RequestException';
return array(
array(array('status' => 401, 'body' => '{}'), "$class_name: [401]: Unknown Error\n"),
array(array('status' => 404, 'body' => '{"meta":{"msg":"cool story bro"}}'), "$class_name: [404]: cool story bro\n"),
);
}
/**
* @dataProvider provider
*/
public function testErrorString($responseArr, $expectedString)
{
$response = (object) $responseArr;
$err = new \Tumblr\API\RequestException($response);
$this->assertEquals((string) $err, $expectedString);
}
}
|