From b3db574a9f197c1e72e2ac2012cc93e3ee45beef Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 21 Nov 2014 16:18:07 +0100 Subject: [PATCH] properly set request attributes in controller test --- .../Bundle/TwigBundle/Controller/ExceptionController.php | 2 +- .../TwigBundle/Tests/Controller/ExceptionControllerTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php index 1f0dd4bfef..01deadc83b 100644 --- a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php @@ -122,7 +122,7 @@ class ExceptionController // default to a generic HTML exception $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 diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php index 222ac32c9e..4a17902ae9 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php @@ -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); $controller = new ExceptionController($twig, /* "showException" defaults to --> */ true);