From: Fabien Potencier Date: Wed, 24 Jul 2013 03:14:54 +0000 (+0200) Subject: moved a test to the right place (refs #1146) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=cefa33adff3ebf7098c3840a1822eaea81bb85ae;p=web%2Fkonrad%2Ftwig.git moved a test to the right place (refs #1146) --- diff --git a/test/Twig/Tests/Fixtures/regression/issue_1126.test b/test/Twig/Tests/Fixtures/regression/issue_1126.test deleted file mode 100644 index 846eb56..0000000 --- a/test/Twig/Tests/Fixtures/regression/issue_1126.test +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -C extension causes php5-fpm to crash ---TEMPLATE-- -{{ data.test1 }} ---DATA-- -class test -{ - public function __isset($key) { - throw new Exception("Hey! Don't try to isset me!"); - } -} - -return array('data' => new test()) ---EXCEPTION-- -Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("Hey! Don't try to isset me!") in "index.twig" at line 2. diff --git a/test/Twig/Tests/TemplateTest.php b/test/Twig/Tests/TemplateTest.php index 9ae8147..823a9ce 100644 --- a/test/Twig/Tests/TemplateTest.php +++ b/test/Twig/Tests/TemplateTest.php @@ -27,9 +27,10 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase $template = $env->loadTemplate($name); $context = array( - 'string' => 'foo', - 'array' => array('foo' => 'foo'), - 'array_access' => new Twig_TemplateArrayAccessObject(), + 'string' => 'foo', + 'array' => array('foo' => 'foo'), + 'array_access' => new Twig_TemplateArrayAccessObject(), + 'magic_exception' => new Twig_TemplateMagicPropertyObjectWithException(), ); try { @@ -52,6 +53,7 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase array('{{ attribute(array, -10) }}', 'Key "-10" for array with keys "foo" does not exist in "%s" at line 1', false), array('{{ array_access.a }}', 'Method "a" for object "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false), array('{% macro foo(obj) %}{{ obj.missing_method() }}{% endmacro %}{{ _self.foo(array_access) }}', 'Method "missing_method" for object "Twig_TemplateArrayAccessObject" does not exist in "%s" at line 1', false), + array('{{ magic_exception.test }}', 'An exception has been thrown during the rendering of a template ("Hey! Don\'t try to isset me!") in "%s" at line 1.', false), ); if (function_exists('twig_template_get_attributes')) { @@ -480,6 +482,14 @@ class Twig_TemplateMagicPropertyObject } } +class Twig_TemplateMagicPropertyObjectWithException +{ + public function __isset($key) + { + throw new Exception("Hey! Don't try to isset me!"); + } +} + class Twig_TemplatePropertyObject { public $defined = 'defined';