From: Kris Wallsmith Date: Thu, 18 Jul 2013 00:25:28 +0000 (-0700) Subject: failing test X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=de985a872f0185c248fc73c1e738a8d40d7b682d;p=web%2Fkonrad%2Ftwig.git failing test the error filename is incorrect when an exception is thrown from an included file --- diff --git a/test/Twig/Tests/ErrorTest.php b/test/Twig/Tests/ErrorTest.php index 9b28697..e6ef999 100644 --- a/test/Twig/Tests/ErrorTest.php +++ b/test/Twig/Tests/ErrorTest.php @@ -122,6 +122,26 @@ class Twig_Tests_ErrorTest extends PHPUnit_Framework_TestCase } } + public function testTwigExceptionAddsFileAndLineWhenMissingWithInclude() + { + $loader = new Twig_Loader_Array(array( + 'index' => "{% include 'partial' %}", + 'partial' => '{{ foo.bar }}' + )); + $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 "partial" at line 1.', $e->getMessage()); + $this->assertEquals(1, $e->getTemplateLine()); + $this->assertEquals('partial', $e->getTemplateFile()); + } + } + public function testTwigExceptionAddsFileAndLineWhenMissingWithInheritanceOnDisk() { $loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors');