/** * Test clear hooks * * Pre-conditions: * Slim app instantiated; * Two hooks exist, each with one listener; * * Post-conditions: * Case A: Listeners for 'test.hook.one' are cleared; * Case B: Listeners for all hooks are cleared; */ public function testHookClear() { $app = new \Slim\Slim(); $app->hook('test.hook.one', function () { }); $app->hook('test.hook.two', function () { }); $app->clearHooks('test.hook.two'); $this->assertEquals(array(array()), $app->getHooks('test.hook.two')); $hookOne = $app->getHooks('test.hook.one'); $this->assertTrue(count($hookOne[10]) === 1); $app->clearHooks(); $this->assertEquals(array(array()), $app->getHooks('test.hook.one')); }