mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 18:04:26 +02:00
Removed the undocumented {block_parent} and {parent} alternatives to {$smarty.block.parent}
and {block_child} and {child} alternatives to {$smarty.block.child}
This commit is contained in:
@@ -7,9 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- support for $cache_attrs for registered plugins
|
- Removed support for $cache_attrs for registered plugins
|
||||||
- support for undocumented {make_nocache} tag
|
- Removed support for undocumented {make_nocache} tag
|
||||||
- support for deprecated {insert} tag, the 'insert' plugin type and the associated $smarty->trusted_dir variable
|
- Removed support for deprecated {insert} tag, the 'insert' plugin type and the associated $smarty->trusted_dir variable
|
||||||
|
- Removed the undocumented {block_parent} and {parent} alternatives to {$smarty.block.parent}
|
||||||
|
- Removed the undocumented {block_child} and {child} alternatives to {$smarty.block.child}
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- `$smarty->muteUndefinedOrNullWarnings()` now also mutes PHP7 notices for undefined array indexes [#736](https://github.com/smarty-php/smarty/issues/736)
|
- `$smarty->muteUndefinedOrNullWarnings()` now also mutes PHP7 notices for undefined array indexes [#736](https://github.com/smarty-php/smarty/issues/736)
|
||||||
|
@@ -888,72 +888,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
|||||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
||||||
$testName . ' - fetch() failure');
|
$testName . ' - fetch() failure');
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* test grandchild/child/parent template chain with nested {$this->smarty.block.child} and {include nocache}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @dataProvider data
|
|
||||||
*/
|
|
||||||
public function testCompileBlockSmartyBlockParent_034_2($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('034_2child.tpl');
|
|
||||||
$this->assertStringContainsString('parent b1', $result, $testName . ' - content');
|
|
||||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
|
||||||
$testName . ' - fetch() failure');
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* test grandchild/child/parent template chain with nested {$this->smarty.block.child} and {include nocache}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @dataProvider data
|
|
||||||
*/
|
|
||||||
public function testCompileBlockSmartyBlockParent_034_3($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('034_3child.tpl');
|
|
||||||
$this->assertStringContainsString('parent b1', $result, $testName . ' - content');
|
|
||||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
|
||||||
$testName . ' - fetch() failure');
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* test grandchild/child/parent template chain with nested {$this->smarty.block.child} and {include nocache}
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @dataProvider data
|
|
||||||
*/
|
|
||||||
public function testCompileBlockSmartyBlockParent_034_4($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('034_4child.tpl');
|
|
||||||
$this->assertStringContainsString('parent b1', $result, $testName . ' - content');
|
|
||||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
|
||||||
$testName . ' - fetch() failure');
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* test child/parent template chain with {$this->smarty.block.child)
|
* test child/parent template chain with {$this->smarty.block.child)
|
||||||
*
|
*
|
||||||
@@ -981,87 +916,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
|||||||
$testName . ' - fetch() failure');
|
$testName . ' - fetch() failure');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* test child/parent template chain with {$this->smarty.block.child)
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @dataProvider data
|
|
||||||
*/
|
|
||||||
public function testCompileBlockSmartyBlockChild_035_2($caching, $merge, $testNumber, $compileTestNumber,
|
|
||||||
$renderTestNumber, $testName)
|
|
||||||
{
|
|
||||||
$this->smarty->registerFilter('pre', array($this, 'compiledPrefilter'));
|
|
||||||
$this->smarty->assign('test', $testNumber);
|
|
||||||
$this->smarty->assign('parenttpl', '035_2parent.tpl');
|
|
||||||
$this->smarty->assign('parent', 'parent', true);
|
|
||||||
$this->smarty->assign('child', 'child', true);
|
|
||||||
$this->smarty->setCaching($caching);
|
|
||||||
$this->smarty->setMergeCompiledIncludes($merge);
|
|
||||||
if ($merge) {
|
|
||||||
$this->smarty->setCompileId(1);
|
|
||||||
}
|
|
||||||
$result = $this->smarty->fetch('035_child.tpl');
|
|
||||||
$this->assertStringContainsString('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
|
||||||
$testName . ' - content');
|
|
||||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
|
||||||
$testName . ' - fetch() failure');
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* test child/parent template chain with {$this->smarty.block.child)
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @dataProvider data
|
|
||||||
*/
|
|
||||||
public function testCompileBlockSmartyBlockChild_035_3($caching, $merge, $testNumber, $compileTestNumber,
|
|
||||||
$renderTestNumber, $testName)
|
|
||||||
{
|
|
||||||
$this->smarty->registerFilter('pre', array($this, 'compiledPrefilter'));
|
|
||||||
$this->smarty->assign('test', $testNumber);
|
|
||||||
$this->smarty->assign('parenttpl', '035_3parent.tpl');
|
|
||||||
$this->smarty->assign('parent', 'parent', true);
|
|
||||||
$this->smarty->assign('child', 'child', true);
|
|
||||||
$this->smarty->setCaching($caching);
|
|
||||||
$this->smarty->setMergeCompiledIncludes($merge);
|
|
||||||
if ($merge) {
|
|
||||||
$this->smarty->setCompileId(1);
|
|
||||||
}
|
|
||||||
$result = $this->smarty->fetch('035_child.tpl');
|
|
||||||
$this->assertStringContainsString('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
|
||||||
$testName . ' - content');
|
|
||||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
|
||||||
$testName . ' - fetch() failure');
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* test child/parent template chain with {$this->smarty.block.child)
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @dataProvider data
|
|
||||||
*/
|
|
||||||
public function testCompileBlockSmartyBlockChild_035_4($caching, $merge, $testNumber, $compileTestNumber,
|
|
||||||
$renderTestNumber, $testName)
|
|
||||||
{
|
|
||||||
$this->smarty->registerFilter('pre', array($this, 'compiledPrefilter'));
|
|
||||||
$this->smarty->assign('test', $testNumber);
|
|
||||||
$this->smarty->assign('parenttpl', '035_4parent.tpl');
|
|
||||||
$this->smarty->assign('parent', 'parent', true);
|
|
||||||
$this->smarty->assign('child', 'child', true);
|
|
||||||
$this->smarty->setCaching($caching);
|
|
||||||
$this->smarty->setMergeCompiledIncludes($merge);
|
|
||||||
if ($merge) {
|
|
||||||
$this->smarty->setCompileId(1);
|
|
||||||
}
|
|
||||||
$result = $this->smarty->fetch('035_child.tpl');
|
|
||||||
$this->assertStringContainsString('(parent|b)content (child|b)content child b(child|/b) b(parent|/b)', $result,
|
|
||||||
$testName . ' - content');
|
|
||||||
$this->assertStringContainsString("test:{$testNumber} compiled:{$compileTestNumber} rendered:{$renderTestNumber}", $result,
|
|
||||||
$testName . ' - fetch() failure');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function data()
|
public function data()
|
||||||
{
|
{
|
||||||
return array(/*
|
return array(/*
|
||||||
@@ -1151,25 +1005,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
|
|||||||
$this->expectExceptionMessage('inheritance: illegal \'{$smarty.block.parent}\' used in child template');
|
$this->expectExceptionMessage('inheritance: illegal \'{$smarty.block.parent}\' used in child template');
|
||||||
$this->smarty->fetch('036_1_parent.tpl');
|
$this->smarty->fetch('036_1_parent.tpl');
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* test {block_parent}
|
|
||||||
*/
|
|
||||||
public function testSmartyParentBlockCalledInParent_036_2()
|
|
||||||
{
|
|
||||||
$this->expectException(\Smarty\Exception::class);
|
|
||||||
$this->expectExceptionMessage('inheritance: illegal \'{block_parent}\' used in child template');
|
|
||||||
$this->smarty->fetch('036_2_parent.tpl');
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* test {block_parent}
|
|
||||||
*/
|
|
||||||
public function testSmartyParentBlockCalledInParent_036_3()
|
|
||||||
{
|
|
||||||
$this->expectException(\Smarty\Exception::class);
|
|
||||||
$this->expectExceptionMessage('inheritance: illegal \'{parent}\' used in child template');
|
|
||||||
$this->smarty->fetch('036_3_parent.tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test smarty.block
|
* test smarty.block
|
||||||
*/
|
*/
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
{extends '034_parent.tpl'}
|
|
||||||
{block 'b1'}{parent assign='foo'}{$foo}{/block}
|
|
@@ -1,2 +0,0 @@
|
|||||||
{extends '034_parent.tpl'}
|
|
||||||
{block 'b1'}{parent}{/block}
|
|
@@ -1,2 +0,0 @@
|
|||||||
{extends '034_parent.tpl'}
|
|
||||||
{block 'b1'}{block_parent}{/block}
|
|
@@ -1,2 +0,0 @@
|
|||||||
test:{$test nocache} compiled:# rendered:{$test}
|
|
||||||
{block name='b'}(parent|b)content {child assign='foo'}{$foo} b(parent|/b){/block}
|
|
@@ -1,2 +0,0 @@
|
|||||||
test:{$test nocache} compiled:# rendered:{$test}
|
|
||||||
{block name='b'}(parent|b)content {child} b(parent|/b){/block}
|
|
@@ -1,2 +0,0 @@
|
|||||||
test:{$test nocache} compiled:# rendered:{$test}
|
|
||||||
{block name='b'}(parent|b)content {block_child} b(parent|/b){/block}
|
|
@@ -1 +0,0 @@
|
|||||||
{block name='b'}{block_parent}{/block}
|
|
@@ -1 +0,0 @@
|
|||||||
{block name='b'}{parent}{/block}
|
|
@@ -8,10 +8,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* class for compiler plugin tests
|
* class for compiler plugin tests
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class CompilerPluginTest extends PHPUnit_Smarty
|
class CompilerPluginTest extends PHPUnit_Smarty
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user