/** * */ public function testPropagation() { $event = new Event('event1'); $this->assertFalse($event->isPropagationStopped()); $event->stopPropagation(); $this->assertTrue($event->isPropagationStopped()); }
/** * Trigger event with custom params * Can be called by passing event model * * @param string|Event $event * @param array $params * * @return Event */ public function trigger($event, array $params = []) { if (!$event instanceof Event) { $event = new Event($event, $params); } if ($listeners = $this->getListeners($event->getName())) { $this->dispatch($listeners, $event); } return $event; }
/** * @param Event $event * @throws \Graphite\Events\Exception */ public static function testCallbackWithStop(Event $event) { $event->setParams(['stop' => true]); $event->stopPropagation(); }