diff options
author | James Fellows <james.fellows@finanscapes.com> | 2016-04-19 19:35:01 +0100 |
---|---|---|
committer | Richard Leland <rich@richleland.com> | 2016-04-19 14:35:01 -0400 |
commit | 34a4ae387ad4f74f69ba00296430918824727422 (patch) | |
tree | 8e3840de575fd157a826be46911a27500890c379 /test | |
parent | acb590ef2cdda14900016364f2903200846fe8db (diff) | |
download | php-sparkpost-34a4ae387ad4f74f69ba00296430918824727422.zip php-sparkpost-34a4ae387ad4f74f69ba00296430918824727422.tar.gz php-sparkpost-34a4ae387ad4f74f69ba00296430918824727422.tar.bz2 |
Improve Exception message on 403 response (#71)
Fixes #70.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/APIResourceTest.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/APIResourceTest.php b/test/unit/APIResourceTest.php index 0baef41..1d29c55 100644 --- a/test/unit/APIResourceTest.php +++ b/test/unit/APIResourceTest.php @@ -111,6 +111,21 @@ class APIResourceTest extends \PHPUnit_Framework_TestCase { } } + public function testAdapter403Exception() { + try { + $responseMock = Mockery::mock(); + $this->sparkPostMock->httpAdapter->shouldReceive('send')-> + once()-> + andReturn($responseMock); + $responseMock->shouldReceive('getStatusCode')->andReturn(403); + + $this->resource->get('test'); + } + catch(\Exception $e) { + $this->assertRegExp('/Request forbidden/', $e->getMessage()); + } + } + public function testAdapter4XXException() { try { $testBody = ['errors'=>['my'=>'test']]; |