This commit is contained in:
Uwe Tews
2015-07-30 02:02:53 +02:00
parent a6f6f6fd6d
commit b829b94df8
6 changed files with 12 additions and 9 deletions

View File

@@ -16,8 +16,6 @@ class CompileSectionTest extends PHPUnit_Smarty
public function setUp()
{
$this->setUpSmarty(__DIR__);
error_reporting(E_ALL | E_STRICT);
$this->smarty->setErrorReporting(error_reporting() & ~(E_NOTICE | E_USER_NOTICE));
}
@@ -31,12 +29,14 @@ class CompileSectionTest extends PHPUnit_Smarty
public function testSection1()
{
$tpl = $this->smarty->createTemplate('section1.tpl');
$tpl->assign('foo', array(0,1,2,3,4,5,6,7,8,9));
$this->assertEquals("0123456789", $this->smarty->fetch($tpl));
}
public function testSection2()
{
$tpl = $this->smarty->createTemplate('section2.tpl');
$tpl->assign('foo', array(0,1,2,3,4,5,6,7,8,9));
$this->assertEquals("0123456789", $this->smarty->fetch($tpl));
}
@@ -49,19 +49,22 @@ class CompileSectionTest extends PHPUnit_Smarty
public function testSection4()
{
$tpl = $this->smarty->createTemplate('section4.tpl');
$tpl->assign('foo', array(0,1,2,3,4,5,6,7,8,9));
$this->assertEquals("0123456789", $this->smarty->fetch($tpl));
}
public function testSection6()
{
$tpl = $this->smarty->createTemplate('section6.tpl');
$tpl->assign('foo', array(0,1,2,3,4,5,6,7,8,9));
$this->assertEquals("0123456789total10", $this->smarty->fetch($tpl));
}
/*
public function testSection7()
{
$tpl = $this->smarty->createTemplate('section7.tpl');
$tpl->assign('foo', array(0,1,2,3,4,5,6,7,8,9));
$this->assertEquals("011223344556677889910", $this->smarty->fetch($tpl));
}
*/
}

View File

@@ -1 +1 @@
{assign var=foo value=[0,1,2,3,4,5,6,7,8,9]}{section name=bar loop=$foo}{$foo[bar]}{/section}
{section name=bar loop=$foo}{$foo[bar]}{/section}

View File

@@ -1 +1 @@
{assign var=foo value=[0,1,2,3,4,5,6,7,8,9]}{section name=bar loop=$foo start=$i}{$foo[bar]}{sectionelse} else {/section}
{section name=bar loop=$foo start=$i}{$foo[bar]}{sectionelse} else {/section}

View File

@@ -1 +1 @@
{assign var=foo value=[0,1,2,3,4,5,6,7,8,9]}{section name=bar loop=$foo}{$foo[bar]}{sectionelse} else {/section}
{section name=bar loop=$foo}{$foo[bar]}{sectionelse} else {/section}

View File

@@ -1 +1 @@
{assign var=foo value=[0,1,2,3,4,5,6,7,8,9]}{section name=bar loop=$foo}{$foo[bar]}{sectionelse} else {/section}total{$smarty.section.bar.total}
{section name=bar loop=$foo}{$foo[bar]}{sectionelse} else {/section}total{$smarty.section.bar.total}

View File

@@ -1 +1 @@
{assign var=foo value=[0,1,2,3,4,5,6,7,8,9]}{section name=bar loop=$foo}{$smarty.section.bar.index}{$smarty.section.bar.iteration}{sectionelse} else {/section}
{section name=bar loop=$foo}{$smarty.section.bar.index}{$smarty.section.bar.iteration}{sectionelse} else {/section}