Added variable scope test for multi-level extends resource

This commit is contained in:
Simon Wisselink
2023-01-13 19:23:12 +01:00
parent a34ee98e21
commit d900a0ef4a
13 changed files with 22 additions and 42 deletions

View File

@@ -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'),

View File

@@ -0,0 +1 @@
{$notfoo="notbar"}

View File

@@ -0,0 +1 @@
{$foo="bar"}

View File

@@ -0,0 +1,2 @@
test:{$test nocache} compiled:# rendered:{$test}
{block name='test'}var-{$foo}-var{/block}

View File

@@ -1,6 +0,0 @@
{function 'nocache1' default1='d1' default2='d2'}
default1={$default1}
default2={$default1 nocache}
p1={$p1}
p2={$p2 nocache}
{/function}

View File

@@ -1,4 +0,0 @@
Test 1
<br/>
{include 'test7.tpl' compile_id = 4}

View File

@@ -1,7 +0,0 @@
Test 1
<br/>
{include 'test7.tpl' compile_id = $id}
{include 'test6.tpl'}
{include file="test2.tpl"}
{include 'test6.tpl'}

View File

@@ -1,3 +0,0 @@
Test 2
<br/>
{include file="test3.tpl" compile_id=4}

View File

@@ -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"}

View File

@@ -1,3 +0,0 @@
Test 4
<br/>
{include file="test5.tpl" cache_id="7"}

View File

@@ -1,8 +0,0 @@
test 6
<br>
{function name='f'}
<br>
function f {$id} {$foo}
<br>
{/function}
<br> Time 6 = {$t6}<br>