/** * @param Ticket $ticket */ private function dispatchEvents(Ticket $ticket) { foreach ($ticket->getRecordedEvents() as $event) { $this->dispatcher->dispatch($event->getEventName(), $event); } $this->notificationDeliveryManager->deliver($this->notifier); }
public function testDeliver() { $notification = new TicketNotification('unique_id', 1, 'Header', 'Subject', new \ArrayIterator(array('key' => 'value')), array('file.ext')); $manager = new NotificationDeliveryManager(); $manager->add($notification); $this->notifier->expects($this->once())->method('notify')->with($notification); $manager->deliver($this->notifier); }
/** * Dispatches events * * @param Ticket $ticket */ private function dispatchEvents(Ticket $ticket) { $events = $ticket->getRecordedEvents(); if (empty($events)) { return; } foreach ($events as $event) { $this->dispatcher->dispatch($event->getEventName(), $event); } $this->notificationDeliveryManager->deliver($this->notifier); }