diff --git a/tests/UnitTests/A_Core/AutoEscape/AutoEscapeTest.php b/tests/UnitTests/A_Core/AutoEscape/AutoEscapeTest.php index f98d9a84..0a4a354b 100644 --- a/tests/UnitTests/A_Core/AutoEscape/AutoEscapeTest.php +++ b/tests/UnitTests/A_Core/AutoEscape/AutoEscapeTest.php @@ -30,4 +30,36 @@ class AutoEscapeTest extends PHPUnit_Smarty $tpl->assign('foo', ''); $this->assertEquals("<a@b.c>", $this->smarty->fetch($tpl)); } + + + /** + * test 'escapeHtml' property + * @group issue906 + */ + public function testAutoEscapeDoesNotEscapeFunctionPlugins() + { + $this->smarty->registerPlugin( + Smarty::PLUGIN_FUNCTION, + 'horizontal_rule', + function ($params, $smarty) { return "
"; } + ); + $tpl = $this->smarty->createTemplate('eval:{horizontal_rule}'); + $this->assertEquals("
", $this->smarty->fetch($tpl)); + } + + /** + * test 'escapeHtml' property + * @group issue906 + */ + public function testAutoEscapeDoesNotEscapeBlockPlugins() + { + $this->smarty->registerPlugin( + Smarty::PLUGIN_BLOCK, + 'paragraphify', + function ($params, $content) { return $content == null ? null : "

".$content."

"; } + ); + $tpl = $this->smarty->createTemplate('eval:{paragraphify}hi{/paragraphify}'); + $this->assertEquals("

hi

", $this->smarty->fetch($tpl)); + } + }