mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-03 05:56:43 +00:00
Add is array test
This commit is contained in:
@@ -202,6 +202,7 @@ class Twig_Extension_Core extends Twig_Extension
|
||||
'divisibleby' => new Twig_Test_Node('Twig_Node_Expression_Test_Divisibleby'),
|
||||
'constant' => new Twig_Test_Node('Twig_Node_Expression_Test_Constant'),
|
||||
'empty' => new Twig_Test_Function('twig_test_empty'),
|
||||
'array' => new Twig_Test_Function('is_array'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
"is_array" test
|
||||
--TEMPLATE--
|
||||
{{ foo is array ? 'ok' : 'ko' }}
|
||||
{{ obj is array ? 'ok' : 'ko' }}
|
||||
{{ val is array ? 'ok' : 'ko' }}
|
||||
--DATA--
|
||||
return array(
|
||||
'foo' => array(),
|
||||
'obj' => new stdClass(),
|
||||
'val' => 'test',
|
||||
);
|
||||
--EXPECT--
|
||||
ok
|
||||
ko
|
||||
ko
|
||||
Reference in New Issue
Block a user