Example #1
0
 /**
  * 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);
 }
Example #2
0
 protected function tearDown()
 {
     Notifire::reset();
 }