From 4bbe94f4e0aa2cfed7c0b8ba5330937dbb45193d Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Sun, 22 Jan 2023 23:01:05 +0100 Subject: [PATCH] Removed the undocumented {block_parent} and {parent} alternatives to {$smarty.block.parent} and {block_child} and {child} alternatives to {$smarty.block.child} --- CHANGELOG.md | 8 +- .../BockExtend/CompileBlockExtendsTest.php | 167 +----------------- .../BockExtend/templates/034_2child.tpl | 2 - .../BockExtend/templates/034_3child.tpl | 2 - .../BockExtend/templates/034_4child.tpl | 2 - .../BockExtend/templates/035_2parent.tpl | 2 - .../BockExtend/templates/035_3parent.tpl | 2 - .../BockExtend/templates/035_4parent.tpl | 2 - .../BockExtend/templates/036_2_parent.tpl | 1 - .../BockExtend/templates/036_3_parent.tpl | 1 - .../CompilerPlugin/CompilerPluginTest.php | 4 - 11 files changed, 6 insertions(+), 187 deletions(-) delete mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_2child.tpl delete mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_3child.tpl delete mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_4child.tpl delete mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_2parent.tpl delete mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_3parent.tpl delete mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_4parent.tpl delete mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/036_2_parent.tpl delete mode 100644 tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/036_3_parent.tpl diff --git a/CHANGELOG.md b/CHANGELOG.md index d715ca19..3318960a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Removed -- support for $cache_attrs for registered plugins -- 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 $cache_attrs for registered plugins +- Removed support for undocumented {make_nocache} tag +- 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 - `$smarty->muteUndefinedOrNullWarnings()` now also mutes PHP7 notices for undefined array indexes [#736](https://github.com/smarty-php/smarty/issues/736) diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php index c6a0699e..373a1985 100644 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php @@ -888,72 +888,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty $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_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) * @@ -981,87 +916,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty $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() { return array(/* @@ -1151,25 +1005,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty $this->expectExceptionMessage('inheritance: illegal \'{$smarty.block.parent}\' used in child template'); $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 */ diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_2child.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_2child.tpl deleted file mode 100644 index 07ff346b..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_2child.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{extends '034_parent.tpl'} -{block 'b1'}{parent assign='foo'}{$foo}{/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_3child.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_3child.tpl deleted file mode 100644 index a4e701b0..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_3child.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{extends '034_parent.tpl'} -{block 'b1'}{parent}{/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_4child.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_4child.tpl deleted file mode 100644 index 431145fd..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_4child.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{extends '034_parent.tpl'} -{block 'b1'}{block_parent}{/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_2parent.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_2parent.tpl deleted file mode 100644 index 06fed627..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_2parent.tpl +++ /dev/null @@ -1,2 +0,0 @@ -test:{$test nocache} compiled:# rendered:{$test} -{block name='b'}(parent|b)content {child assign='foo'}{$foo} b(parent|/b){/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_3parent.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_3parent.tpl deleted file mode 100644 index 1ada9dfa..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_3parent.tpl +++ /dev/null @@ -1,2 +0,0 @@ -test:{$test nocache} compiled:# rendered:{$test} -{block name='b'}(parent|b)content {child} b(parent|/b){/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_4parent.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_4parent.tpl deleted file mode 100644 index 9cea0612..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_4parent.tpl +++ /dev/null @@ -1,2 +0,0 @@ -test:{$test nocache} compiled:# rendered:{$test} -{block name='b'}(parent|b)content {block_child} b(parent|/b){/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/036_2_parent.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/036_2_parent.tpl deleted file mode 100644 index f96cb679..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/036_2_parent.tpl +++ /dev/null @@ -1 +0,0 @@ -{block name='b'}{block_parent}{/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/036_3_parent.tpl b/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/036_3_parent.tpl deleted file mode 100644 index 6c8516f2..00000000 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/036_3_parent.tpl +++ /dev/null @@ -1 +0,0 @@ -{block name='b'}{parent}{/block} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/CompilerPluginTest.php b/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/CompilerPluginTest.php index e4a21ba2..78efeb9b 100644 --- a/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/CompilerPluginTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/CompilerPluginTest.php @@ -8,10 +8,6 @@ /** * class for compiler plugin tests - * - * - * - * */ class CompilerPluginTest extends PHPUnit_Smarty {