From 3d7a1d57dc9acc216678b2e2926b7afed28c941d Mon Sep 17 00:00:00 2001 From: uwetews Date: Wed, 9 Dec 2015 01:31:15 +0100 Subject: [PATCH] update strip test --- .../TagTests/Strip/CompileStripTest.php | 23 ++++++++++++++++--- .../TagTests/Strip/templates/strip.tpl | 5 ++++ .../templates/strip_multi_line_html_tag.tpl | 9 ++++++++ .../strip_multi_line_textarea_html_tag.tpl | 8 +++++++ 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip.tpl create mode 100644 tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_multi_line_html_tag.tpl create mode 100644 tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_multi_line_textarea_html_tag.tpl diff --git a/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php b/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php index 07077021..ee343e39 100644 --- a/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php @@ -28,9 +28,26 @@ class CompileStripTest extends PHPUnit_Smarty /** * test strip tag */ - public function testStrip() + public function testStripTag() { - $tpl = $this->smarty->createTemplate("eval:{strip}\n
{/strip}"); - $this->assertEquals('
', $this->smarty->fetch($tpl)); + $this->assertContains('foobar buh', $this->smarty->fetch('strip.tpl')); + } + /** + * test strip tag multi line html + */ + public function testStripMultiLineHtmlTag() + { + $this->assertContains('
[X]
foobar', $this->smarty->fetch('strip_multi_line_html_tag.tpl')); + } + /** + * test strip tag multi line html + */ + public function testStripMultiLineTextareaHtmlTag() + { + $this->assertContains(preg_replace('/[\r]/', '', ' foobar'), $this->smarty->fetch('strip_multi_line_textarea_html_tag.tpl')); } } diff --git a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip.tpl b/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip.tpl new file mode 100644 index 00000000..8d835418 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip.tpl @@ -0,0 +1,5 @@ +{strip} + foo + bar buh + +{/strip} diff --git a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_multi_line_html_tag.tpl b/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_multi_line_html_tag.tpl new file mode 100644 index 00000000..30115af4 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_multi_line_html_tag.tpl @@ -0,0 +1,9 @@ +{strip} +
[X]
+ + + foo + bar +{/strip} diff --git a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_multi_line_textarea_html_tag.tpl b/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_multi_line_textarea_html_tag.tpl new file mode 100644 index 00000000..df392809 --- /dev/null +++ b/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_multi_line_textarea_html_tag.tpl @@ -0,0 +1,8 @@ +{strip} + foo + bar +{/strip}