diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php b/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php index 48833946..d8ae5b2d 100644 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php @@ -18,7 +18,8 @@ class CompileForeachTest extends PHPUnit_Smarty public function setUp() { $this->setUpSmarty(dirname(__FILE__)); - //$this->smarty->force_compile = true; + $this->smarty->addPluginsDir("../../../__shared/PHPunitplugins/"); + $this->smarty->addTemplateDir("./templates_tmp"); } public function testInit() @@ -27,148 +28,123 @@ class CompileForeachTest extends PHPUnit_Smarty } /** - * test {foreach} tag + * Test foreach tags + * + * + * @preserveGlobalState disabled + * @dataProvider dataTestForeach */ - public function testForeach_001() + public function testForeach($code, $foo, $result, $testName, $testNumber) { - $this->smarty->assign('foo', array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); - $this->assertEquals("0123456789", $this->smarty->fetch('001_foreach.tpl')); + $file = "testForeach_{$testNumber}.tpl"; + $this->makeTemplateFile($file, $code); + $this->smarty->assign('x', 'x'); + $this->smarty->assign('y', 'y'); + if ($foo !== null) { + $this->smarty->assign('foo', $foo); + } else { + // unassigned $from parameter + $this->smarty->setErrorReporting(error_reporting() & ~(E_NOTICE | E_USER_NOTICE)); + } + + $this->assertEquals($this->strip($result), $this->strip($this->smarty->fetch($file)), "testForeach - {$code} - {$testName}"); } - public function testForeachBreak_002() + /* + * Data provider für testForeach + */ + public function dataTestForeach() { - $this->smarty->assign('foo', array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); - $this->assertEquals("01", $this->smarty->fetch('002_foreach.tpl')); + $i = 0; + /* + * Code + * $foo value + * result + * test name + */ + return array( + array('{foreach item=x from=$foo}{$x}{/foreach}', array(1,2,3), '123', '', $i ++), + array('{foreach $foo as $x}{$x}{/foreach}', array(1,2,3), '123', '', $i ++), + array('{foreach item=x from=$foo}{if $x == 2}{break}{/if}{$x}{/foreach}', array(0,1,2,3,4), '01', '', $i ++), + array('{foreach item=x from=$foo}{if $x == 2}{continue}{/if}{$x}{/foreach}', array(0,1,2,3,4), '0134', '', $i ++), + array('{foreach item=x from=$foo}{$x}{foreachelse}else{/foreach}', array(1,2,3), '123', '', $i ++), + array('{foreach item=x from=$foo}{$x}{foreachelse}else{/foreach}', array(), 'else', '', $i ++), + array('{foreach item=x from=$foo}{$x}{foreachelse}else{/foreach}', null, 'else', '', $i ++), + array('{foreach item=x key=y from=$foo}{$y}=>{$x},{foreachelse}else{/foreach}', array(1,2,3), '0=>1,1=>2,2=>3,', '', $i ++), + array('{foreach $foo as $y => $x}{$y}=>{$x},{foreachelse}else{/foreach}', array(1,2,3), '0=>1,1=>2,2=>3,', '', $i ++), + array('{foreach $foo as $y => $x}{$y}=>{$x},{/foreach}-{$x}-{$y}', array(1,2,3), '0=>1,1=>2,2=>3,-x-y', 'saved loop variables', $i ++), + array('{foreach $foo as $y => $x}{$y}=>{$x},{foreachelse}else{/foreach}-{$x}-{$y}', array(1,2,3), '0=>1,1=>2,2=>3,-x-y', 'saved loop variables', $i ++), + array('{foreach $foo as $y => $x}{$y}=>{$x},{foreachelse}else{/foreach}-{$x}-{$y}', array(), 'else-x-y', 'saved loop variables', $i ++), + array('{foreach $foo as $x}{$x@key}=>{$x},{foreachelse}else{/foreach}', array(1,2,3), '0=>1,1=>2,2=>3,', '', $i ++), + array('{foreach item=x name=foo from=$foo}{$x}{foreachelse}else{/foreach}total{$smarty.foreach.foo.total}', array(1,2,3), '123total3', '', $i ++), + array('{foreach item=x from=$foo}{$x}{foreachelse}else{/foreach}total{$x@total}', array(1,2,3), '123total3', '', $i ++), + array('{foreach item=x name=foo from=$foo}{$smarty.foreach.foo.index}.{$x},{/foreach}', array(9,10,11), '0.9,1.10,2.11,', '', $i ++), + array('{foreach item=x from=$foo}{$x@index}.{$x},{/foreach}', array(9,10,11), '0.9,1.10,2.11,', '', $i ++), + array('{foreach item=x name=foo from=$foo}{$smarty.foreach.foo.iteration}.{$x},{/foreach}', array(9,10,11), '1.9,2.10,3.11,', '', $i ++), + array('{foreach item=x from=$foo}{$x@iteration}.{$x},{/foreach}', array(9,10,11), '1.9,2.10,3.11,', '', $i ++), + array('{foreach item=x from=$foo}{$x@iteration}.{$x}-{$x=\'foo\'}{$x},{/foreach}', array(9,10,11), '1.9-foo,2.10-foo,3.11-foo,', '', $i ++), + array('{foreach item=x name=foo from=$foo}{if $smarty.foreach.foo.first}first{/if}{$x},{/foreach}', array(9,10,11), 'first9,10,11,', '', $i ++), + array('{foreach item=x from=$foo}{if $x@first}first{/if}{$x},{/foreach}', array(9,10,11), 'first9,10,11,', '', $i ++), + array('{foreach item=x name=foo from=$foo}{if $smarty.foreach.foo.last}last{/if}{$x},{/foreach}', array(9,10,11), '9,10,last11,', '', $i ++), + array('{foreach item=x name=foo from=$foo}{if $smarty.foreach.foo.last}last{/if}{$smarty.foreach.foo.iteration}.{$x},{/foreach}', array(9,10,11), '1.9,2.10,last3.11,', '', $i ++), + array('{foreach item=x from=$foo}{if $x@last}last{/if}{$x},{/foreach}', array(9,10,11), '9,10,last11,', '', $i ++), + array('{foreach item=x name=foo from=$foo}{$x}{foreachelse}else{/foreach}{if $smarty.foreach.foo.show}-show{else}-noshow{/if}', array(9,10,11), '91011-show', '', $i ++), + array('{foreach item=x name=foo from=$foo}{$x}{foreachelse}else{/foreach}{if $smarty.foreach.foo.show}-show{else}-noshow{/if}', array(), 'else-noshow', '', $i ++), + array('{foreach item=x from=$foo}{$x}{foreachelse}else{/foreach}{if $x@show}-show{else}-noshow{/if}', array(9,10,11), '91011-show', '', $i ++), + 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 ++), + ); } - public function testForeachContinue_003() - { - $this->smarty->assign('foo', array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); - $this->assertEquals("013456789", $this->smarty->fetch('003_foreach.tpl')); - } - - public function testForeachNotElse_004() - { - $this->smarty->assign('foo', array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); - $this->assertEquals("0123456789", $this->smarty->fetch('004_foreach.tpl')); - } - - public function testForeachElse_005() - { - $this->smarty->assign('foo', array()); - $this->assertEquals("else", $this->smarty->fetch('005_foreach.tpl')); - } - - public function testForeachElse_005_2() - { - $this->smarty->setErrorReporting(error_reporting() & ~(E_NOTICE | E_USER_NOTICE)); - $this->assertEquals("else", $this->smarty->fetch('005_foreach.tpl')); - } - - public function testForeachKey_006() - { - $this->assertEquals("09182736455463728190", $this->smarty->fetch('006_foreach.tpl')); - } - - public function testForeachKeyProperty_007() - { - $this->assertEquals("09182736455463728190", $this->smarty->fetch('007_foreach.tpl')); - } - - public function testForeachTotal_008() - { - $this->assertEquals("0123456789total10", $this->smarty->fetch('008_foreach.tpl')); - } - - public function testForeachTotalProperty_009() - { - $this->assertEquals("0123456789total10", $this->smarty->fetch('009_foreach.tpl')); - } - - public function testForeachIndexIteration_010() - { - $this->assertEquals("011223344556677889910", $this->smarty->fetch('010_foreach.tpl')); - } - - public function testForeachIndexIterationProperty_011() - { - $this->assertEquals("011223344556677889910", $this->smarty->fetch('011_foreach.tpl')); - } - - public function testForeachFirstLast_012() - { - $this->assertEquals("first012345678last9", $this->smarty->fetch('012_foreach.tpl')); - } - - public function testForeachFirstLastProperty_013() - { - $this->assertEquals("first012345678last9", $this->smarty->fetch('013_foreach.tpl')); - } - - public function testForeachShowTrue_014() - { - $this->assertEquals("01show", $this->smarty->fetch('014_foreach.tpl')); - } - - public function testForeachShowTrueProperty_015() - { - $this->assertEquals("01show", $this->smarty->fetch('015_foreach.tpl')); - } - - public function testForeachShowFalse_016() - { - $this->assertEquals("else noshow", $this->smarty->fetch('016_foreach.tpl')); - } - - public function testForeachShowFalseProperty_017() - { - $this->assertEquals("else noshow", $this->smarty->fetch('017_foreach.tpl')); - } - - public function testForeachShorttags_018() - { - $this->assertEquals("09182736455463728190total10", $this->smarty->fetch('018_foreach.tpl')); - } /** - * test {foreach $foo as $x} tag + * Test foreach tags caching + * + * + * @preserveGlobalState disabled + * @dataProvider dataTestForeachNocache */ - public function testNewForeach_19() + public function testForeachCaching($code, $new, $assignNocache, $foo, $result, $testName, $testNumber) { - $this->smarty->assign('foo', array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); - $this->assertEquals("0123456789", $this->smarty->fetch('019_foreach.tpl')); + $this->smarty->caching = true; + $file = "testForeachNocache_{$testNumber}.tpl"; + if ($new) { + $this->makeTemplateFile($file, $code); + } + if ($foo !== null) { + $this->smarty->assign('foo', $foo, $assignNocache); + } else { + // unassigned $from parameter + $this->smarty->setErrorReporting(error_reporting() & ~(E_NOTICE | E_USER_NOTICE)); + } + + $this->assertEquals($this->strip($result), $this->strip($this->smarty->fetch($file)), "testForeach - {$code} - {$testName}"); } - public function testNewForeachNotElse_020() + /* + * Data provider für testForeachNocache + */ + public function dataTestForeachNocache() { - $this->smarty->assign('foo', array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); - $this->assertEquals("0123456789", $this->smarty->fetch('020_foreach.tpl')); + $i = 0; + /* + * Code + * new name new file + * assign nocache + * $foo value + * result + * test name + */ + return array( + array('{foreach item=x from=$foo}{$x}{/foreach}', true, true, array(1, 2, 3), '123', '', $i), + array('{foreach item=x from=$foo}{$x}{/foreach}', false, true, array(4, 5, 6), '456', '', $i ++), + array('{foreach item=x from=$foo}{$x}{/foreach}', true, false, array(1, 2, 3), '123', '', $i), + array('{foreach item=x from=$foo}{$x}{/foreach}', false, false, array(4, 5, 6), '123', '', $i ++), + array('{nocache}{foreach item=x from=$foo}{$x}{/foreach}{/nocache}', true, false, array(1, 2, 3), '123', '', $i), + array('{nocache}{foreach item=x from=$foo}{$x}{/foreach}{/nocache}', false, false, array(4, 5, 6), '456', '', $i ++), + ); } - - public function testNewForeachElse_021() - { - $this->smarty->setErrorReporting(error_reporting() & ~(E_NOTICE | E_USER_NOTICE)); - $this->assertEquals("else", $this->smarty->fetch('021_foreach.tpl')); - } - - public function testNewForeachElse_021_1() - { - $this->smarty->assign('foo', array()); - $this->assertEquals("else", $this->smarty->fetch('021_foreach.tpl')); - } - - public function testNewForeachKey_022() - { - $this->smarty->assign('foo', array(9, 8, 7, 6, 5, 4, 3, 2, 1, 0)); - $this->assertEquals("09182736455463728190", $this->smarty->fetch('022_foreach.tpl')); - } - - public function testNewForeachKeyProperty_023() - { - $this->smarty->assign('foo', array(9, 8, 7, 6, 5, 4, 3, 2, 1, 0)); - $this->assertEquals("09182736455463728190", $this->smarty->fetch('023_foreach.tpl')); - } - /* * test foreach and nocache * @@ -278,13 +254,13 @@ class CompileForeachTest extends PHPUnit_Smarty public function testForeachBreak_30() { - $this->assertEquals("a1a2b1b2", + $this->assertEquals("a1a2b1b2for20a1a2b1b2for21", $this->smarty->fetch('030_foreach.tpl')); } public function testForeachBreak_31() { - $this->assertEquals("a1a2", + $this->assertEquals("a1a2for20a1a2for21", $this->smarty->fetch('031_foreach.tpl')); } @@ -296,13 +272,19 @@ class CompileForeachTest extends PHPUnit_Smarty public function testForeachContinue_33() { - $this->assertEquals("a1a2a4a5b1b2b4b5", + $this->assertEquals("a1a2a4a5b1b2b4b5for20a1a2a4a5b1b2b4b5for21", $this->smarty->fetch('033_foreach.tpl')); } public function testForeachContinue_34() { - $this->assertEquals("a1a2b1b2", + $this->assertEquals("a1a2b1b2for20a1a2b1b2for21", $this->smarty->fetch('034_foreach.tpl')); } + + public function testForeachContinue_35() + { + $this->assertEquals("a1a2a1a2", + $this->smarty->fetch('035_foreach.tpl')); + } } diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/001_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/001_foreach.tpl deleted file mode 100644 index 2678ae6d..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/001_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x from=$foo}{$x}{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/002_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/002_foreach.tpl deleted file mode 100644 index 551ea8d8..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/002_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x from=$foo}{if $x == 2}{break}{/if}{$x}{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/003_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/003_foreach.tpl deleted file mode 100644 index c62877a0..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/003_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x from=$foo}{if $x == 2}{continue}{/if}{$x}{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/004_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/004_foreach.tpl deleted file mode 100644 index cd998250..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/004_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x from=$foo}{$x}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/005_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/005_foreach.tpl deleted file mode 100644 index cd998250..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/005_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x from=$foo}{$x}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/006_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/006_foreach.tpl deleted file mode 100644 index 6a1ed640..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/006_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x key=y from=[9,8,7,6,5,4,3,2,1,0]}{$y}{$x}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/007_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/007_foreach.tpl deleted file mode 100644 index 0b2fe40d..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/007_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x from=[9,8,7,6,5,4,3,2,1,0]}{$x@key}{$x}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/008_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/008_foreach.tpl deleted file mode 100644 index 7840a49c..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/008_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x name=foo from=[0,1,2,3,4,5,6,7,8,9]}{$x}{foreachelse}else{/foreach}total{$smarty.foreach.foo.total} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/009_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/009_foreach.tpl deleted file mode 100644 index d99dad44..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/009_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x from=[0,1,2,3,4,5,6,7,8,9]}{$x}{foreachelse}else{/foreach}total{$x@total} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/010_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/010_foreach.tpl deleted file mode 100644 index e5614f5e..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/010_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x name=foo from=[0,1,2,3,4,5,6,7,8,9]}{$smarty.foreach.foo.index}{$smarty.foreach.foo.iteration}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/011_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/011_foreach.tpl deleted file mode 100644 index 8df8e915..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/011_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x from=[0,1,2,3,4,5,6,7,8,9]}{$x@index}{$x@iteration}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/012_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/012_foreach.tpl deleted file mode 100644 index 13fc21c3..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/012_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x name=foo from=[0,1,2,3,4,5,6,7,8,9]}{if $smarty.foreach.foo.first}first{/if}{if $smarty.foreach.foo.last}last{/if}{$x}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/013_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/013_foreach.tpl deleted file mode 100644 index f3f1f400..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/013_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x name=foo from=[0,1,2,3,4,5,6,7,8,9]}{if $x@first}first{/if}{if $x@last}last{/if}{$x}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/014_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/014_foreach.tpl deleted file mode 100644 index 6f434aa5..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/014_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x name=foo from=[0,1]}{$x}{foreachelse}else{/foreach}{if $smarty.foreach.foo.show}show{else}noshow{/if} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/015_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/015_foreach.tpl deleted file mode 100644 index dfe06f27..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/015_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x name=foo from=[0,1]}{$x}{foreachelse}else{/foreach}{if $x@show}show{else}noshow{/if} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/016_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/016_foreach.tpl deleted file mode 100644 index 27472306..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/016_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x name=foo from=[]}{$x}{foreachelse}else{/foreach}{if $smarty.foreach.foo.show}show{else} noshow{/if} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/017_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/017_foreach.tpl deleted file mode 100644 index 187fb90f..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/017_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach item=x name=foo from=[]}{$x}{foreachelse}else{/foreach}{if $x@show}show{else} noshow{/if} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/018_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/018_foreach.tpl deleted file mode 100644 index a6e5dca6..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/018_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach [9,8,7,6,5,4,3,2,1,0] x y foo}{$y}{$x}{foreachelse}else{/foreach}total{$smarty.foreach.foo.total} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/019_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/019_foreach.tpl deleted file mode 100644 index 2d1bb39c..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/019_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach $foo as $x}{$x}{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/020_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/020_foreach.tpl deleted file mode 100644 index 1966d6e0..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/020_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach $foo as $x}{$x}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/021_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/021_foreach.tpl deleted file mode 100644 index 1966d6e0..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/021_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach $foo as $x}{$x}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/022_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/022_foreach.tpl deleted file mode 100644 index d7e6a026..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/022_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach $foo as $y=>$x}{$y}{$x}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/023_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/023_foreach.tpl deleted file mode 100644 index b1594656..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/023_foreach.tpl +++ /dev/null @@ -1 +0,0 @@ -{foreach $foo as $x}{$x@key}{$x}{foreachelse}else{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/027_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/027_foreach.tpl index cf1b1e9c..ad2fe7cf 100644 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/027_foreach.tpl +++ b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/027_foreach.tpl @@ -1,5 +1,5 @@ {strip} -{$x = 'hallo'} +{$x = "hallo"} {foreach $foo as $x} outer={$x@index}#{$x} {foreach $bar as $x} diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/030_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/030_foreach.tpl index 70b9f038..45feb6f3 100644 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/030_foreach.tpl +++ b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/030_foreach.tpl @@ -1,7 +1,9 @@ {strip} +{for $i=20;$i<22;$i++} {foreach ['a','b'] as $a} {foreach [1,2,3,4,5] as $i} {if $i == 3}{break}{/if} {$a}{$i} {/foreach} -{/foreach} \ No newline at end of file +{/foreach} +for{$i}{/for} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/031_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/031_foreach.tpl index e19b1f8b..70a2859b 100644 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/031_foreach.tpl +++ b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/031_foreach.tpl @@ -1,7 +1,9 @@ {strip} +{for $i=20;$i<22;$i++} {foreach ['a','b'] as $a} {foreach [1,2,3,4,5] as $i} {if $i == 3}{break 2}{/if} {$a}{$i} {/foreach} -{/foreach} \ No newline at end of file +{/foreach} +for{$i}{/for} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/033_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/033_foreach.tpl index 1a3509a9..c2ade6d5 100644 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/033_foreach.tpl +++ b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/033_foreach.tpl @@ -1,7 +1,9 @@ {strip} +{for $i=20;$i<22;$i++} {foreach ['a','b'] as $a} {foreach [1,2,3,4,5] as $i} {if $i == 3}{continue}{/if} {$a}{$i} {/foreach} -{/foreach} \ No newline at end of file +{/foreach} +for{$i}{/for} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/034_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/034_foreach.tpl index ee2031bb..ad256a96 100644 --- a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/034_foreach.tpl +++ b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/034_foreach.tpl @@ -1,7 +1,9 @@ {strip} +{for $i=20;$i<22;$i++} {foreach ['a','b'] as $a} {foreach [1,2,3,4,5] as $i} {if $i == 3}{continue 2}{/if} {$a}{$i} {/foreach} -{/foreach} \ No newline at end of file +{/foreach} +for{$i}{/for} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/035_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/035_foreach.tpl new file mode 100644 index 00000000..dd61dd28 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/Foreach/templates/035_foreach.tpl @@ -0,0 +1,9 @@ +{strip} +{for $i=20;$i<22;$i++} +{foreach ['a','b'] as $a} +{foreach [1,2,3,4,5] as $i} + {if $i == 3}{continue 3}{/if} + {$a}{$i} +{/foreach} +{/foreach} +for{$i}{/for} \ No newline at end of file