diff --git a/tests/TestCase.php b/tests/TestCase.php index da390e7..e0ca435 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -296,4 +296,8 @@ class Helper { return $this->word; } + + public function getArray() { + return array(1,2,3); + } } diff --git a/tests/cases/Fenom/TemplateTest.php b/tests/cases/Fenom/TemplateTest.php index 4607d90..5503331 100644 --- a/tests/cases/Fenom/TemplateTest.php +++ b/tests/cases/Fenom/TemplateTest.php @@ -688,7 +688,8 @@ class TemplateTest extends TestCase { $a = array( "list" => array(1 => "one", 2 => "two", 3 => "three"), - "empty" => array() + "empty" => array(), + "obj" => new Helper("testing") ); return array( array('Foreach: {foreach $list as $e} {$e}, {/foreach} end', $a, 'Foreach: one, two, three, end'), @@ -715,6 +716,7 @@ class TemplateTest extends TestCase ), array('Foreach: {foreach $empty as $k => $e} {$k} => {$e}, {/foreach} end', $a, 'Foreach: end'), array('Foreach: {foreach [] as $k => $e} {$k} => {$e}, {/foreach} end', $a, 'Foreach: end'), + array('Foreach: {foreach $obj->getArray() as $k => $e} {$k} => {$e}, {/foreach} end', $a, 'Foreach: 0 => 1, 1 => 2, 2 => 3, end'), array('Foreach: {foreach $unexists as $k => $e} {$k} => {$e}, {/foreach} end', $a, 'Foreach: end'), array( 'Foreach: {foreach $empty as $k => $e} {$k} => {$e}, {foreachelse} empty {/foreach} end',