mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
moved a test to the right place (refs #1146)
This commit is contained in:
@@ -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.
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user