Add is array test

This commit is contained in:
Jordi Boggiano
2012-04-13 12:57:54 +02:00
parent 4e28408ce1
commit b2e1675f0c
2 changed files with 17 additions and 0 deletions
+1
View File
@@ -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