-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds error test and throws error in SDK
- Loading branch information
Showing
3 changed files
with
47 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
class ErrorTest extends CloudApiTestCase | ||
{ | ||
|
||
public function testError403() | ||
{ | ||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/error403.json'); | ||
|
||
$client = $this->getMockClient($response); | ||
|
||
try { | ||
/** @var AcquiaCloudApi\CloudApi\Client $client */ | ||
$client->applications(); | ||
} catch (Exception $e) { | ||
$this->assertEquals($e->getMessage(), 'You do not have permission to view applications.'); | ||
|
||
return; | ||
} | ||
|
||
$this->fail(); | ||
} | ||
|
||
public function testError404() | ||
{ | ||
$response = $this->getPsr7JsonResponseForFixture('Endpoints/error404.json'); | ||
|
||
$client = $this->getMockClient($response); | ||
|
||
try { | ||
/** @var AcquiaCloudApi\CloudApi\Client $client */ | ||
$client->applications(); | ||
} catch (Exception $e) { | ||
$this->assertEquals($e->getMessage(), 'The application you are trying to access does not exist, or you do not have permission to access it.'); | ||
|
||
return; | ||
} | ||
|
||
$this->fail(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"error": "not_found", | ||
"message": "The application you are trying to access does not exist, or you do not have permission to access it." | ||
} |