コード例 #1
0
ファイル: EmailNotifierSpec.php プロジェクト: dasklney/kreta
 function it_notifies(\Swift_Mailer $mailer, \Swift_Mime_Message $message, NotificationInterface $notification, UserInterface $user)
 {
     $notification->getUser()->shouldBeCalled()->willReturn($user);
     $user->getEmail()->shouldBeCalled()->willReturn('*****@*****.**');
     $notification->getTitle()->shouldBeCalled()->willReturn('New issue!');
     $notification->getDescription()->shouldBeCalled()->willReturn('Notification body');
     $mailer->createMessage()->shouldBeCalled()->willReturn($message);
     $message->setTo('*****@*****.**')->shouldBeCalled()->willReturn($message);
     $message->setFrom('*****@*****.**')->shouldBeCalled()->willReturn($message);
     $message->setSubject('New issue!')->shouldBeCalled()->willReturn($message);
     $message->setBody('Notification body')->shouldBeCalled()->willReturn($message);
     $mailer->send($message)->shouldBeCalled();
     $this->notify($notification);
 }
コード例 #2
0
ファイル: EmailNotifier.php プロジェクト: dasklney/kreta
 /**
  * {@inheritdoc}
  */
 public function notify(NotificationInterface $notification)
 {
     $message = $this->mailer->createMessage();
     $message->setTo($notification->getUser()->getEmail())->setFrom('*****@*****.**')->setSubject($notification->getTitle())->setBody($notification->getDescription());
     $this->mailer->send($message);
 }