mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
This commit is contained in:
@@ -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
tests/UnitTests/TemplateSource/_Issues/422/cache/dummy.txt
vendored
Normal file
1
tests/UnitTests/TemplateSource/_Issues/422/cache/dummy.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
dummy
|
@@ -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}
|
@@ -0,0 +1 @@
|
||||
dummy
|
Reference in New Issue
Block a user