示例#1
0
 public function sendNotificationForNewMessage(Conversation $conversation, Message $message)
 {
     $send_to = $conversation->withUser($message->getFromUser());
     if (!$send_to->hasSendNotifications()) {
         // dont send if the user unchecked the "notify" setting on the profile form
         return;
     }
     $this->sendEmail($send_to, 'You received a new message', 'email/new-message.twig', ['message_from' => $message->getFromUser()->getName(), 'message_link' => $this->urlGenerator->generate('conversation.view', ['conversation_id' => $conversation->getId()], UrlGeneratorInterface::ABSOLUTE_URL)]);
 }
示例#2
0
 public function testCreateAndGetters()
 {
     $fromUser = \Mockery::mock('\\Mentoring\\User\\User');
     $body = 'This is my message';
     $createdAt = new \DateTime();
     $message = new Message($fromUser, $body, $createdAt);
     $this->assertSame($fromUser, $message->getFromUser());
     $this->assertSame($body, $message->getBody());
 }