Skip to content

Commit 58a78a6

Browse files
committed
Unit tests 2.
1 parent 3c080a9 commit 58a78a6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/services/BaseEmailService.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ abstract class BaseEmailService
4040
*/
4141
public function __construct(array $config, array $recipients)
4242
{
43-
if (!isset($config['email']['smtp']) && !defined('UNIT_TEST')) {
44-
throw new Exception("SMTP Server not properly set up.");
45-
}
43+
if(!defined('UNIT_TEST')) {
44+
if (!isset($config['email']['smtp'])) {
45+
throw new Exception("SMTP Server not properly set up.");
46+
}
4647

4748
$transport = Swift_SmtpTransport::newInstance(
4849
$config['email']['smtp']['host'],
@@ -54,7 +55,9 @@ public function __construct(array $config, array $recipients)
5455
->setUsername($config['email']['smtp']['username'])
5556
->setPassword($config['email']['smtp']['password'])
5657
;
57-
58+
} else {
59+
$transport = Swift_SmtpTransport::newInstance();
60+
}
5861

5962
$this->mailer = Swift_Mailer::newInstance($transport);
6063
$this->message = Swift_Message::newInstance();

0 commit comments

Comments
 (0)