mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-02 17:34:26 +02:00
Added variable scope test for multi-level extends resource
This commit is contained in:
@@ -91,6 +91,23 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data
|
||||
*/
|
||||
public function testCompileBlockIncreaseInChild_050($caching, $merge, $testNumber, $compileTestNumber, $renderTestNumber, $testName)
|
||||
{
|
||||
$this->smarty->registerFilter('pre', array($this, 'compiledPrefilter'));
|
||||
$this->smarty->assign('test', $testNumber);
|
||||
$this->smarty->caching = $caching;
|
||||
$this->smarty->merge_compiled_includes = $merge;
|
||||
if ($merge) {
|
||||
$this->smarty->compile_id = 1;
|
||||
}
|
||||
$result = $this->smarty->fetch('extends:050_parent.tpl|050_child.tpl|050_grandchild.tpl');
|
||||
$this->assertStringContainsString("var-bar-var", $result, $testName . ' - content');
|
||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result, $testName . ' - fetch() failure');
|
||||
}
|
||||
|
||||
/**
|
||||
* test grandchild/child/parent dependency test1
|
||||
* @runInSeparateProcess
|
||||
@@ -259,7 +276,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty
|
||||
*/
|
||||
array(false, false, 1, 1, 1, 'no caching, no merge - new'),
|
||||
array(false, false, 2, 1, 2, 'no caching, no merge - exits'),
|
||||
array(true, false, 3, 3, 3, 'caching, no merge - new'),
|
||||
array(true, false, 3, 3, 3, 'caching, no merge - new'), // 2
|
||||
array(true, false, 4, 3, 3, 'caching, no merge - exits'),
|
||||
array(false, true, 5, 5, 5, 'no caching, merge - new'),
|
||||
array(false, true, 6, 5, 6, 'no caching, merge - exits'),
|
||||
|
@@ -0,0 +1 @@
|
||||
{$notfoo="notbar"}
|
@@ -0,0 +1 @@
|
||||
{$foo="bar"}
|
@@ -0,0 +1,2 @@
|
||||
test:{$test nocache} compiled:# rendered:{$test}
|
||||
{block name='test'}var-{$foo}-var{/block}
|
@@ -1,6 +0,0 @@
|
||||
{function 'nocache1' default1='d1' default2='d2'}
|
||||
default1={$default1}
|
||||
default2={$default1 nocache}
|
||||
p1={$p1}
|
||||
p2={$p2 nocache}
|
||||
{/function}
|
@@ -1,4 +0,0 @@
|
||||
Test 1
|
||||
<br/>
|
||||
{include 'test7.tpl' compile_id = 4}
|
||||
|
@@ -1,7 +0,0 @@
|
||||
Test 1
|
||||
<br/>
|
||||
{include 'test7.tpl' compile_id = $id}
|
||||
{include 'test6.tpl'}
|
||||
{include file="test2.tpl"}
|
||||
{include 'test6.tpl'}
|
||||
|
@@ -1,3 +0,0 @@
|
||||
Test 2
|
||||
<br/>
|
||||
{include file="test3.tpl" compile_id=4}
|
@@ -1,4 +0,0 @@
|
||||
Test 3 {call name='f' nocache}
|
||||
<br/>
|
||||
{include file="test4.tpl" compile_id=9}
|
||||
{include file="test5.tpl" cache_id="7"}
|
@@ -1,3 +0,0 @@
|
||||
Test 4
|
||||
<br/>
|
||||
{include file="test5.tpl" cache_id="7"}
|
@@ -1,4 +0,0 @@
|
||||
test 5
|
||||
<br>
|
||||
|
||||
{call 'f'}
|
@@ -1,8 +0,0 @@
|
||||
test 6
|
||||
<br>
|
||||
{function name='f'}
|
||||
<br>
|
||||
function f {$id} {$foo}
|
||||
<br>
|
||||
{/function}
|
||||
<br> Time 6 = {$t6}<br>
|
@@ -1,2 +0,0 @@
|
||||
test 7
|
||||
<br> extern
|
Reference in New Issue
Block a user