public function testDetachEvent() { Events::detachAll($eventType = 'test:fireAndCatchEvent'); Events::attach($eventType, $handler = function (Event $event) { /* @var static $obj */ $obj = $event->getSource(); $obj->eventChangeValue = true; }); $this->eventChangeValue = false; Events::detach($eventType, $handler); Events::fire($eventType, $this); $this->assertFalse($this->eventChangeValue, 'Event not detached'); }