diff --git a/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php b/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php
index f943d08e..a34fca5a 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php
@@ -18,6 +18,8 @@ class CompileStripTest extends PHPUnit_Smarty
public function setUp()
{
$this->setUpSmarty(dirname(__FILE__));
+ $this->smarty->addPluginsDir("../../../__shared/PHPunitplugins/");
+ $this->smarty->addTemplateDir("./templates_tmp");
}
@@ -25,58 +27,45 @@ class CompileStripTest extends PHPUnit_Smarty
{
$this->cleanDirs();
}
- /**
- * test strip tag
- */
- public function testStripTag()
- {
- $this->assertContains('foobar buh', $this->smarty->fetch('strip.tpl'));
- }
- /**
- * test strip tag multi line html
- */
- public function testStripMultiLineHtmlTag()
- {
- $this->assertContains('
foobar', $this->smarty->fetch('strip_multi_line_html_tag.tpl'));
- }
- /**
- * test strip tag multi line html
- */
- public function testStripHtmlTag()
- {
- $this->assertContains('', $this->smarty->fetch('strip_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'));
- }
/**
- * test strip tag output tag
+ * Test {strip} tags
*
- * @runInSeparateProcess
+ * @not runInSeparateProcess
* @preserveGlobalState disabled
+ * @dataProvider dataTestStrip
*/
- public function testStripOutputTag()
+ public function testStrip($code, $result, $testName, $testNumber)
{
- $this->assertEquals('1 italic
', $this->smarty->fetch('strip_with_output_tag.tpl'));
+ $file = "testStrip_{$testNumber}.tpl";
+ $this->makeTemplateFile($file, "{strip}\n" . $code);
+ $this->smarty->assignGlobal('file', $file);
+ $this->assertEquals($this->strip($result), $this->strip($this->smarty->fetch($file)), "testStrip - {$code} - {$testName}");
}
- /**
- * test strip tag no output tag
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- */
- public function testStripNoOutputTag()
+ /*
+ * Data provider für testStrip
+ */
+ public function dataTestStrip()
{
- $this->assertEquals('italic
', $this->smarty->fetch('strip_with_no_output_tag.tpl'));
+ $i = 0;
+ /*
+ * Code
+ * result
+ * test name
+ */
+ return array(
+ array(" foo\n bar buh\n\n", 'foobar buh', '', $i ++),
+ array("\n \n\n\n foo\n bar\n", 'foobar', '', $i ++),
+ array("\n \n", '', '', $i ++),
+ array("\n foo\n bar\n", " foobar", '', $i ++),
+ // variable in html tag
+ array("{\$foo=1}\n {getvar var=foo} italic
\n", '1 italic
', '', $i ++),
+ array("{\$foo=1}\n {getvar var=foo assign=newvar} italic
\n", 'italic
', '', $i ++),
+ array("{\$text=\"Text\"}\n#{\$text}#\n", '#Text#', '', $i ++),
+ array("{\$text=\"Text\"}\n# {'Text'}\n", '# Text', '', $i ++),
+
+ );
}
+
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/Strip/cache/dummy.txt b/tests/UnitTests/TemplateSource/TagTests/Strip/cache/dummy.txt
deleted file mode 100644
index e69de29b..00000000
diff --git a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip.tpl b/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip.tpl
deleted file mode 100644
index 8d835418..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip.tpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{strip}
- foo
- bar buh
-
-{/strip}
diff --git a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_html_tag.tpl b/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_html_tag.tpl
deleted file mode 100644
index b9479616..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_html_tag.tpl
+++ /dev/null
@@ -1,10 +0,0 @@
-{strip}
-
-{/strip}
\ No newline at end of file
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
deleted file mode 100644
index 30115af4..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_multi_line_html_tag.tpl
+++ /dev/null
@@ -1,9 +0,0 @@
-{strip}
-
-
-
- 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
deleted file mode 100644
index df392809..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_multi_line_textarea_html_tag.tpl
+++ /dev/null
@@ -1,8 +0,0 @@
-{strip}
- foo
- bar
-{/strip}
diff --git a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_with_no_output_tag.tpl b/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_with_no_output_tag.tpl
deleted file mode 100644
index 3a6fe026..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_with_no_output_tag.tpl
+++ /dev/null
@@ -1,3 +0,0 @@
-{strip}
- {counter assign=foo} italic
-{/strip}
\ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_with_output_tag.tpl b/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_with_output_tag.tpl
deleted file mode 100644
index b23240a6..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Strip/templates/strip_with_output_tag.tpl
+++ /dev/null
@@ -1,3 +0,0 @@
-{strip}
- {counter} italic
-{/strip}
\ No newline at end of file
diff --git a/tests/UnitTests/__shared/PHPunitplugins/function.getvar.php b/tests/UnitTests/__shared/PHPunitplugins/function.getvar.php
new file mode 100644
index 00000000..2b78fbbb
--- /dev/null
+++ b/tests/UnitTests/__shared/PHPunitplugins/function.getvar.php
@@ -0,0 +1,24 @@
+assign($params[ 'assign' ], $template->getTemplateVars($params[ 'var' ]));
+ } else {
+ return $template->getTemplateVars($params[ 'var' ]);
+ }
+}