Exemple #1
0
 public function testCreatesIdenticalInstancesOnlyOnce()
 {
     Hook::register('test', __FUNCTION__, $this->validHook);
     $first = Hook::createInstance('test', __FUNCTION__);
     $second = Hook::createInstance('test', __FUNCTION__);
     $this->assertSame($first, $second);
 }
Exemple #2
0
 /**
  * Register hook
  *
  * @param string $name
  * @param string $class
  * @param string $key
  *
  * @return self
  */
 protected function registerHook($name, $class, $key = null)
 {
     if ($key === null) {
         $key = $this->name;
     }
     Hook::register($name, $key, $class);
     return $this;
 }