Skip to content
This repository has been archived by the owner on Apr 13, 2020. It is now read-only.

Commit

Permalink
Added test for foreachelse on arrayiterators and such smarty-php/smar…
Browse files Browse the repository at this point in the history
  • Loading branch information
wisskid committed Jan 27, 2020
1 parent ea54c99 commit e0b12c3
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -94,6 +94,9 @@ public function dataTestForeach()
array('{foreach item=x from=$foo}{$x}{foreachelse}else{/foreach}{if $x@show}-show{else}-noshow{/if}', array(), 'else-noshow', '', $i ++),
array('{foreach $foo x y foo}{$y}.{$x},{foreachelse}else{/foreach}total{$smarty.foreach.foo.total}', array(9,10,11), '0.9,1.10,2.11,total3', '', $i ++),
array('{$x = "hallo"}{$bar=[1,2,3]}{foreach $foo as $x}outer={$x@index}.{$x}#{foreach $bar as $x}inner={$x@index}.{$x}{/foreach}##{/foreach}###{$x}', array(9,10,11), 'outer=0.9#inner=0.1inner=1.2inner=2.3##outer=1.10#inner=0.1inner=1.2inner=2.3##outer=2.11#inner=0.1inner=1.2inner=2.3#####hallo', '', $i ++),
array('{foreach $foo as $x}{$x}{foreachelse}else{/foreach}', null, 'else', '', $i ++),
array('{foreach $foo as $x}{$x}{foreachelse}else{/foreach}', [], 'else', '', $i ++),
array('{foreach $foo as $x}{$x}{foreachelse}else{/foreach}', new \ArrayIterator(), 'else', '', $i ++),
);
}

Expand Down

0 comments on commit e0b12c3

Please sign in to comment.