예제 #1
0
파일: SlimTest.php 프로젝트: ntdt/Slim
 /**
  * Test clear hooks
  *
  * Pre-conditions:
  * Slim app initialized
  * 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() {
     Slim::init();
     Slim::hook('test.hook.one', function () {});
     Slim::hook('test.hook.two', function () {});
     Slim::clearHooks('test.hook.two');
     $this->assertEquals(array(), Slim::getHooks('test.hook.two'));
     $this->assertTrue(count(Slim::getHooks('test.hook.one')) === 1);
     Slim::clearHooks();
     $this->assertEquals(array(), Slim::getHooks('test.hook.one'));
 }
예제 #2
0
파일: SlimTest.php 프로젝트: rs3d/Slimplr
 /**
  * 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();
     $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'));
 }