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