Skip to content

Commit

Permalink
https://github.com/smarty-php/smarty/issues/422
Browse files Browse the repository at this point in the history
  • Loading branch information
Uwe Tews committed Mar 21, 2018
1 parent a364e82 commit dfdf343
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Smarty PHPunit tests compiler errors
*
* @package PHPunit
* @author Uwe Tews
*/

/**
* class for compiler tests
*
* @runTestsInSeparateProcess
* @preserveGlobalState disabled
* @backupStaticAttributes enabled
*
* Problem with total property of {section} and {foreach} in nested loop
*/
class NestedLoopIssue422Test extends PHPUnit_Smarty
{
public function setUp()
{
$this->setUpSmarty(dirname(__FILE__));
}

public function testInit()
{
$this->cleanDirs();
}

public function testnested422()
{
$this->assertEquals('loop: 1inner: 0loop: 2inner: 1', $this->smarty->fetch('422_test.tpl'));
}

}
1 change: 1 addition & 0 deletions tests/UnitTests/TemplateSource/_Issues/422/cache/dummy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dummy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{strip}
{assign var=samplearr value=[["list" => []],["list" => ["item"]]]}
{foreach $samplearr as $v}
{section name=inner loop=$v.list}
{/section}
loop: {$v@iteration}
inner: {$smarty.section.inner.total}
{/foreach}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dummy

0 comments on commit dfdf343

Please sign in to comment.