/** * Test the triggerEvent method with a previously registered event. * * @return void * * @covers Windwalker\Event\Dispatcher::triggerEvent * @since 1.0 */ public function testTriggerEventRegistered() { $event = new Event('onSomething'); $mockedListener = $this->getMock('Windwalker\\Event\\Test\\Stub\\SomethingListener', array('onSomething')); $mockedListener->expects($this->once())->method('onSomething')->with($event); $this->instance->addEvent($event); $this->instance->addListener($mockedListener); $this->instance->triggerEvent('onSomething'); }
/** * registerListeners * * @param Dispatcher $dispatcher * * @return void */ public function registerListeners(Dispatcher $dispatcher) { $config = Ioc::getConfig(); $plugins = $config->get('plugins', array()); foreach ($plugins as $plugin) { if (class_exists($plugin) && is_subclass_of($plugin, 'Vaseman\\Plugin\\AbstractPlugin') && $plugin::$isEnabled) { $dispatcher->addListener(new $plugin()); } } }