I want to get error page (after an exception of the app is trhown) and not the debug page on testing environment.
I have tracked Twig Bundle code and the answer is in the Symfony\Bundle\TwigBundle\Controller\ExceptionController class in the findTemplate() method. Here I copy the responsible fragment of code that choose the template.
$name = $debug ? 'exception' : 'error';
if ($debug && 'html' == $format) {
$name = 'exception_full';
}
There is no problem with this code. The point is that I can't set the ExceptionController $debug variable to false for my test environment.
Based on TwigBundle Configuration Reference, it should be enough to set the debug parametar to false in config_test.yml.
twig:
debug: false
This is notworking.
I have browsed Symfony code and found this fragment configuration on vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml.
<service id="twig.controller.exception" class="%twig.controller.exception.class%">
<argument type="service" id="twig" />
<argument>%kernel.debug%</argument>
</service>
So, no matter what do I set on my configuration files, debug variable value is not modified.
What do you think about it?
I am working with Symfony 2.2.1 and this question is kind of related with this other question.