/** * Deliver notifications via given instance of Notifier * @param Notifier $notifier */ public function deliver(Notifier $notifier) { foreach ($this->queue as $notification) { $notifier->notify($notification); $this->queue->dequeue(); } }
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); }