mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
Update strip text
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
* class for strip tags tests
|
* class for strip tags tests
|
||||||
*
|
*
|
||||||
* @runTestsInSeparateProcess
|
* @runTestsInSeparateProcess
|
||||||
* @preserveGlobalState disabled
|
* @preserveGlobalState disabled
|
||||||
* @backupStaticAttributes enabled
|
* @backupStaticAttributes enabled
|
||||||
*/
|
*/
|
||||||
class CompileStripTest extends PHPUnit_Smarty
|
class CompileStripTest extends PHPUnit_Smarty
|
||||||
@@ -22,7 +22,6 @@ class CompileStripTest extends PHPUnit_Smarty
|
|||||||
$this->smarty->addTemplateDir("./templates_tmp");
|
$this->smarty->addTemplateDir("./templates_tmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testInit()
|
public function testInit()
|
||||||
{
|
{
|
||||||
$this->cleanDirs();
|
$this->cleanDirs();
|
||||||
@@ -31,7 +30,7 @@ class CompileStripTest extends PHPUnit_Smarty
|
|||||||
/**
|
/**
|
||||||
* Test {strip} tags
|
* Test {strip} tags
|
||||||
*
|
*
|
||||||
* @not runInSeparateProcess
|
* @not runInSeparateProcess
|
||||||
* @preserveGlobalState disabled
|
* @preserveGlobalState disabled
|
||||||
* @dataProvider dataTestStrip
|
* @dataProvider dataTestStrip
|
||||||
*/
|
*/
|
||||||
@@ -40,7 +39,7 @@ class CompileStripTest extends PHPUnit_Smarty
|
|||||||
$file = "testStrip_{$testNumber}.tpl";
|
$file = "testStrip_{$testNumber}.tpl";
|
||||||
$this->makeTemplateFile($file, "{strip}\n" . $code);
|
$this->makeTemplateFile($file, "{strip}\n" . $code);
|
||||||
$this->smarty->assignGlobal('file', $file);
|
$this->smarty->assignGlobal('file', $file);
|
||||||
$this->assertEquals($this->strip($result), $this->strip($this->smarty->fetch($file)), "testStrip - {$code} - {$testName}");
|
$this->assertEquals($result, $this->smarty->fetch($file), "testStrip - {$code} - {$testName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -54,16 +53,29 @@ class CompileStripTest extends PHPUnit_Smarty
|
|||||||
* result
|
* result
|
||||||
* test name
|
* test name
|
||||||
*/
|
*/
|
||||||
return array(
|
return array(array(" foo\n bar buh\n\n", 'foobar buh', '', $i ++),
|
||||||
array(" foo\n bar buh\n\n", 'foobar buh', '', $i ++),
|
array("\n <div style=\"float: right; cursor: url;\">[<a\n onmouseover=\"this.style.cursor='pointer'\"\n onmouseup=\"document.getElementById('screenEdit_(\$screen.id)').style.display='none'\";>X</a>]</div>\n\n\n foo\n bar\n",
|
||||||
array("\n <div style=\"float: right; cursor: url;\">[<a\n onmouseover=\"this.style.cursor='pointer'\"\n onmouseup=\"document.getElementById('screenEdit_(\$screen.id)').style.display='none'\";>X</a>]</div>\n\n\n foo\n bar\n", '<div style="float: right; cursor: url;">[<a onmouseover="this.style.cursor=\'pointer\'" onmouseup="document.getElementById(\'screenEdit_($screen.id)\').style.display=\'none\'";>X</a>]</div>foobar', '', $i ++),
|
'<div style="float: right; cursor: url;">[<a onmouseover="this.style.cursor=\'pointer\'" onmouseup="document.getElementById(\'screenEdit_($screen.id)\').style.display=\'none\'";>X</a>]</div>foobar',
|
||||||
array("\n <ul>\n <li>\n <a href=\"#\">BlaBla</a>\n </li>\n <li>\n <a href=\"#\">BlaBla</a>\n </li>\n </ul>\n", '<ul><li><a href="#">BlaBla</a></li><li><a href="#">BlaBla</a></li></ul>', '', $i ++),
|
'', $i ++),
|
||||||
array("\n <textarea>\n\n some text\n\n </textarea> foo\n bar\n", "<textarea>\n\n some text\n\n </textarea> foobar", '', $i ++),
|
array("\n <ul>\n <li>\n <a href=\"#\">BlaBla</a>\n </li>\n <li>\n <a href=\"#\">BlaBla</a>\n </li>\n </ul>\n",
|
||||||
|
'<ul> <li> <a href="#">BlaBla</a> </li> <li> <a href="#">BlaBla</a> </li> </ul>', '', $i ++),
|
||||||
|
array("\n <textarea>\n\n some text\n\n </textarea> foo\n bar\n",
|
||||||
|
"<textarea>\n\n some text\n\n </textarea> foobar", '', $i ++),
|
||||||
// variable in html tag
|
// variable in html tag
|
||||||
array("{\$foo=1}\n <h1>{getvar var=foo} <em>italic</em></h1>\n", '<h1>1 <em>italic</em></h1>', '', $i ++),
|
array("\n <b><c>c</c></b>\n", '<b><c>c</c></b>', '', $i ++),
|
||||||
array("{\$foo=1}\n <h1>{getvar var=foo assign=newvar} <em>italic</em></h1>\n", '<h1><em>italic</em></h1>', '', $i ++),
|
array("\n <b> <c>c</c></b>\n", '<b> <c>c</c></b>', '', $i ++),
|
||||||
array("{\$text=\"Text\"}\n<span>#</span>{\$text}<span>#</span>\n", '<span>#</span>Text<span>#</span>', '', $i ++),
|
array("\n <b>\n<c>c</c></b>\n", '<b> <c>c</c></b>', '', $i ++),
|
||||||
array("{\$text=\"Text\"}\n<span>#</span> {'Text'}\n", '<span>#</span> Text', '', $i ++),
|
array("{\$foo=1}\n <b>{\$foo}<c>c</c></b>\n", '<b>1<c>c</c></b>', '', $i ++),
|
||||||
|
array("{\$foo=1}\n <b>{\$foo} <c>c</c></b>\n", '<b>1 <c>c</c></b>', '', $i ++),
|
||||||
|
array("{\$foo=1}\n <b>\n{\$foo} <c>c</c></b>\n", '<b>1 <c>c</c></b>', '', $i ++),
|
||||||
|
array("\n<span>#</span>{'Text'}<span>#</span>\n", '<span>#</span>Text<span>#</span>', '', $i ++),
|
||||||
|
array("\n<span>#</span> {'Text'}\n", '<span>#</span> Text', '', $i ++),
|
||||||
|
array("\n<span>#</span> {'Text'}\n", '<span>#</span> Text', '', $i ++),
|
||||||
|
array("\n<b></b><c></c>", '<b></b><c></c>', '', $i ++),
|
||||||
|
array("{'Var'}\n<b></b> <c></c>", 'Var<b></b> <c></c>', '', $i ++),
|
||||||
|
array("{'Var'}\n <b></b> <c></c>", 'Var<b></b> <c></c>', '', $i ++),
|
||||||
|
array("\n<b></b> <c></c>", '<b></b> <c></c>', '', $i ++),
|
||||||
|
array("\n<b></b>\n <c></c>", '<b></b> <c></c>', '', $i ++),
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user