From d84b978e1ae30dc6095026d161da270938e04b4b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 12 Apr 2011 09:35:37 +0200 Subject: [PATCH] fixed some tests --- test/Twig/Tests/ErrorTest.php | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/test/Twig/Tests/ErrorTest.php b/test/Twig/Tests/ErrorTest.php index 7af3036..3f914a6 100644 --- a/test/Twig/Tests/ErrorTest.php +++ b/test/Twig/Tests/ErrorTest.php @@ -13,7 +13,6 @@ require_once dirname(__FILE__).'/TestCase.php'; class Twig_Tests_ErrorTest extends Twig_Tests_TestCase { - /* public function testTwigExceptionAddsFileAndLineWhenMissing() { $loader = new Twig_Loader_Array(array('index' => "\n\n{{ foo.bar }}")); @@ -23,24 +22,29 @@ class Twig_Tests_ErrorTest extends Twig_Tests_TestCase try { $template->render(array()); + + $this->fail(); } catch (Twig_Error_Runtime $e) { + $this->assertEquals('Variable "foo" does not exist in "index" at line 3', $e->getMessage()); $this->assertEquals(3, $e->getTemplateLine()); $this->assertEquals('index', $e->getTemplateFile()); } } -*/ + public function testRenderWrapsExceptions() { - $loader = new Twig_Loader_Array(array('index' => "\n\n{{ foo.bar }}")); + $loader = new Twig_Loader_Array(array('index' => "\n\n\n{{ foo.bar }}")); $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => $this->getTempDir())); $template = $twig->loadTemplate('index'); try { $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); + + $this->fail(); } catch (Twig_Error_Runtime $e) { - $this->assertEquals('Runtime error... in "index" at line 3', $e->getMessage()); - $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('Runtime error... in "index" at line 4', $e->getMessage()); + $this->assertEquals(4, $e->getTemplateLine()); $this->assertEquals('index', $e->getTemplateFile()); } } -- 1.7.2.5