public function testRenderWrapsExceptions() {
$loader = new Twig_Loader_Array(array(
'index' => "\n\n\n{{ foo.bar }}\n\n\n\n{{ 'foo' }}",
));
$twig = new Twig_Environment($loader, array(
'strict_variables' => true,
'debug' => true,
'cache' => false,
));
$template = $twig
->loadTemplate('index');
try {
$template
->render(array(
'foo' => new Twig_Tests_ErrorTest_Foo(),
));
$this
->fail();
} catch (Twig_Error_Runtime $e) {
$this
->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index" at line 4.', $e
->getMessage());
$this
->assertEquals(4, $e
->getTemplateLine());
$this
->assertEquals('index', $e
->getTemplateFile());
}
}