Uwe Tews
2018-03-21 07:35:25 +01:00
parent a364e82c6b
commit dfdf343b2d
4 changed files with 45 additions and 0 deletions

View File

@@ -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'));
}
}

View File

@@ -0,0 +1 @@
dummy

View File

@@ -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}

View File

@@ -0,0 +1 @@
dummy