From: Jordi Boggiano Date: Fri, 13 Apr 2012 10:57:54 +0000 (+0200) Subject: Add is array test X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=b2e1675f0cb6fc36ea5bac541bdf3657fe74aae1;p=web%2Fkonrad%2Ftwig.git Add is array test --- diff --git a/lib/Twig/Extension/Core.php b/lib/Twig/Extension/Core.php index e241504..bdd2d00 100644 --- a/lib/Twig/Extension/Core.php +++ b/lib/Twig/Extension/Core.php @@ -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'), ); } diff --git a/test/Twig/Tests/Fixtures/tests/is_array.test b/test/Twig/Tests/Fixtures/tests/is_array.test new file mode 100644 index 0000000..1edb973 --- /dev/null +++ b/test/Twig/Tests/Fixtures/tests/is_array.test @@ -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 \ No newline at end of file