Exemple #1
0
 /**
  * @param RouteInfo $routeInfo
  * @param Request $request
  * @return Responder
  * @throws \Exception
  */
 private function handleUsingAction(Request $request, RouteInfo $routeInfo)
 {
     $actionClass = $routeInfo->getAction();
     if (!$actionClass) {
         throw new \Exception();
     }
     $reflectionClass = new \ReflectionClass($actionClass);
     if (!$reflectionClass->isInstantiable()) {
         throw new \Exception();
     }
     $action = new $actionClass();
     if (!$action instanceof Action) {
         throw new \Exception();
     }
     $this->triggerPreActionEvent($routeInfo);
     $response = $action->execute($request, $routeInfo);
     $this->triggerPostActionEvent($routeInfo);
     return $response;
 }
 public function testSetParams()
 {
     $route_info = new RouteInfo();
     $route_info->setParams(array('dummy'));
     $this->assertEquals(array('dummy'), $route_info->getParams());
 }