本文整理汇总了PHP中thebuggenie\core\framework\Event::clearListeners方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::clearListeners方法的具体用法?PHP Event::clearListeners怎么用?PHP Event::clearListeners使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\framework\Event
的用法示例。
在下文中一共展示了Event::clearListeners方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTriggeringAndProcessing
/**
* @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);
}
示例2: unloadModule
/**
* 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);
}
}