-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60b3ce8
commit e86be9c
Showing
3 changed files
with
56 additions
and
5 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,42 @@ | ||
<?php | ||
|
||
namespace Mailosaur_Test; | ||
|
||
|
||
use Mailosaur\MailosaurClient; | ||
use Mailosaur\Models\ServerCreateOptions; | ||
use Mailosaur\Models\MailosaurException; | ||
|
||
class ErrorsTests extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testUnauthorized() | ||
{ | ||
try { | ||
$client = new MailosaurClient('invalid_key'); | ||
$client->servers->all(); | ||
} catch(MailosaurException $e) { | ||
$this->assertEquals('Authentication failed, check your API key.', $e->getMessage()); | ||
} | ||
} | ||
|
||
public function testNotFound() | ||
{ | ||
try { | ||
$client = new MailosaurClient(getenv('MAILOSAUR_API_KEY')); | ||
$client->servers->get('not_found'); | ||
} catch(MailosaurException $e) { | ||
$this->assertEquals('Not found, check input parameters.', $e->getMessage()); | ||
} | ||
} | ||
|
||
public function testBadRequest() | ||
{ | ||
try { | ||
$client = new MailosaurClient(getenv('MAILOSAUR_API_KEY')); | ||
$options = new ServerCreateOptions(); | ||
$client->servers->create($options); | ||
} catch(MailosaurException $e) { | ||
$this->assertEquals('(name) Please provide a name for your server\r\n', $e->getMessage()); | ||
} | ||
} | ||
} |
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