Example #1
0
 public function testGetName()
 {
     $data = 'ObserverName';
     $this->assertEquals($data, $this->event->getName());
     $this->event = new Event();
     $this->assertNull($this->event->getName());
 }
Example #2
0
 /**
  * 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());
 }
Example #3
0
 /**
  * Register an event for this collection
  *
  * @param Event $event
  * @return $this
  */
 public function addEvent(Event $event)
 {
     $this->events[$event->getName()] = $event;
     return $this;
 }
Example #4
0
 /**
  * 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();
 }