-
Notifications
You must be signed in to change notification settings - Fork 719
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/smarty-php/smarty/issues/422
- Loading branch information
Uwe Tews
committed
Mar 21, 2018
1 parent
a364e82
commit dfdf343
Showing
4 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
tests/UnitTests/TemplateSource/_Issues/422/NestedLoopIssue422Test.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dummy |
8 changes: 8 additions & 0 deletions
8
tests/UnitTests/TemplateSource/_Issues/422/templates/422_test.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
1 change: 1 addition & 0 deletions
1
tests/UnitTests/TemplateSource/_Issues/422/templates_c/dummy.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dummy |