/** * @covers \thebuggenie\core\framework\Event::listen * @covers \thebuggenie\core\framework\Event::trigger * @covers \thebuggenie\core\framework\Event::triggerUntilProcessed * @depends testListening */ public function testTriggeringAndProcessing(\thebuggenie\core\framework\Event $event) { $this->wastriggered = false; \thebuggenie\core\framework\Event::clearListeners('modulename', 'identifier'); \thebuggenie\core\framework\Event::listen('modulename', 'identifier', array($this, 'listenerCallback')); $event->trigger(); $this->assertAttributeEquals(true, 'wastriggered', $this); \thebuggenie\core\framework\Event::clearListeners('modulename', 'identifier'); \thebuggenie\core\framework\Event::listen('modulename', 'identifier', array($this, 'listenerCallbackNonProcessingFirst')); \thebuggenie\core\framework\Event::listen('modulename', 'identifier', array($this, 'listenerCallbackNonProcessingSecond')); \thebuggenie\core\framework\Event::listen('modulename', 'identifier', array($this, 'listenerCallbackProcessing')); $this->wasprocessed = array(); $event->triggerUntilProcessed(); $this->assertAttributeNotEmpty('wasprocessed', $this); $this->assertAttributeContains(1, 'wasprocessed', $this); $this->assertAttributeContains(2, 'wasprocessed', $this); $this->assertAttributeNotContains(3, 'wasprocessed', $this); }
/** * Unloads a loaded module * * @param string $module_name The name of the module to unload */ public static function unloadModule($module_name) { if (isset(self::$_modules[$module_name])) { unset(self::$_modules[$module_name]); Event::clearListeners($module_name); } }