Update inheritance tests

This commit is contained in:
uwetews
2016-05-01 23:49:04 +02:00
parent ec1caa0905
commit 8a8c0cd081
20 changed files with 76 additions and 0 deletions

View File

@@ -222,6 +222,31 @@ class ExtendsResourceTest extends PHPUnit_Smarty
$this->assertContains('Grandchild Page Title', $result);
}
/**
* test relative includes in {block}
*
* @run InSeparateProcess
* @preserveGlobalState disabled
* @dataProvider data
*/
public function testCompileBlockRelativeIncludes_033($caching, $merge, $testNumber, $compileTestNumber,
$renderTestNumber, $testName)
{
$this->smarty->registerFilter('pre', array($this, 'compiledPrefilter'));
$this->smarty->assign('test', $testNumber);
$this->smarty->setCaching($caching);
$this->smarty->setMergeCompiledIncludes($merge);
if ($merge) {
$this->smarty->setCompileId(1);
}
$result = $this->smarty->fetch('extends:./child/parent/033_parent.tpl|./child/033_child.tpl|033_grandchild.tpl');
$this->assertContains('include grand:content include grand', $result, $testName . ' - grand');
$this->assertContains('include child:content include child', $result, $testName . ' - grand');
$this->assertContains('include parent:content include parent', $result, $testName . ' - grand');
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
$testName . ' - fetch() failure');
}
public function data(){
return array(
/*

View File

@@ -0,0 +1 @@
{block 'grand'}{include './include/include.tpl'}{/block}

View File

@@ -0,0 +1 @@
{block 'child'}{include './include/include.tpl'}{/block}

View File

@@ -0,0 +1 @@
include child:{include './include/include.tpl'}

View File

@@ -0,0 +1 @@
content include child

View File

@@ -0,0 +1,4 @@
test:{$test nocache} compiled:# rendered:{$test}
{block 'grand'}{include './include/include.tpl'}{/block}
{block 'child'}{include './include/include.tpl'}{/block}
{block 'parent'}{include './include/include.tpl'}{/block}

View File

@@ -0,0 +1 @@
include parent:{include './include/include.tpl'}

View File

@@ -0,0 +1 @@
content include parent

View File

@@ -0,0 +1 @@
include grand:{include './include/include.tpl'}

View File

@@ -0,0 +1 @@
content include grand

View File

@@ -921,4 +921,29 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
$this->assertNotContains('bar in 032_included_parent.tpl', $result);
$this->assertNotContains('foo in 032_parent.tpl', $result);
}
/**
* test relative includes in {block}
*
* @runInSeparateProcess
* @preserveGlobalState disabled
* @dataProvider data
*/
public function testCompileBlockRelativeIncludes_033($caching, $merge, $testNumber, $compileTestNumber,
$renderTestNumber, $testName)
{
$this->smarty->registerFilter('pre', array($this, 'compiledPrefilter'));
$this->smarty->assign('test', $testNumber);
$this->smarty->setCaching($caching);
$this->smarty->setMergeCompiledIncludes($merge);
if ($merge) {
$this->smarty->setCompileId(1);
}
$result = $this->smarty->fetch('033_grandchild.tpl');
$this->assertContains('include grand:content include grand', $result, $testName . ' - grand');
$this->assertContains('include child:content include child', $result, $testName . ' - grand');
$this->assertContains('include parent:content include parent', $result, $testName . ' - grand');
$this->assertContains("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
$testName . ' - fetch() failure');
}
}

View File

@@ -0,0 +1,2 @@
{extends "./child/033_child.tpl"}
{block 'grand'}{include './include/include.tpl'}{/block}

View File

@@ -0,0 +1,2 @@
{extends "./parent/033_parent.tpl"}
{block 'child'}{include './include/include.tpl'}{/block}

View File

@@ -0,0 +1 @@
include child:{include './include/include.tpl'}

View File

@@ -0,0 +1 @@
content include child

View File

@@ -0,0 +1,4 @@
test:{$test nocache} compiled:# rendered:{$test}
{block 'grand'}{include './include/include.tpl'}{/block}
{block 'child'}{include './include/include.tpl'}{/block}
{block 'parent'}{include './include/include.tpl'}{/block}

View File

@@ -0,0 +1 @@
include parent:{include './include/include.tpl'}

View File

@@ -0,0 +1 @@
include grand:{include './include/include.tpl'}

View File

@@ -0,0 +1 @@
content include grand