From: Fabien Potencier Date: Sat, 21 Apr 2012 17:43:26 +0000 (+0200) Subject: added unit tests to prove the issue with the current introspection exception code X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=cf73b64556c48fe29614ff6723d6f18ced508244;p=web%2Fkonrad%2Ftwig.git added unit tests to prove the issue with the current introspection exception code --- diff --git a/test/Twig/Tests/ErrorTest.php b/test/Twig/Tests/ErrorTest.php index 978ee80..d0e48be 100644 --- a/test/Twig/Tests/ErrorTest.php +++ b/test/Twig/Tests/ErrorTest.php @@ -29,7 +29,7 @@ class Twig_Tests_ErrorTest extends PHPUnit_Framework_TestCase public function testTwigExceptionAddsFileAndLineWhenMissing() { - $loader = new Twig_Loader_Array(array('index' => "\n\n{{ foo.bar }}")); + $loader = new Twig_Loader_Array(array('index' => "\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}")); $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); $template = $twig->loadTemplate('index'); @@ -47,7 +47,7 @@ class Twig_Tests_ErrorTest extends PHPUnit_Framework_TestCase public function testRenderWrapsExceptions() { - $loader = new Twig_Loader_Array(array('index' => "\n\n\n{{ foo.bar }}")); + $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'); @@ -69,6 +69,9 @@ class Twig_Tests_ErrorTest extends PHPUnit_Framework_TestCase 'index' => "{% extends 'base' %} {% block content %} {{ foo.bar }} + {% endblock %} + {% block foo %} + {{ foo.bar }} {% endblock %}", 'base' => '{% block content %}{% endblock %}' ));