diff options
Diffstat (limited to 'vendor/tumblr/tumblr/test/RequestExceptionTest.php')
-rw-r--r-- | vendor/tumblr/tumblr/test/RequestExceptionTest.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/tumblr/tumblr/test/RequestExceptionTest.php b/vendor/tumblr/tumblr/test/RequestExceptionTest.php new file mode 100644 index 0000000..6180bca --- /dev/null +++ b/vendor/tumblr/tumblr/test/RequestExceptionTest.php @@ -0,0 +1,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); + } + +} |