Ejemplo n.º 1
0
 /**
  * Checks if handler supports this notification and eventually
  * send the notification
  *
  * @param NotificationInterface $notification
  * @param NotificationHandlerInterface $handler
  *
  * @return bool
  */
 protected function handle(NotificationInterface $notification, NotificationHandlerInterface $handler)
 {
     if (!$handler->supports($notification)) {
         return false;
     }
     $cloned = clone $notification;
     $event = new NotifyEvent($cloned, $handler);
     $this->eventDispatcher->dispatch(Events::NOTIFY, $event);
     $handler->notify($cloned);
     foreach ($cloned->getResultSet()->all() as $result) {
         $notification->addResult($result);
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * @dataProvider withoutTo
  *
  * @expectedException \Fazland\Notifire\Exception\NotificationFailedException
  *
  * @param Sms $sms
  */
 public function testShouldThrowNotificationFailedExceptionWithoutToField(Sms $sms)
 {
     $this->handler->notify($sms);
 }