Exemple #1
0
 /**
  *  Makes a request.
  *
  *  @param Request $request A Request instance
  *  @return Response A Response instance
  */
 protected function doRequest($request)
 {
     // build a session before clearning the framework
     $container = $this->framework->getContainer();
     // create a session that doesn't actually do anything
     // http://symfony.com/doc/master/components/http_foundation/session_testing.html
     $session_storage = $container->createInstance('\\Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockArraySessionStorage');
     $session = $container->createInstance('\\Montage\\Session', array($session_storage));
     $this->framework->reset();
     $container = $this->framework->getContainer();
     $container->setInstance('request', $request);
     $container->setInstance(get_class($session), $session);
     // actually handle the request, capture the output since handle usually echoes to the screen...
     ob_start();
     $this->framework->handle();
     $output = ob_get_contents();
     ob_end_clean();
     // set the captured content into the response object...
     $response = $container->getResponse();
     $response->setContent($output);
     return $response;
 }
Exemple #2
0
 public function normalizeControllerParams(\ReflectionFunctionAbstract $rfunc, array $params)
 {
     return parent::normalizeControllerParams($rfunc, $params);
 }