mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
add {break} test
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty PHPunit tests compilation of {break} tag
|
||||
*
|
||||
* @package PHPunit
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* class for {break} tag tests
|
||||
*
|
||||
* @runTestsInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @backupStaticAttributes enabled
|
||||
*/
|
||||
class CompileBreakTest extends PHPUnit_Smarty
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
||||
|
||||
public function testInit()
|
||||
{
|
||||
$this->cleanDirs();
|
||||
}
|
||||
/**
|
||||
* test {break} in foreach
|
||||
*/
|
||||
public function testBreakForeach()
|
||||
{
|
||||
$this->smarty->assign('array', array(1,2,3));
|
||||
$this->assertEquals('1', $this->smarty->fetch('break_foreach.tpl'));
|
||||
}
|
||||
/**
|
||||
* test {break} in foreach nocache
|
||||
*/
|
||||
public function testBreakForeachNocache()
|
||||
{
|
||||
$this->smarty->assign('array', array(1,2,3), true);
|
||||
$this->smarty->caching = true;
|
||||
$this->assertEquals('1', $this->smarty->fetch('break_foreach.tpl'));
|
||||
}
|
||||
}
|
0
tests/UnitTests/TemplateSource/TagTests/break/cache/dummy.txt
vendored
Normal file
0
tests/UnitTests/TemplateSource/TagTests/break/cache/dummy.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{strip}
|
||||
{foreach $array as $key => $i}
|
||||
{if $key == 1}
|
||||
{break}
|
||||
{/if}
|
||||
{$i}
|
||||
{/foreach}
|
Reference in New Issue
Block a user