public function dispatch() { if (!$this->dispatchGranted) { return; } try { $this->activeRoute = $this->dispatcher->run(); } catch (\Faid\Dispatcher\RouteException $e) { throw new \NotFoundException('No matching route found for url - ' . $this->dispatcher->getRequest()->url()); } $this->activeRoute->dispatch(); }
public function testControllerMethodsCalled() { $request = new HttpRequest(); $request->uri('/Controller/test/'); $dispatcher = new Dispatcher($request); $dispatcher->addRoute(new HttpRoute(array('url' => '/Controller/test', 'controller' => '\\Faid\\tests\\Dispatcher\\testController', 'action' => 'someAction'))); $route = $dispatcher->run(); // $this->assertEquals(testController::getBeforeActionCalled(), false); $this->assertEquals(testController::getCalled(), false); // $route->dispatch(); // $this->assertEquals(testController::getBeforeActionCalled(), true); $this->assertEquals(testController::getCalled(), true); }