/** * Initializes {@see Notifire} class with the current {@see NotificationInterface} * and instance of {@see EventDispatcherInterface} * * @throws Exception\NotificationAlreadyRegisteredException * @throws Exception\UnsupportedClassException */ public function initialize() { Notifire::reset(); $manager = new NotificationManager(); $manager->setThrowIfNotNotified(true); foreach ($this->handlers as $handler) { $manager->addHandler($handler); } if (null === $this->dispatcher) { $this->dispatcher = new EventDispatcher(); } $manager->setEventDispatcher($this->dispatcher); foreach ($this->notifications as $notificationName => $notificationClass) { Notifire::addNotification($notificationName, $notificationClass); } Notifire::setManager($manager); }
protected function tearDown() { Notifire::reset(); }