properly set request attributes in controller test

This commit is contained in:
Christian Flothmann 2014-11-21 16:18:07 +01:00
parent aec10e6a24
commit b3db574a9f
2 changed files with 3 additions and 2 deletions

View File

@ -122,7 +122,7 @@ class ExceptionController
// default to a generic HTML exception // default to a generic HTML exception
$request->setRequestFormat('html'); $request->setRequestFormat('html');
return new TemplateReference('TwigBundle', 'Exception', $this->debug ? 'exception_full' : $name, 'html', 'twig'); return new TemplateReference('TwigBundle', 'Exception', $showException ? 'exception_full' : $name, 'html', 'twig');
} }
// to be removed when the minimum required version of Twig is >= 2.0 // to be removed when the minimum required version of Twig is >= 2.0

View File

@ -51,7 +51,8 @@ class ExceptionControllerTest extends TestCase
)) ))
); );
$request = Request::create('whatever', 'GET', array('showException' => false)); $request = Request::create('whatever', 'GET');
$request->attributes->set('showException', false);
$exception = FlattenException::create(new \Exception(), 404); $exception = FlattenException::create(new \Exception(), 404);
$controller = new ExceptionController($twig, /* "showException" defaults to --> */ true); $controller = new ExceptionController($twig, /* "showException" defaults to --> */ true);