/** * @param MailInterface $mail * @throws \RuntimeException */ public function send(MailInterface $mail) { if (!$this->adapter->canSend($mail)) { throw new \RuntimeException('The e-mail could not be send with current configured mail-adapter.'); } $this->adapter->send($mail); }
/** * @param \Phpro\MailManager\Adapter\AdapterInterface $adapter * @param \Phpro\MailManager\Mail\MailInterface $mail */ public function it_should_not_send_unsupported_mails($adapter, $mail) { $adapter->canSend($mail)->willReturn(false); $this->shouldThrow('RuntimeException')->duringSend($mail); }