public function setUp()
 {
     $this->dispatcher = $this->prophesize(EventDispatcherInterface::class);
     $this->manager = new NotificationManager();
     $this->manager->setEventDispatcher($this->dispatcher->reveal());
 }
Example #2
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);
 }