public function testGetName() { $data = 'ObserverName'; $this->assertEquals($data, $this->event->getName()); $this->event = new Event(); $this->assertNull($this->event->getName()); }
/** * Checkes the observer's event_regex against event's name * * @param \Magento\Framework\Event $event * @return boolean */ public function isValidFor(\Magento\Framework\Event $event) { return preg_match($this->getEventRegex(), $event->getName()); }
/** * Register an event for this collection * * @param Event $event * @return $this */ public function addEvent(Event $event) { $this->events[$event->getName()] = $event; return $this; }
/** * Checks the observer's event_regex against event's name * * @param Event $event * @return boolean */ public function isValidFor(Event $event) { return $this->getEventName() === $event->getName(); }