Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function send($code, array $recipients, array $data = array())
 {
     $email = $this->provider->getEmail($code);
     if (!$email->isEnabled()) {
         return;
     }
     $senderAddress = $email->getSenderAddress() ?: $this->defaultSettingsProvider->getSenderAddress();
     $senderName = $email->getSenderName() ?: $this->defaultSettingsProvider->getSenderName();
     $renderedEmail = $this->rendererAdapter->render($email, $data);
     $this->senderAdapter->send($recipients, $senderAddress, $senderName, $renderedEmail, $email, $data);
 }
Exemple #2
0
 function it_does_not_send_disabled_emails(EmailInterface $email, EmailProviderInterface $provider, RendererAdapterInterface $rendererAdapter, SenderAdapterInterface $senderAdapter)
 {
     $provider->getEmail('bar')->willReturn($email);
     $email->isEnabled()->willReturn(false);
     $rendererAdapter->render($email, ['foo' => 2])->shouldNotBeCalled();
     $senderAdapter->send(['*****@*****.**'], '*****@*****.**', 'Sylius Mailer', null, $email, [])->shouldNotBeCalled();
     $this->send('bar', ['*****@*****.**'], ['foo' => 2]);
 }
Exemple #3
0
 function it_does_not_send_disabled_emails(RendererAdapterInterface $rendererAdapter, SenderAdapterInterface $senderAdapter, EmailProvider $provider, EmailInterface $email)
 {
     $provider->getEmail('bar')->shouldBeCalled()->willReturn($email);
     $email->isEnabled()->shouldBeCalled()->willReturn(false);
     $rendererAdapter->render($email, array('foo' => 2))->shouldNotBeCalled();
     $senderAdapter->send(array('*****@*****.**'), "*****@*****.**", "Sylius Mailer", null, $email, array())->shouldNotBeCalled();
     $this->send('bar', array('*****@*****.**'), array('foo' => 2));
 }