/**
  * {@inheritdoc}
  */
 public function sendOrderConfirmation(OrderInterface $order)
 {
     if (!($email = $order->getEmail())) {
         throw new \InvalidArgumentException('Order must contain customer email');
     }
     $this->sendEmail(array('order' => $order), $email);
 }
 function it_sends_order_confirmation_email(OrderInterface $order, UserInterface $user, TwigMailerInterface $mailer)
 {
     $parameters = array('template' => 'test-template.html.twig', 'from_email' => '*****@*****.**');
     $this->beConstructedWith($mailer, $parameters);
     $order->getEmail()->willReturn('*****@*****.**');
     $mailer->sendEmail('test-template.html.twig', array('order' => $order), '*****@*****.**', '*****@*****.**')->shouldBeCalled();
     $this->sendOrderConfirmation($order);
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function sendOrderComment(OrderInterface $order, CommentInterface $comment = null)
 {
     if ($user = $order->getUser()) {
         $email = $user->getEmail();
     } else {
         $email = $order->getEmail();
     }
     if (!$email) {
         throw new \InvalidArgumentException('Order has to belong to a User.');
     }
     $this->sendEmail(array('order' => $order, 'comment' => $comment), $email);
 }