예제 #1
0
 /**
  * @params ModuleHookModel $hook
  * @depends testToggleActivation
  */
 public function testUpdate(ModuleHookModel $moduleHook)
 {
     $event = new ModuleHookUpdateEvent($moduleHook);
     $event->setHookId($moduleHook->getHookId())->setClassname($moduleHook->getClassname())->setMethod($moduleHook->getMethod())->setActive(true)->setDispatcher($this->dispatcher);
     $this->action->updateModuleHook($event);
     $updatedModuleHook = $event->getModuleHook();
     $this->assertEquals($event->getHookId(), $updatedModuleHook->getHookId());
     $this->assertEquals($event->getClassname(), $updatedModuleHook->getClassname());
     $this->assertEquals($event->getMethod(), $updatedModuleHook->getMethod());
     $this->assertEquals($event->getActive(), $updatedModuleHook->getActive());
     return $updatedModuleHook;
 }
예제 #2
0
 public function updateModuleHook(ModuleHookUpdateEvent $event)
 {
     if (null !== ($moduleHook = ModuleHookQuery::create()->findPk($event->getModuleHookId()))) {
         // todo: test if classname and method exists
         $moduleHook->setHookId($event->getHookId())->setClassname($event->getClassname())->setMethod($event->getMethod())->setActive($event->getActive())->setHookActive($this->isHookActive($event->getHookId()))->save();
         $event->setModuleHook($moduleHook);
         $this->cacheClear($event->getDispatcher());
     }
 }