public function testCreatesIdenticalInstancesOnlyOnce() { Hook::register('test', __FUNCTION__, $this->validHook); $first = Hook::createInstance('test', __FUNCTION__); $second = Hook::createInstance('test', __FUNCTION__); $this->assertSame($first, $second); }
/** * 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; }