- Updates exception test logic

This commit is contained in:
Vlad
2016-06-02 12:33:58 -04:00
parent 645d4e15ab
commit 1e9da724ea

View File

@ -66,24 +66,20 @@ class MailerTest extends MailPoetTest {
function testItRequiresMailerMethod() {
try {
$exeption = false;
$mailer = new Mailer();
$this->fail('Mailer did not throw an exception');
} catch(Exception $e) {
expect($e->getMessage())->equals('Mailer is not configured.');
$exception = true;
}
expect($exception)->true();
}
function testItRequiresSender() {
try {
$exeption = false;
$mailer = new Mailer($mailer = $this->mailer);
$this->fail('Mailer did not throw an exception');
} catch(Exception $e) {
expect($e->getMessage())->equals('Sender name and email are not configured.');
$exception = true;
}
expect($exception)->true();
}
function testItCanConstruct() {
@ -105,13 +101,11 @@ class MailerTest extends MailPoetTest {
function testItThrowsUnknownMailerException() {
try {
$exception = false;
$mailer = new Mailer(array('method' => 'Unknown'), $this->sender);
$this->fail('Mailer did not throw an exception');
} catch(Exception $e) {
expect($e->getMessage())->equals('Mailing method does not exist.');
$exception = true;
}
expect($exception)->true();
}