/** * @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_send_emails($adapter, $mail) { $adapter->canSend($mail)->willReturn(true); $adapter->send($mail)->shouldBeCalled(); $this->send($mail); }