function it_send_password_reset_pin_mail(SenderInterface $sender, GenericEvent $event, UserInterface $user)
 {
     $event->getSubject()->willReturn($user);
     $user->getEmail()->willReturn('*****@*****.**');
     $sender->send('reset_password_pin', ['*****@*****.**'], Argument::any())->shouldBeCalled();
     $this->sendResetPasswordPinEmail($event);
 }
Beispiel #2
0
 /**
  * @param mixed  $user
  * @param string $emailCode
  */
 protected function sendEmail($user, $emailCode)
 {
     if (!$user instanceof UserInterface) {
         throw new UnexpectedTypeException($user, UserInterface::class);
     }
     $this->emailSender->send($emailCode, array($user->getEmail()), array('user' => $user));
 }
Beispiel #3
0
 /**
  * @param mixed  $user
  * @param string $emailCode
  */
 protected function sendEmail($user, $emailCode)
 {
     if (!$user instanceof UserInterface) {
         throw new UnexpectedTypeException($user, 'Sylius\\Component\\User\\Model\\UserInterface');
     }
     $this->emailSender->send($emailCode, array($user->getEmail()), array('user' => $user));
 }
Beispiel #4
0
 function it_sends_email_confirmation_successfully(GenericEvent $event, SenderInterface $emailSender, CustomerInterface $customer, UserInterface $user)
 {
     $event->getSubject()->shouldBeCalled()->willReturn($customer);
     $customer->getUser()->shouldBeCalled()->willReturn($user);
     $customer->getEmail()->shouldBeCalled()->willReturn('*****@*****.**');
     $user->isEnabled()->shouldBeCalled()->willReturn(true);
     $emailSender->send(Emails::USER_CONFIRMATION, ['*****@*****.**'], ['user' => $user])->shouldBeCalled();
     $this->sendUserConfirmationEmail($event)->shouldReturn(null);
 }
 function it_sends_an_email_registration_successfully(SenderInterface $emailSender, ChannelContextInterface $channelContext, GenericEvent $event, CustomerInterface $customer, ShopUserInterface $user, ChannelInterface $channel)
 {
     $event->getSubject()->willReturn($customer);
     $customer->getUser()->willReturn($user);
     $customer->getEmail()->willReturn('*****@*****.**');
     $user->getEmail()->willReturn('*****@*****.**');
     $channelContext->getChannel()->willReturn($channel);
     $emailSender->send(Emails::USER_REGISTRATION, ['*****@*****.**'], ['user' => $user])->shouldBeCalled();
     $this->sendUserRegistrationEmail($event);
 }
Beispiel #6
0
 /**
  * @param GenericEvent $event
  *
  * @throws UnexpectedTypeException
  */
 public function sendOrderCommentEmail(GenericEvent $event)
 {
     $comment = $event->getSubject();
     if (!$comment instanceof CommentInterface) {
         throw new UnexpectedTypeException($comment, 'Sylius\\Component\\Order\\Model\\CommentInterface');
     }
     if ($comment->getNotifyCustomer()) {
         $order = $comment->getOrder();
         $email = $order->getCustomer()->getEmail();
         $this->emailSender->send(Emails::ORDER_COMMENT, array($email), array('order' => $order, 'comment' => $comment));
     }
 }
Beispiel #7
0
 /**
  * @param GenericEvent $event
  *
  * @throws UnexpectedTypeException
  */
 public function sendUserConfirmationEmail(GenericEvent $event)
 {
     $customer = $event->getSubject();
     if (!$customer instanceof CustomerInterface) {
         throw new UnexpectedTypeException($customer, CustomerInterface::class);
     }
     if (null === ($user = $customer->getUser())) {
         return;
     }
     if (!$user->isEnabled()) {
         return;
     }
     if (null === ($email = $customer->getEmail()) || empty($email)) {
         return;
     }
     $this->emailSender->send(Emails::USER_CONFIRMATION, [$email], ['user' => $user]);
 }
Beispiel #8
0
 /**
  * @param OrderInterface $order
  */
 public function sendConfirmationEmail(OrderInterface $order)
 {
     $this->emailSender->send(Emails::ORDER_CONFIRMATION, [$order->getCustomer()->getEmail()], ['order' => $order]);
 }
 /**
  * @param ShipmentInterface $shipment
  */
 public function sendConfirmationEmail(ShipmentInterface $shipment)
 {
     /** @var \Sylius\Component\Core\Model\OrderInterface $order */
     $order = $shipment->getOrder();
     $this->emailSender->send(Emails::SHIPMENT_CONFIRMATION, array($order->getCustomer()->getEmail()), array('shipment' => $shipment, 'order' => $order));
 }
Beispiel #10
0
 function it_should_send_the_order_comment_email_if_the_customer_email_does_not_exist(GenericEvent $event, CommentInterface $comment, SenderInterface $emailSender, OrderInterface $order, CustomerInterface $customer)
 {
     $event->getSubject()->shouldBeCalled()->willReturn($comment);
     $comment->getNotifyCustomer()->shouldBeCalled()->willReturn(true);
     $comment->getOrder()->shouldBeCalled()->willReturn($order);
     $order->getCustomer()->shouldBeCalled()->willReturn($customer);
     $customer->getEmail()->shouldBeCalled()->willReturn(null);
     $emailSender->send(Argument::any(), Argument::any(), Argument::any())->shouldNotBeCalled();
     $this->sendOrderCommentEmail($event);
 }
Beispiel #11
0
 /**
  * {@inheritdoc}
  */
 public function send($code, array $recipients, array $data = array())
 {
     return $this->sender->send($code, $recipients, $data);
 }