Skip to content

Commit 12d0fbf

Browse files
Fix unit test mail issue
1 parent 00e4a8c commit 12d0fbf

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/Log/Mail.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ public function onPhpbuEnd(Event\App\End $event)
207207
$this->mailer->addAddress($recipient);
208208
}
209209

210-
if (!$this->mailer->send()) {
211-
throw new Exception($this->mailer->ErrorInfo);
210+
if ($this->transportType !== 'null') {
211+
$this->sendMail();
212212
}
213213
}
214214
}
@@ -350,6 +350,22 @@ protected function setupSendmailMailer(array $options)
350350
// nothing to do here
351351
}
352352

353+
/**
354+
* Send the email
355+
*
356+
* @throws \phpbu\App\Exception
357+
*/
358+
protected function sendMail()
359+
{
360+
try {
361+
if (!$this->mailer->send()) {
362+
throw new Exception($this->mailer->ErrorInfo);
363+
}
364+
} catch (\Exception $e) {
365+
throw new Exception($e->getMessage());
366+
}
367+
}
368+
353369
/**
354370
* Return mail header html
355371
*

0 commit comments

Comments
 (0)