Example #1
0
 public function testMultiplePrePostDispatch()
 {
     $preDispatch = 0;
     $postDispatch = 0;
     $this->object->getEventManager()->subscribe("pre.dispatch", function ($router, $app) use(&$preDispatch) {
         $preDispatch += 1;
     });
     $this->object->getEventManager()->subscribe("post.dispatch", function ($app) use(&$postDispatch) {
         ++$postDispatch;
     });
     ob_start();
     $this->object->run(new Request("/then/first"));
     ob_end_clean();
     $this->assertSame(2, $preDispatch);
     $this->assertSame(2, $postDispatch);
 }