예제 #1
0
 /**
  * 
  */
 protected function installHooks()
 {
     $hooksFile = $this->moduleDirectory . '/install/hooks.json';
     $moduleHooksFile = $this->moduleDirectory . '/install/registeredHooks.json';
     if (file_exists($hooksFile)) {
         $hooks = json_decode(file_get_contents($hooksFile), true);
         foreach ($hooks as $hook) {
             Hook::insertHook($hook['name'], $hook['description']);
         }
     }
     if (file_exists($moduleHooksFile)) {
         $moduleHooks = json_decode(file_get_contents($moduleHooksFile), true);
         foreach ($moduleHooks as $moduleHook) {
             Hook::register($this->moduleId, $moduleHook['name'], $moduleHook['moduleHook'], $moduleHook['moduleHookDescription']);
         }
     }
 }
예제 #2
0
파일: HookTest.php 프로젝트: rk4an/centreon
 public function testRegisterException()
 {
     Hook::register(1, 'displayLeftMenu', 'displayTest', 'a description');
     $this->setExpectedException("\\Centreon\\Internal\\Exception", "Hook already registered");
     Hook::register(1, 'displayLeftMenu', 'displayTest', 'a description');
 }