public function testDispatchNotValidEvent() { $eventName = 'eventName'; $notValidName = 'event_name_2'; $eventMock = $this->getMock('Magento\\Framework\\Event', ['getName']); $eventMock->expects($this->once())->method('getName')->will($this->returnValue($eventName)); $this->observer->setData('event_name', $notValidName); $this->observer->dispatch($eventMock); }