summaryrefslogtreecommitdiff
path: root/tests/UnitTests/TemplateSource
diff options
context:
space:
mode:
Diffstat (limited to 'tests/UnitTests/TemplateSource')
-rw-r--r--tests/UnitTests/TemplateSource/Comments/CommentsTest.php10
-rw-r--r--tests/UnitTests/TemplateSource/NullCoalescingTest.php34
-rw-r--r--tests/UnitTests/TemplateSource/Spacing/SpacingTest.php12
-rw-r--r--tests/UnitTests/TemplateSource/StaticClass/StaticClassAccessTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Append/CompileAppendTest.php28
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Assign/CompileAssignTest.php20
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BlockPlugin/CompileBlockPluginTest.php127
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.noop.php4
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.nooutput.php4
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.testblock.php4
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.testparameter.php11
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.teststack.php25
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BlockPlugin/scripts/script_block_tag2.php (renamed from tests/UnitTests/TemplateSource/TagTests/BlockPlugin/scripts/script_block_tag.php)2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php344
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_2child.tpl2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_3child.tpl2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/034_4child.tpl2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_2parent.tpl2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_3parent.tpl2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/035_4parent.tpl2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/036_2_parent.tpl1
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/BockExtend/templates/036_3_parent.tpl1
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Capture/CompileCaptureTest.php18
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/CompilerPluginTest.php6
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/PHPunitplugins/compiler.test.php20
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/PHPunitplugins/compiler.testclose.php16
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/ConfigLoad/CompileConfigLoadTest.php52
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Delimiter/CompileDelimiterTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Eval/CompileEvalTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/For/CompileForTest.php28
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php42
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/FunctionPlugin/CompileFunctionPluginTest.php10
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/If/CompileIfTest.php18
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Include/CompileIncludeTest.php71
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Include/templates/include_with_modifier.tpl1
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Insert/CompileInsertTest.php269
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Insert/PHPunitplugins/insert.insertplugintest.php7
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Insert/PHPunitplugins/insert.test2.php6
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Insert/cache/.gitignore2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Insert/templates/inner.tpl1
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Insert/templates/insertplugintest.tpl1
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Insert/templates/insertplugintest2.tpl2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Insert/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Insert/templates_tmp/.gitignore2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Literal/LiteralTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/MakeNocache/CompileMakeNocacheTest.php309
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/MakeNocache/cache/.gitignore2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo.tpl1
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_assign.tpl1
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_foreach.tpl3
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_if.tpl1
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/002_test_backslash.tpl1
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/003_test_spaces.tpl1
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates_c/.gitignore2
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Nocache/CompileNocacheTest.php12
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginBlock/PluginBlockTextformatTest.php75
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/CountTest.php28
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/EmptyTest.php44
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/InArrayTest.php27
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/IsArrayTest.php28
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/IssetTest.php45
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionFetchTest.php26
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlCheckboxesTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlOptionsTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlRadiosTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectDateTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectTimeTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionMailtoTest.php95
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginFunction/TimeTest.php20
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCapitalizeTest.php80
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCharsetTest.php49
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountCharactersTest.php45
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountSentencesTest.php20
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountTest.php4
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountWordsTest.php34
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierDefaultTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierEscapeTest.php153
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierExplodeTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierLowerTest.php25
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierNl2brTest.php4
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierNumberFormatTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierRegexReplaceTest.php16
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierReplaceTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierSpacifyTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierStrRepeatTest.php4
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierStripTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierTruncateTest.php70
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierUnescapeTest.php28
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierUpperTest.php25
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierWordwrapTest.php84
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Section/CompileSectionTest.php16
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/SetFilter/CompileSetfilterTest.php20
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php96
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/While/CompileWhileTest.php16
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/_Attributes/AttributeTest.php16
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/_Error/CompileErrorTest.php14
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/_Print/PrintTest.php20
-rw-r--r--tests/UnitTests/TemplateSource/TagTests/break/CompileBreakTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/TernaryTest.php41
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/Array/ArrayTest.php12
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/BoolenNull/BooleanNullTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/ConstantTests/ConstantsTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/DoubleQuoted/DoubleQuotedStringTest.php12
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/Math/MathTest.php16
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/Modifier/ModifierTest.php18
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/Objects/ObjectVariableTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/PHPfunctions/PhpFunctionTest.php23
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/SingleQouted/SingleQuotedStringTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Constant/SmartyConstantTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Cookie/CookieTest.php16
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Delimiter/SmartyDelimiterTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Error/SmartyErrorTest.php12
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Now/SmartyNowTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Post/PostTest.php16
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/TemplateObject/SmartyTemplateObjectTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/TemplateObject/templates/template_object.tpl2
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Version/SmartyVersionTest.php10
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/Variables/Stream/StreamVariableTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/ValueTests/Variables/VariableVariable/VariableVariableTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/X_Scopes/ScopeTest.php328
-rw-r--r--tests/UnitTests/TemplateSource/Xml/XmlTest.php8
-rw-r--r--tests/UnitTests/TemplateSource/_Issues/327/ModifierIssue327Test.php6
-rw-r--r--tests/UnitTests/TemplateSource/_Issues/419/ExtendsIssue419Test.php10
-rw-r--r--tests/UnitTests/TemplateSource/_Issues/422/NestedLoopIssue422Test.php6
-rw-r--r--tests/UnitTests/TemplateSource/_Issues/428/SectionPropertiesShortSyntaxIssue428Test.php6
-rw-r--r--tests/UnitTests/TemplateSource/_Issues/549/MbSplitEncodingIssue549Test.php17
-rw-r--r--tests/UnitTests/TemplateSource/_Issues/topic26878/NewlineSpacing.php12
128 files changed, 1143 insertions, 2417 deletions
diff --git a/tests/UnitTests/TemplateSource/Comments/CommentsTest.php b/tests/UnitTests/TemplateSource/Comments/CommentsTest.php
index b8bd2cc8..443ac39e 100644
--- a/tests/UnitTests/TemplateSource/Comments/CommentsTest.php
+++ b/tests/UnitTests/TemplateSource/Comments/CommentsTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests comments in templates
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for security test
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class CommentsTest extends PHPUnit_Smarty
{
@@ -28,7 +28,7 @@ class CommentsTest extends PHPUnit_Smarty
/**
* Test comments
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestComments
*/
public function testComments($code, $result, $testName, $testNumber)
@@ -36,7 +36,7 @@ class CommentsTest extends PHPUnit_Smarty
$name = empty($testName) ? $testNumber : $testName;
$file = "testComments_{$name}.tpl";
$this->makeTemplateFile($file, $code);
- $this->smarty->template_dir = './templates_tmp';
+ $this->smarty->setTemplateDir('./templates_tmp');
$this->assertEquals($result,
$this->smarty->fetch($file),
$file);
diff --git a/tests/UnitTests/TemplateSource/NullCoalescingTest.php b/tests/UnitTests/TemplateSource/NullCoalescingTest.php
new file mode 100644
index 00000000..2432527a
--- /dev/null
+++ b/tests/UnitTests/TemplateSource/NullCoalescingTest.php
@@ -0,0 +1,34 @@
+<?php
+
+class NullCoalescingTest extends PHPUnit_Smarty {
+
+ public function setUp(): void
+ {
+ $this->setUpSmarty('/tmp');
+ $this->cleanDirs();
+ }
+
+ public function testUndefined() {
+ $tpl = $this->smarty->createTemplate('string:{$myvar ?? "undefined"}');
+ $this->assertEquals('undefined', $this->smarty->fetch($tpl));
+ }
+
+ /**
+ * @dataProvider dataForOther
+ */
+ public function testOther($value, $expected) {
+ $tpl = $this->smarty->createTemplate('string:{$myvar ?? "undefined"}');
+ $tpl->assign('myvar', $value);
+ $this->assertEquals($expected, $this->smarty->fetch($tpl));
+ }
+
+ public function dataForOther() {
+ return [
+ [null, 'undefined'],
+ ['blah', 'blah'],
+ ['', ''],
+ [false, false],
+ ];
+ }
+
+}
diff --git a/tests/UnitTests/TemplateSource/Spacing/SpacingTest.php b/tests/UnitTests/TemplateSource/Spacing/SpacingTest.php
index 7f92fb03..098d9eb8 100644
--- a/tests/UnitTests/TemplateSource/Spacing/SpacingTest.php
+++ b/tests/UnitTests/TemplateSource/Spacing/SpacingTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests spacing in template output
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for spacing test
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class SpacingTest extends PHPUnit_Smarty
{
@@ -28,16 +28,16 @@ class SpacingTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacing($code, $result, $testName, $testNumber)
{
$name = empty($testName) ? $testNumber : $testName;
$file = "Spacing_{$name}.tpl";
$this->makeTemplateFile($file, $code);
- $this->smarty->template_dir = './templates_tmp';
+ $this->smarty->setTemplateDir('./templates_tmp');
$this->smarty->assign('file', $file);
$this->smarty->assign('foo', 'bar');
$this->assertEquals($result,
diff --git a/tests/UnitTests/TemplateSource/StaticClass/StaticClassAccessTest.php b/tests/UnitTests/TemplateSource/StaticClass/StaticClassAccessTest.php
index b3fbdb18..7836172c 100644
--- a/tests/UnitTests/TemplateSource/StaticClass/StaticClassAccessTest.php
+++ b/tests/UnitTests/TemplateSource/StaticClass/StaticClassAccessTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests static class access to constants, variables and methods
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for static class access to constants, variables and methods tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class StaticClassAccessTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/Append/CompileAppendTest.php b/tests/UnitTests/TemplateSource/TagTests/Append/CompileAppendTest.php
index 4590982b..dc99abcf 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Append/CompileAppendTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Append/CompileAppendTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of append tags
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for append tags tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class CompileAppendTest extends PHPUnit_Smarty
{
@@ -32,8 +32,8 @@ class CompileAppendTest extends PHPUnit_Smarty
/**
* Test {append} tags
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider dataTestAppend
*/
public function testAppend($code, $result, $testName, $testNumber)
@@ -70,9 +70,9 @@ class CompileAppendTest extends PHPUnit_Smarty
/**
* Test Assign spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testAppendSpacing($code, $result, $testName, $testNumber)
{
@@ -88,9 +88,9 @@ class CompileAppendTest extends PHPUnit_Smarty
/**
* Test Append nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testAppendSpacingNocache($code, $result, $testName, $testNumber)
{
@@ -107,9 +107,9 @@ class CompileAppendTest extends PHPUnit_Smarty
/**
* Test Append nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testAppendSpacingNocache2($code, $result, $testName, $testNumber)
{
@@ -118,6 +118,12 @@ class CompileAppendTest extends PHPUnit_Smarty
$this->smarty->setCompileId('1');
$this->smarty->setCaching(1);
$this->smarty->setTemplateDir('./templates_tmp');
+
+ $this->smarty->assign('foo', 'bar',true);
+ $this->assertEquals($result,
+ $this->smarty->fetch($file),
+ "testSpacing - {$file}");
+
$this->smarty->assign('foo', 'foo',true);
$this->assertEquals(str_replace('bar','foo',$result),
$this->smarty->fetch($file),
diff --git a/tests/UnitTests/TemplateSource/TagTests/Assign/CompileAssignTest.php b/tests/UnitTests/TemplateSource/TagTests/Assign/CompileAssignTest.php
index d9be6c7c..e654efa2 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Assign/CompileAssignTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Assign/CompileAssignTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of assign tags
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for assign tags tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class CompileAssignTest extends PHPUnit_Smarty
{
@@ -33,7 +33,7 @@ class CompileAssignTest extends PHPUnit_Smarty
* Test assign tags
*
* @not runInSeparateProcess
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestAssign
*/
public function testAssign($code, $result, $testName, $testNumber)
@@ -93,9 +93,9 @@ class CompileAssignTest extends PHPUnit_Smarty
/**
* Test Assign spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testAssignSpacing($code, $result, $testName, $testNumber)
{
@@ -111,9 +111,9 @@ class CompileAssignTest extends PHPUnit_Smarty
/**
* Test Output nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testAssignSpacingNocache($code, $result, $testName, $testNumber)
{
@@ -130,9 +130,9 @@ class CompileAssignTest extends PHPUnit_Smarty
/**
* Test Output nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testAssignSpacingNocache2($code, $result, $testName, $testNumber)
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/CompileBlockPluginTest.php b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/CompileBlockPluginTest.php
index 1c3e8b2e..328cd4c1 100644
--- a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/CompileBlockPluginTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/CompileBlockPluginTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of block plugins
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for block plugin tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class CompileBlockPluginTest extends PHPUnit_Smarty
{
@@ -50,97 +50,71 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
*/
public function testBlockPluginUnknown()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('unknown tag \'bar\'');
$this->assertEquals("hello world", $this->smarty->fetch('unknown.tpl'));
}
/**
* test block plugin function definition in script
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginRegisteredFunction()
{
- $this->smarty->registerPlugin(Smarty::PLUGIN_BLOCK, 'blockplugintest', 'myblockplugintest');
+ $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_BLOCK, 'blockplugintest', 'myblockplugintest');
$this->assertEquals('block test', $this->smarty->fetch('registered.tpl'));
}
/**
* test block plugin function definition in script
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
*/
public function testBlockPluginRegisteredFunction2()
{
- $this->expectException('SmartyException');
+ $this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage('block tag \'blockplugintest\' not callable');
$this->assertEquals('block test', $this->smarty->fetch('registered.tpl'));
}
/**
* test block plugin static method
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginRegisteredStatic()
{
- $this->smarty->registerPlugin(Smarty::PLUGIN_BLOCK, 'blockpluginstatic', array('myblockclass1', 'staticfunc'));
+ $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_BLOCK, 'blockpluginstatic', array('myblockclass1', 'staticfunc'));
$this->assertEquals('static block test', $this->smarty->fetch('registered_static.tpl'));
}
/**
* test block plugin static method failure
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginRegisteredStatic2()
{
- $this->expectException('SmartyException');
+ $this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage('block tag \'blockpluginstatic\' not callable');
$this->assertEquals('static block test', $this->smarty->fetch('registered_static.tpl'));
}
/**
* test block plugin object method
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginRegisteredMethod()
{
$object = new myblockclass1();
- $this->smarty->registerPlugin(Smarty::PLUGIN_BLOCK, 'blockpluginmethod', array($object, 'methodfunc'));
+ $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_BLOCK, 'blockpluginmethod', array($object, 'methodfunc'));
$this->assertEquals('method block test', $this->smarty->fetch('registered_method.tpl'));
}
/**
* test block plugin object method failure
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
*/
public function testBlockPluginRegisteredMethod2()
{
- $this->expectException('SmartyException');
+ $this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage('block tag \'blockpluginmethod\' not callable');
$this->assertEquals('method block test', $this->smarty->fetch('registered_method.tpl'));
}
/**
* test block plugin registered object
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginRegisteredObject()
{
@@ -151,23 +125,16 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
/**
* test block plugin registered object failure
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
*/
public function testBlockPluginRegisteredObject2()
{
- $this->expectException('SmartyException');
- $this->expectExceptionMessage('block tag \'myobject\' not callable');
+ $this->expectException(\Smarty\Exception::class);
+ $this->expectExceptionMessage('block tag \'myobject\' not callable or registered');
$this->assertEquals('object block test', $this->smarty->fetch('registered_object.tpl'));
}
/**
* test block plugin repeat function
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginRepeat()
{
@@ -176,10 +143,6 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
/**
* test block plugin repeat function with modifier
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginRepeatModidier1()
{
@@ -188,10 +151,6 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
/**
* test block plugin repeat function with modifier list
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginRepeatModidier2()
{
@@ -200,10 +159,6 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
/**
* test block plugin with no output
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginNoOutput()
{
@@ -212,10 +167,6 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
/**
* test nested block plugin
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginNested()
{
@@ -224,10 +175,6 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
/**
* test default block plugin
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginDefault1()
{
@@ -237,10 +184,6 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
/**
* test default block plugin
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
*/
public function testBlockPluginDefault2()
{
@@ -249,25 +192,9 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
}
/**
- * test tag stack
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
- */
- public function testBlockPluginTagStack()
- {
- $this->assertEquals('noop-teststack', $this->smarty->fetch('tag_stack.tpl'));
- $this->assertEmpty($this->smarty->_cache[ '_tag_stack' ]);
- }
-
- /**
* Test caching
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
* @dataProvider data
- *
*/
public function testCache($isCached,
$caching,
@@ -281,8 +208,8 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
$testName)
{
$this->smarty->registerFilter('pre', array($this, 'prefilterTest'));
- $this->smarty->registerPlugin(Smarty::PLUGIN_BLOCK, 'cachetest', 'myblockplugintest2', $cachable);
- $this->smarty->compile_id = $compileid;
+ $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_BLOCK, 'cachetest', 'myblockplugintest2', $cachable);
+ $this->smarty->setCompileId($compileid);
$this->smarty->caching = $caching;
$this->smarty->cache_lifetime = 1000;
$this->smarty->assign('test', $testNumber);
@@ -317,9 +244,7 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
*/
public function testSpacing($code, $result, $testName, $testNumber)
{
@@ -358,9 +283,7 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
* @dataProvider dataTestDefaultSpacing
- * @runInSeparateProcess
*/
public function testSpacingDefault($code, $result, $testName, $testNumber)
{
@@ -369,7 +292,7 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
$this->makeTemplateFile($file, $code);
$this->smarty->setTemplateDir('./templates_tmp');
$this->smarty->registerDefaultPluginHandler('my_block_plugin_handler');
- $this->smarty->compile_id='default';
+ $this->smarty->setCompileId('default');
$this->smarty->assign('foo', 'bar');
$this->assertEquals($result,
$this->smarty->fetch($file),
@@ -402,9 +325,7 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
/**
* Test nocache block spacings
*
- * @preserveGlobalState disabled
* @dataProvider dataTestNocacheSpacing
- * @runInSeparateProcess
*/
public function testBlockNocache($code, $result, $testName, $testNumber)
{
@@ -422,9 +343,7 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
/**
* Test nocache block spacings
*
- * @preserveGlobalState disabled
* @dataProvider dataTestNocacheSpacing
- * @runInSeparateProcess
*/
public function testBlockNocache2($code, $result, $testName, $testNumber)
{
@@ -459,7 +378,7 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
}
}
-function myblockplugintest($params, $content, &$smarty_tpl, &$repeat)
+function myblockplugintest($params, $content, $smarty_tpl, &$repeat)
{
if (!$repeat) {
$output = str_replace('hello world', 'block test', $content);
@@ -468,7 +387,7 @@ function myblockplugintest($params, $content, &$smarty_tpl, &$repeat)
}
}
-function myblockplugintest2($params, $content, &$smarty_tpl, &$repeat)
+function myblockplugintest2($params, $content, $smarty_tpl, &$repeat)
{
if (!$repeat) {
$output = str_replace('hello world', "block test{$params['var']}", $content);
@@ -479,7 +398,7 @@ function myblockplugintest2($params, $content, &$smarty_tpl, &$repeat)
class myblockclass1
{
- static function staticfunc($params, $content, &$smarty_tpl, &$repeat)
+ static function staticfunc($params, $content, $smarty_tpl, &$repeat)
{
if (!$repeat) {
$output = str_replace('hello world', 'static block test', $content);
@@ -487,7 +406,7 @@ class myblockclass1
}
}
- public function methodfunc($params, $content, &$smarty_tpl, &$repeat)
+ public function methodfunc($params, $content, $smarty_tpl, &$repeat)
{
if (!$repeat) {
$output = str_replace('hello world', 'method block test', $content);
@@ -495,7 +414,7 @@ class myblockclass1
}
}
- public function objectfunc($params, $content, &$smarty_tpl, &$repeat)
+ public function objectfunc($params, $content, $smarty_tpl, &$repeat)
{
if (!$repeat) {
$output = str_replace('hello world', 'object block test', $content);
@@ -507,11 +426,11 @@ class myblockclass1
function my_block_plugin_handler($tag, $type, $template, &$callback, &$script, &$cachable)
{
switch ($type) {
- case Smarty::PLUGIN_BLOCK:
+ case \Smarty\Smarty::PLUGIN_BLOCK:
switch ($tag) {
case 'scriptblock':
- $script = './scripts/script_block_tag.php';
- $callback = 'default_script_block_tag';
+ $script = './scripts/script_block_tag2.php';
+ $callback = 'default_script_block_tag2';
return true;
default:
diff --git a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.noop.php b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.noop.php
index 0e163e59..fbd5e693 100644
--- a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.noop.php
+++ b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.noop.php
@@ -2,8 +2,8 @@
/**
* Smarty plugin for testing block plugins
*
- * @package Smarty
- * @subpackage PHPunitPlugin
+
+
*/
/**
diff --git a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.nooutput.php b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.nooutput.php
index 398c9a3b..ce59bc43 100644
--- a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.nooutput.php
+++ b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.nooutput.php
@@ -2,8 +2,8 @@
/**
* Smarty plugin for testing block plugins
*
- * @package Smarty
- * @subpackage PHPunitPlugin
+
+
*/
/**
diff --git a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.testblock.php b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.testblock.php
index 63f1108a..b56dad97 100644
--- a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.testblock.php
+++ b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.testblock.php
@@ -2,8 +2,8 @@
/**
* Smarty plugin for testing block plugins
*
- * @package Smarty
- * @subpackage PHPunitPlugin
+
+
*/
/**
diff --git a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.testparameter.php b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.testparameter.php
index bdac3291..0c8f616e 100644
--- a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.testparameter.php
+++ b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.testparameter.php
@@ -2,20 +2,23 @@
/**
* Smarty plugin for testing block plugins
*
- * @package Smarty
- * @subpackage PHPunitPlugin
+
+
*/
+
+use Smarty\Template;
+
/**
* Smarty {testparameter}{/testparameter} block plugin
*
* @param array $params parameter array
* @param string $content contents of the block
- * @param \Smarty_Internal_Template $template template object
+ * @param \Smarty\Template $template template object
* @param bool $repeat flag
*
* @return string content re-formatted
*/
-function smarty_block_testparameter($params, $content, Smarty_Internal_Template $template, &$repeat)
+function smarty_block_testparameter($params, $content, Template $template, &$repeat)
{
if (isset($content)) {
return $content;
diff --git a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.teststack.php b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.teststack.php
deleted file mode 100644
index f1eef38d..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/PHPunitplugins/block.teststack.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * Smarty plugin for testing block plugins
- *
- * @package Smarty
- * @subpackage PHPunitPlugin
- */
-
-/**
- * Smarty {teststack}{/teststack} block plugin
- *
- * @param array $params parameter array
- * @param string $content contents of the block
- * @param object $template template object
- * @param bool $repeat flag
- *
- * @return string content re-formatted
- */
-function smarty_block_teststack($params, $content, $template, &$repeat)
-{
- if (isset($content)) {
- $stack = $template->smarty->_cache['_tag_stack'];
- return $stack[0][0] . '-' . $stack[1][0];
- }
-}
diff --git a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/scripts/script_block_tag.php b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/scripts/script_block_tag2.php
index a61f14d6..71497a40 100644
--- a/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/scripts/script_block_tag.php
+++ b/tests/UnitTests/TemplateSource/TagTests/BlockPlugin/scripts/script_block_tag2.php
@@ -1,5 +1,5 @@
<?php
-function default_script_block_tag($params, $content, $template, &$repeat)
+function default_script_block_tag2($params, $content, $template, &$repeat)
{
if (isset($content)) {
return 'scriptblock ' . $content;
diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php
index b14eab67..1b0ee50f 100644
--- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php
@@ -2,16 +2,14 @@
/**
* Smarty PHPunit tests for Block Extends
*
- * @package PHPunit
+
* @author Uwe Tews
*/
+use Smarty\Template;
+
/**
* class for block extends compiler tests
- *
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
*/
class CompileBlockExtendsTest extends PHPUnit_Smarty
{
@@ -21,7 +19,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
//$this->smarty->setMergeCompiledIncludes(true);
}
- public function compiledPrefilter($text, Smarty_Internal_Template $tpl)
+ public function compiledPrefilter($text, Template $tpl)
{
return str_replace('#', $tpl->getTemplateVars('test'), $text);
}
@@ -60,8 +58,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChild_002($caching, $merge, $testNumber, $compileTestNumber, $renderTestNumber,
@@ -85,8 +83,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain with prepend
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildPrepend_003($caching, $merge, $testNumber, $compileTestNumber,
@@ -111,8 +109,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain with prepend
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockGrandPrepend_003($caching, $merge, $testNumber, $compileTestNumber,
@@ -138,8 +136,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain with apppend
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildAppend_004($caching, $merge, $testNumber, $compileTestNumber,
@@ -165,8 +163,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/parent template chain with apppend
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockGrandAppend_004($caching, $merge, $testNumber, $compileTestNumber,
@@ -192,8 +190,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/parent template chain with apppend
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockGrandAppendPrepend_004($caching, $merge, $testNumber, $compileTestNumber,
@@ -219,8 +217,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain with apppend and shorttags
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildAppendShortag_005($caching, $merge, $testNumber, $compileTestNumber,
@@ -245,8 +243,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain with {$this->smarty.block.child)
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildSmartyChild_006($caching, $merge, $testNumber, $compileTestNumber,
@@ -271,8 +269,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain with {$this->smarty.block.parent)
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildSmartyParent_007($caching, $merge, $testNumber, $compileTestNumber,
@@ -298,8 +296,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/child/parent template chain with {$this->smarty.block.parent)
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildSmartyParent_007_2($caching, $merge, $testNumber, $compileTestNumber,
@@ -325,8 +323,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain loading plugin
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildPlugin_008($caching, $merge, $testNumber, $compileTestNumber,
@@ -352,8 +350,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test parent template with nested blocks
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockParentNested_009($caching, $merge, $testNumber, $compileTestNumber,
@@ -377,8 +375,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain with nested block
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildNested_010($caching, $merge, $testNumber, $compileTestNumber,
@@ -403,8 +401,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain with nested block and include
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildNestedInclude_011($caching, $merge, $testNumber, $compileTestNumber,
@@ -430,8 +428,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test template chain with nested block level test
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildNestedInclude_012($caching, $merge, $testNumber, $compileTestNumber,
@@ -457,8 +455,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test nested child block with hide
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildNestedHide_018($caching, $merge, $testNumber, $compileTestNumber,
@@ -481,8 +479,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test nested grand/child block with hide
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildNestedHide_018_2($caching, $merge, $testNumber, $compileTestNumber,
@@ -505,8 +503,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test nested grandgrand/grand/child block with hide
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockChildNestedHide_018_3($caching, $merge, $testNumber, $compileTestNumber,
@@ -529,8 +527,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain starting in subtempates
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockStartSubTemplates_020($caching, $merge, $testNumber, $compileTestNumber,
@@ -557,8 +555,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/child/parent dependency test1
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testCompileBlockGrandChildMustCompile_021_1()
{
@@ -573,7 +571,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
$result = $this->smarty->fetch($tpl);
$this->assertStringContainsString('(grand|b)content grand b(grand|/b)(child|b)content child b(child|/b)(parent|b)content parent b(parent|/b)',
$result);
- $this->smarty->_clearTemplateCache();
$this->smarty->assign('parent', 'parent2');
$this->smarty->assign('child', 'child2', true);
$this->smarty->assign('grand', 'grand2', true);
@@ -587,8 +584,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/child/parent dependency test1
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testCompileBlockGrandChildMustCompile_021_12()
{
@@ -607,9 +604,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/child/parent dependency test2
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
* @group slow
*/
public function testCompileBlockGrandChildMustCompile_021_2()
@@ -628,7 +622,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
$result = $this->smarty->fetch($tpl);
$this->assertStringContainsString('(grand|b)content grand4 b(grand|/b)(child|b)content child4 b(child|/b)(parent|b)content parent4 b(parent|/b)',
$result);
- $this->smarty->_clearTemplateCache();
$this->smarty->assign('parent', 'parent5');
$this->smarty->assign('child', 'child5', true);
$this->smarty->assign('grand', 'grand5', true);
@@ -642,9 +635,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/child/parent dependency test3
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
* @group slow
*/
public function testCompileBlockGrandChildMustCompile_021_3()
@@ -668,8 +658,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/child/parent dependency test3
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @group slow
*/
public function testCompileBlockGrandChildMustCompile_021_32()
@@ -689,9 +679,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/child/parent dependency test4
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
* @group slow
*/
public function testCompileBlockGrandChildMustCompile_021_4()
@@ -715,8 +702,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/child/parent dependency test4
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @group slow
*/
public function testCompileBlockGrandChildMustCompile_021_42()
@@ -757,7 +744,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/
public function testSmartyBlockChildOutsideBlock_025()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('\'{$smarty.block.child}\' used outside {block} tags');
$this->smarty->fetch('025_parent.tpl');
}
@@ -767,7 +754,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/
public function testSmartyBlockParentOutsideBlock_026()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('\'{$smarty.block.parent}\' used outside {block} tags');
$this->smarty->fetch('026_child.tpl');
}
@@ -777,7 +764,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/
public function testSmartyBlockParentInParent_027()
{
- $this->expectException('SmartyException');
+ $this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage('illegal \'{$smarty.block.parent}\'');
$this->smarty->fetch('027_parent.tpl');
}
@@ -785,8 +772,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test child/parent template chain
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testSmartyBlockVariablePartentInclude_28($caching, $merge, $testNumber, $compileTestNumber,
@@ -832,8 +819,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/child/parent template chain with nested {$this->smarty.block.child} and {include nocache}
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockGrandChildNested_030($caching, $merge, $testNumber, $compileTestNumber,
@@ -855,8 +842,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/child/parent template chain with nested {$this->smarty.block.child} and {include nocache}
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockGrandChildNestedRelative_030($caching, $merge, $testNumber, $compileTestNumber,
@@ -878,8 +865,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test grandchild/child/parent template chain with nested {$this->smarty.block.child} and {include nocache}
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockSmartyBlockParent_034_1($caching, $merge, $testNumber, $compileTestNumber,
@@ -897,77 +884,12 @@ 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}
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @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}
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @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}
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @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)
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockSmartyBlockChild_035_1($caching, $merge, $testNumber, $compileTestNumber,
@@ -990,87 +912,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
$testName . ' - fetch() failure');
}
- /**
- * test child/parent template chain with {$this->smarty.block.child)
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @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)
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @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)
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @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(/*
@@ -1096,7 +937,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/
public function testPostFilter_031()
{
- function smarty_postfilter_test031($compiled, Smarty_Internal_Template $template)
+ function smarty_postfilter_test031($compiled, Template $template)
{
return str_replace("'foo'", "'bar'", $compiled);
}
@@ -1121,8 +962,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* test relative includes in {block}
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider data
*/
public function testCompileBlockRelativeIncludes_033($caching, $merge, $testNumber, $compileTestNumber,
@@ -1147,7 +988,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/
public function testSmartyBlockWrongBlockName_036()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('$smarty.block is not defined');
$this->smarty->fetch('036_parent.tpl');
}
@@ -1156,35 +997,16 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/
public function testSmartyParentBlockCalledInParent_036_1()
{
- $this->expectException('SmartyException');
+ $this->expectException(\Smarty\Exception::class);
$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('SmartyException');
- $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('SmartyException');
- $this->expectExceptionMessage('inheritance: illegal \'{parent}\' used in child template');
- $this->smarty->fetch('036_3_parent.tpl');
- }
-
- /**
* test smarty.block
*/
public function testSmartyBlockMissigBlockName_037()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('$smarty.block is not defined');
$this->smarty->fetch('037_parent.tpl');
}
@@ -1192,9 +1014,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacing($code, $result, $testName, $testNumber)
{
@@ -1210,9 +1032,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* Test Output nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testBlockSpacingNocache($code, $result, $testName, $testNumber)
{
@@ -1229,9 +1051,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* Test Output nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testBlockSpacingNocache2($code, $result, $testName, $testNumber)
{
@@ -1268,9 +1090,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestChildSpacing
- * @runInSeparateProcess
+ *
*/
public function testChildSpacing($code, $result, $testName, $testNumber)
{
@@ -1317,9 +1139,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* Test Block nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestBlockNocache
- * @runInSeparateProcess
+ *
*/
public function testBlockNocacheSpacing($code, $result, $name, $testNumber)
{
@@ -1336,9 +1158,9 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/**
* Test Block nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestBlockNocache
- * @runInSeparateProcess
+ *
*/
public function testBlockNocacheSpacing2($code, $result, $name, $testNumber)
{
@@ -1352,7 +1174,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
"blockNocache - {$file}");
}
/*
- * Data provider für TestBlockNocache
+ * Data provider for TestBlockNocache
*/
public function dataTestBlockNocache()
{
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/Capture/CompileCaptureTest.php b/tests/UnitTests/TemplateSource/TagTests/Capture/CompileCaptureTest.php
index 8c1c7d6d..97a3c54f 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Capture/CompileCaptureTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Capture/CompileCaptureTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of capture tags
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for capture tags tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class CompileCaptureTest extends PHPUnit_Smarty
{
@@ -31,7 +31,7 @@ class CompileCaptureTest extends PHPUnit_Smarty
* Test capture tags
*
* @not runInSeparateProcess
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestCapture
*/
public function testCapture($code, $result, $testName, $testNumber)
@@ -83,8 +83,8 @@ class CompileCaptureTest extends PHPUnit_Smarty
/**
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
*/
public function testCompileCaptureNocache2()
@@ -107,9 +107,9 @@ class CompileCaptureTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacing($code, $result, $testName, $testNumber)
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/CompilerPluginTest.php b/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/CompilerPluginTest.php
index 68bfc45a..78efeb9b 100644
--- a/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/CompilerPluginTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/CompilerPluginTest.php
@@ -2,16 +2,12 @@
/**
* Smarty PHPunit tests compiler plugin
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for compiler plugin tests
- *
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
*/
class CompilerPluginTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/PHPunitplugins/compiler.test.php b/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/PHPunitplugins/compiler.test.php
index 615e0413..13ca0dee 100644
--- a/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/PHPunitplugins/compiler.test.php
+++ b/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/PHPunitplugins/compiler.test.php
@@ -1,10 +1,12 @@
<?php
// compiler.test.php
-class smarty_compiler_test extends Smarty_Internal_CompileBase
+use Smarty\Compile\Base;
+
+class smarty_compiler_test extends Base
{
- public function compile($args, $compiler)
- {
+
+ public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
$this->required_attributes = array('data');
$_attr = $this->getAttributes($compiler, $args);
@@ -14,15 +16,3 @@ class smarty_compiler_test extends Smarty_Internal_CompileBase
return "<?php echo 'test output'; ?>";
}
}
-
-// compiler.testclose.php
-class smarty_compiler_testclose extends Smarty_Internal_CompileBase
-{
- public function compile($args, $compiler)
- {
-
- $this->closeTag($compiler, 'test');
-
- return '';
- }
-}
diff --git a/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/PHPunitplugins/compiler.testclose.php b/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/PHPunitplugins/compiler.testclose.php
index bd751f06..68ab73f1 100644
--- a/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/PHPunitplugins/compiler.testclose.php
+++ b/tests/UnitTests/TemplateSource/TagTests/CompilerPlugin/PHPunitplugins/compiler.testclose.php
@@ -1,13 +1,15 @@
<?php
// compiler.testclose.php
-class smarty_compiler_testclose extends Smarty_Internal_CompileBase
+use Smarty\Compile\Base;
+
+class smarty_compiler_testclose extends Base
{
- public function execute($args, $compiler)
- {
- $this->closeTag($compiler, 'test');
+ public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = [], $tag = null, $function = null) {
+
+ $this->closeTag($compiler, 'test');
- return '';
- }
-}
+ return '';
+ }
+} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/ConfigLoad/CompileConfigLoadTest.php b/tests/UnitTests/TemplateSource/TagTests/ConfigLoad/CompileConfigLoadTest.php
index 18cbe4cb..5a402028 100644
--- a/tests/UnitTests/TemplateSource/TagTests/ConfigLoad/CompileConfigLoadTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/ConfigLoad/CompileConfigLoadTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of the {config_load} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for config variable tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class CompileConfigLoadTest extends PHPUnit_Smarty
{
@@ -37,8 +37,8 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
* test {load_config} loading section2
*/
@@ -47,8 +47,8 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
$this->assertEquals("Welcome to Smarty! Global Section1 Hello Section2", $this->smarty->fetch('001_section2.tpl'));
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
* test {load_config} loading section2
*/
@@ -59,8 +59,8 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
* test {load_config} loading section2
*/
@@ -70,8 +70,8 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
* test {load_config} loading section2 shorttags
*/
@@ -83,8 +83,8 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
/**
* test config varibales loading all sections from template
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testConfigVariableAllSectionsTemplate_004()
{
@@ -95,8 +95,8 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
/**
* test config varibales overwrite
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testConfigVariableOverwrite_005()
{
@@ -104,16 +104,16 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testConfigVariableOverwrite_006()
{
$this->assertEquals("Welcome to Smarty! Overwrite3", $this->smarty->fetch('006_overwrite.tpl'));
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testConfigVariableOverwrite_0061()
{
@@ -125,8 +125,8 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
/**
* test config varibales overwrite false
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testConfigVariableOverwrite_007()
{
@@ -137,8 +137,8 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
/**
* test config varibales booleanize on
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testConfigVariableBooleanizeOn_008()
{
@@ -150,8 +150,8 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
/**
* test config varibales booleanize off
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testConfigVariableBooleanizeOff_008()
{
@@ -165,7 +165,7 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
*/
public function testConfigSyntaxError_009()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('Syntax error in config file');
$this->smarty->fetch('009_error.tpl');
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/Delimiter/CompileDelimiterTest.php b/tests/UnitTests/TemplateSource/TagTests/Delimiter/CompileDelimiterTest.php
index 1100beb8..4a90c535 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Delimiter/CompileDelimiterTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Delimiter/CompileDelimiterTest.php
@@ -2,7 +2,7 @@
/**
* Smarty PHPunit tests compilation of delimiter tags
*
- * @package PHPunit
+
* @author Uwe Tews
*/
@@ -10,8 +10,8 @@
* class for delimiter tags tests
*
* @run TestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
*/
class CompileDelimiterTest extends PHPUnit_Smarty
{
@@ -43,7 +43,7 @@ class CompileDelimiterTest extends PHPUnit_Smarty
public function testLeftDelimiterError()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('nocache option not allowed');
$tpl = $this->smarty->createTemplate('string:x{ldelim nocache}x');
$this->assertEquals('x{x', $this->smarty->fetch($tpl));
diff --git a/tests/UnitTests/TemplateSource/TagTests/Eval/CompileEvalTest.php b/tests/UnitTests/TemplateSource/TagTests/Eval/CompileEvalTest.php
index cd6d14bf..1c2ad006 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Eval/CompileEvalTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Eval/CompileEvalTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of {eval} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {eval} tag tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class CompileEvalTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/For/CompileForTest.php b/tests/UnitTests/TemplateSource/TagTests/For/CompileForTest.php
index 07137973..21d997d6 100644
--- a/tests/UnitTests/TemplateSource/TagTests/For/CompileForTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/For/CompileForTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of {for} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {for} tag tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class CompileForTest extends PHPUnit_Smarty
{
@@ -29,9 +29,9 @@ class CompileForTest extends PHPUnit_Smarty
/**
* Test For
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestFor
- * @runInSeparateProcess
+ *
*/
public function testFor($code, $result, $testName, $testNumber)
{
@@ -90,8 +90,8 @@ class CompileForTest extends PHPUnit_Smarty
/**
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
*/
public function testForNocacheVar2()
@@ -114,8 +114,8 @@ class CompileForTest extends PHPUnit_Smarty
/**
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
*/
public function testForNocacheTag2()
@@ -138,8 +138,8 @@ class CompileForTest extends PHPUnit_Smarty
/**
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
*/
public function testForCache2()
@@ -153,9 +153,9 @@ class CompileForTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacing($code, $result, $testName, $testNumber)
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php b/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php
index d0a496c8..3e39d5e2 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Foreach/CompileForeachTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of {foreach} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {foreach} tag tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class CompileForeachTest extends PHPUnit_Smarty
{
@@ -31,7 +31,7 @@ class CompileForeachTest extends PHPUnit_Smarty
* Test foreach tags
*
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestForeach
*/
public function testForeach($code, $foo, $result, $testName, $testNumber)
@@ -105,7 +105,7 @@ class CompileForeachTest extends PHPUnit_Smarty
* Test foreach tags caching
*
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestForeachNocache
*/
public function testForeachCaching($code, $new, $assignNocache, $foo, $result, $testName, $testNumber)
@@ -151,8 +151,8 @@ class CompileForeachTest extends PHPUnit_Smarty
/*
* test foreach and nocache
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testForeachNocacheVar1_024()
@@ -165,8 +165,8 @@ class CompileForeachTest extends PHPUnit_Smarty
/**
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
*/
public function testForeachNocacheVar2_024()
@@ -179,8 +179,8 @@ class CompileForeachTest extends PHPUnit_Smarty
/**
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
*/
public function testForeachNocacheTag1_025()
@@ -193,8 +193,8 @@ class CompileForeachTest extends PHPUnit_Smarty
/**
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
*/
public function testForeachNocacheTag2_25()
@@ -207,8 +207,8 @@ class CompileForeachTest extends PHPUnit_Smarty
/**
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
*/
public function testForeachCache1_26()
@@ -221,8 +221,8 @@ class CompileForeachTest extends PHPUnit_Smarty
/**
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
*/
public function testForeachCache2_26()
@@ -303,9 +303,9 @@ class CompileForeachTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacing($code, $result, $testName, $testNumber)
{
@@ -347,9 +347,9 @@ class CompileForeachTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestElseSpacing
- * @runInSeparateProcess
+ *
*/
public function testElseSpacing($code, $result, $testName, $testNumber)
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/FunctionPlugin/CompileFunctionPluginTest.php b/tests/UnitTests/TemplateSource/TagTests/FunctionPlugin/CompileFunctionPluginTest.php
index bb130b58..fd62a5ef 100644
--- a/tests/UnitTests/TemplateSource/TagTests/FunctionPlugin/CompileFunctionPluginTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/FunctionPlugin/CompileFunctionPluginTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of function plugins
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for function plugin tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class CompileFunctionPluginTest extends PHPUnit_Smarty
{
@@ -42,7 +42,7 @@ class CompileFunctionPluginTest extends PHPUnit_Smarty
*/
public function testFunctionPluginRegisteredFunction()
{
- $this->smarty->registerPlugin(Smarty::PLUGIN_FUNCTION, 'plugintest', 'myplugintest');
+ $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_FUNCTION, 'plugintest', 'myplugintest');
$tpl = $this->smarty->createTemplate('string:{plugintest foo=bar}', $this->smarty);
$this->assertEquals("plugin test called bar", $this->smarty->fetch($tpl));
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/If/CompileIfTest.php b/tests/UnitTests/TemplateSource/TagTests/If/CompileIfTest.php
index 1fe73e9f..9d4debde 100644
--- a/tests/UnitTests/TemplateSource/TagTests/If/CompileIfTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/If/CompileIfTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of {if} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {if} tag tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class CompileIfTest extends PHPUnit_Smarty
{
@@ -33,7 +33,7 @@ class CompileIfTest extends PHPUnit_Smarty
* Test if tags
*
* @not runInSeparateProcess
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestIf
*/
public function testIf($code, $result, $testName, $testNumber)
@@ -148,8 +148,8 @@ class CompileIfTest extends PHPUnit_Smarty
/**
* Test if nocache tags
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider dataTestIfNocache
*/
public function testIfNocache($var, $value, $code, $result, $testName, $testNumber, $file = null)
@@ -165,7 +165,7 @@ class CompileIfTest extends PHPUnit_Smarty
$this->smarty->assign($var, $value, true);
$this->smarty->assign($var . '2', $value);
$this->assertEquals($result, $this->strip($this->smarty->fetch('run_code_caching.tpl')),
- "testIfNocahe - {$code} - {$testName}");
+ "testIfNocache - {$code} - {$testName}");
}
/*
@@ -205,9 +205,9 @@ class CompileIfTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacing($code, $result, $testName, $testNumber)
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/Include/CompileIncludeTest.php b/tests/UnitTests/TemplateSource/TagTests/Include/CompileIncludeTest.php
index c9b1c154..8a7cb78e 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Include/CompileIncludeTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Include/CompileIncludeTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of the {include} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {include} tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class CompileIncludeTest extends PHPUnit_Smarty
{
@@ -31,8 +31,8 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* test spacing
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider includeProviderCaching
*/
public function testSpacing_001($merge, $caching, $text)
@@ -49,8 +49,8 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* test spacing
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider includeProviderCaching
*/
public function testSpacing_001V2($merge, $caching, $text)
@@ -67,8 +67,8 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* test spacing
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider includeProviderCaching
*/
public function testSpacing_001V3($merge, $caching, $text)
@@ -85,8 +85,8 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* test standard output
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider includeProvider
*/
public function testIncludeStandard_001($merge, $text)
@@ -100,8 +100,8 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* test standard output var
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider includeProvider
*/
public function testIncludeStandardNocacheVar($merge, $text)
@@ -117,8 +117,8 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* Test that assign attribute does not create standard output
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider includeProvider
*/
public function testIncludeAssign1($merge, $text)
@@ -131,8 +131,8 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* Test that assign attribute does load variable
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider includeProvider
*/
public function testIncludeAssign2($merge, $text)
@@ -145,8 +145,8 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* Test passing local vars eval
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider includeProvider
*/
public function testIncludePassVars($merge, $text)
@@ -160,8 +160,8 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* Test passing local vars include
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider includeProvider
*/
public function testIncludePassVars2($merge, $text)
@@ -177,8 +177,8 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* Test recursive includes
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider includeProvider
*/
public function testRecursiveIncludes1($merge, $text)
@@ -193,8 +193,8 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* Test recursive includes 2
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider includeProvider
*/
public function testRecursiveIncludes2($merge, $text)
@@ -244,9 +244,9 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* Test Include spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testIncludeSpacing($code, $result, $testName, $testNumber)
{
@@ -262,9 +262,9 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* Test Output spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testIncludeSpacingNocache($code, $result, $testName, $testNumber)
{
@@ -281,9 +281,9 @@ class CompileIncludeTest extends PHPUnit_Smarty
/**
* Test Output spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testIncludeSpacingNocache2($code, $result, $testName, $testNumber)
{
@@ -324,4 +324,11 @@ class CompileIncludeTest extends PHPUnit_Smarty
array("A{include file='include_spacing3.tpl'}B\nC", "AbarB\nC", '3_Newline3', $i++),
);
}
+
+ public function testModifierWrongPlace() {
+ $this->smarty->debugging = true;
+ $this->expectException(\Smarty\CompilerException::class);
+ $this->expectExceptionMessage('No modifiers allowed');
+ $this->smarty->fetch('include_with_modifier.tpl');
+ }
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/Include/templates/include_with_modifier.tpl b/tests/UnitTests/TemplateSource/TagTests/Include/templates/include_with_modifier.tpl
new file mode 100644
index 00000000..15dd825d
--- /dev/null
+++ b/tests/UnitTests/TemplateSource/TagTests/Include/templates/include_with_modifier.tpl
@@ -0,0 +1 @@
+{include|upper file="helloworld.tpl"} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/Insert/CompileInsertTest.php b/tests/UnitTests/TemplateSource/TagTests/Insert/CompileInsertTest.php
deleted file mode 100644
index e9a5328f..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Insert/CompileInsertTest.php
+++ /dev/null
@@ -1,269 +0,0 @@
-<?php
-/**
- * Smarty PHPunit tests compilation of the {insert} tag
- *
- * @package PHPunit
- * @author Uwe Tews
- */
-
-/**
- * class for {insert} tests
- *
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
- */
-class CompileInsertTest extends PHPUnit_Smarty
-{
- public function setUp(): void
- {
- $this->setUpSmarty(__DIR__);
- $this->smarty->addPluginsDir(__DIR__ . "/PHPunitplugins/");
- $this->smarty->enableSecurity();
- }
-
-
- public function testInit()
- {
- $this->cleanDirs();
- }
- /**
- * Test For
- *
- * @preserveGlobalState disabled
- * @dataProvider dataTestInsert
- * @runInSeparateProcess
- */
- public function testInsert($code, $result, $testName, $testNumber)
- {
- $name = empty($testName) ? $testNumber : $testName;
- $file = "Insert_{$name}.tpl";
- $this->makeTemplateFile($file, $code);
- $this->smarty->assign('variable', 'test');
- $this->smarty->setTemplateDir('./templates_tmp');
- $this->assertEquals($result,
- $this->smarty->fetch($file),
- $file);
- }
-
- /*
- * Data provider für testInsert
- */
- public function dataTestInsert()
- {
- $i = 1;
- /*
- * Code
- * result
- * test name
- * test number
- */
- return array(
- array('start {insert name=\'test\' foo=\'bar\'} end', 'start insert function parameter value bar end', 'T1', $i++),
- array('start {insert name="test" foo=\'bar\'} end', 'start insert function parameter value bar end', 'T2', $i++),
- array('start {insert name=$variable foo=\'bar\'} end', 'start insert function parameter value bar end', 'T3', $i++),
- array("start {insert name='test' foo='bar' assign=blar} end {\$blar}", 'start end insert function parameter value bar', 'T4', $i++),
- array("start {insert name='test' foo='bar' assign=blar} end", 'start end', 'T5', $i++),
- );
- }
-
-
-
-
- /**
- * test insert plugin
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- */
- public function testInsertPlugin1()
- {
- global $insertglobal;
- $insertglobal = 'global';
- $tpl = $this->smarty->createTemplate('insertplugintest.tpl');
- $tpl->assign('foo', 'bar');
- $this->assertEquals('param foo bar globalvar global', $this->smarty->fetch($tpl));
- }
- /**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * test insert plugin
- */
- public function testInsertPlugin2()
- {
- global $insertglobal;
- $insertglobal = 'global 2';
- $tpl = $this->smarty->createTemplate('insertplugintest.tpl');
- $tpl->assign('foo', 'buh');
- $this->assertEquals('param foo buh globalvar global 2', $this->smarty->fetch($tpl));
- }
-
- /**
- * test insert plugin caching
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- */
- public function testInsertPluginCaching1_1()
- {
- global $insertglobal;
- $insertglobal = 'global';
- $this->smarty->caching = true;
- $tpl = $this->smarty->createTemplate('insertplugintest.tpl');
- $tpl->assign('foo', 'bar', true);
- $this->assertEquals('param foo bar globalvar global', $this->smarty->fetch($tpl));
- }
-
- /**
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
- */
- public function testInsertPluginCaching1_2()
- {
- $this->smarty->addPluginsDir(__DIR__ . "/PHPunitplugins/");
- global $insertglobal;
- $insertglobal = 'changed global 2';
- $this->smarty->caching = 1;
- $tpl = $this->smarty->createTemplate('insertplugintest.tpl');
- $tpl->assign('foo', 'buh', true);
-// $this->assertTrue($tpl->isCached());
- $this->assertEquals('param foo buh globalvar changed global 2', $this->smarty->fetch($tpl));
- }
-
- /**
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
- */
- public function testInsertPluginCaching1_3()
- {
- $this->smarty->addPluginsDir(__DIR__ . "/PHPunitplugins/");
- global $insertglobal;
- $insertglobal = 'changed global';
- $this->smarty->caching = 1;
-// $this->smarty->setForceCompile(true);
- $this->smarty->assign('foo', 'bar', true);
- $this->assertEquals('param foo bar globalvar changed global', $this->smarty->fetch('insertplugintest.tpl'));
- }
-
- /**
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- *
- */
- public function testInsertPluginCaching1_4()
- {
- global $insertglobal;
- $this->smarty->addPluginsDir(__DIR__ . "/PHPunitplugins/");
- $insertglobal = 'changed global 4';
- $this->smarty->caching = 1;
- $this->smarty->assign('foo', 'buh', true);
- $this->assertTrue($this->smarty->isCached('insertplugintest.tpl'));
- $this->assertEquals('param foo buh globalvar changed global 4', $this->smarty->fetch('insertplugintest.tpl'));
- }
- /**
- * test insert plugin caching 2
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- */
- public function testInsertPluginCaching2_1()
- {
- global $insertglobal;
- $insertglobal = 'global';
- $this->smarty->caching = true;
- $this->smarty->compile_id = 1;
- $tpl = $this->smarty->createTemplate('insertplugintest.tpl');
- $tpl->assign('foo', 'bar');
- $this->assertEquals('param foo bar globalvar global', $this->smarty->fetch($tpl));
- }
-
- /**
- * test insert plugin caching 2
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- */
- public function testInsertPluginCaching2_2()
- {
- global $insertglobal;
- $insertglobal = 'global 2';
- $this->smarty->caching = true;
- $this->smarty->compile_id = 1;
- $tpl = $this->smarty->createTemplate('insertplugintest.tpl');
- $tpl->assign('foo', 'buh');
- $this->assertStringContainsString('param foo bar globalvar global 2', $this->smarty->fetch($tpl));
- }
- /**
- * test insert plugin caching 3
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- */
- public function testInsertPluginCaching3_1()
- {
- $this->smarty->caching = true;
- $this->smarty->assign('insert',$t=time());
- $this->assertStringContainsString($t.'Inner template', $this->smarty->fetch('insertplugintest2.tpl'));
- }
-
- /**
- * test insert plugin caching 2
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @group slow
- */
- public function testInsertPluginCaching3_2()
- {
- sleep(2);
- $this->smarty->caching = true;
- $this->smarty->assign('insert',$t=time());
- $this->assertStringContainsString($t.'Inner template', $this->smarty->fetch('insertplugintest2.tpl'));
- }
-
-
- /**
- * test inserted function none existing function
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- */
- public function testInsertFunctionNoneExistingFunction()
- {
- $tpl = $this->smarty->createTemplate("eval:start {insert name='mustfail' foo='bar' assign=blar} end {\$blar}");
- try {
- $this->smarty->fetch($tpl);
- }
- catch (Exception $e) {
- $this->assertStringContainsString("{insert} no function or plugin found for 'mustfail'", $e->getMessage());
-
- return;
- }
- $this->fail('Exception for "function is not callable" has not been raised.');
- }
-
- /**
- * test inserted function none existing script
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- */
- public function testInsertFunctionNoneExistingScript()
- {
- $tpl = $this->smarty->createTemplate("eval:{insert name='mustfail' foo='bar' script='nofile.php'}");
- try {
- $this->smarty->fetch($tpl);
- }
- catch (Exception $e) {
- $this->assertStringContainsString('missing script file', $e->getMessage());
-
- return;
- }
- $this->fail('Exception for "missing file" has not been raised.');
- }
-}
-
-/**
- * test function
- */
-function insert_test($params, $template)
-{
- return "insert function parameter value $params[foo]";
-}
diff --git a/tests/UnitTests/TemplateSource/TagTests/Insert/PHPunitplugins/insert.insertplugintest.php b/tests/UnitTests/TemplateSource/TagTests/Insert/PHPunitplugins/insert.insertplugintest.php
deleted file mode 100644
index cd2e27cd..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Insert/PHPunitplugins/insert.insertplugintest.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-function smarty_insert_insertplugintest($params, $template)
-{
- global $insertglobal;
-
- return 'param foo ' . $params['foo'] . ' globalvar ' . $insertglobal;
-}
diff --git a/tests/UnitTests/TemplateSource/TagTests/Insert/PHPunitplugins/insert.test2.php b/tests/UnitTests/TemplateSource/TagTests/Insert/PHPunitplugins/insert.test2.php
deleted file mode 100644
index 75f3ccb8..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Insert/PHPunitplugins/insert.test2.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-function smarty_insert_test2($params, $smarty) {
-
- return $smarty->tpl_vars[$params['var']]->value;
-}
diff --git a/tests/UnitTests/TemplateSource/TagTests/Insert/cache/.gitignore b/tests/UnitTests/TemplateSource/TagTests/Insert/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Insert/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/TemplateSource/TagTests/Insert/templates/inner.tpl b/tests/UnitTests/TemplateSource/TagTests/Insert/templates/inner.tpl
deleted file mode 100644
index e5f67304..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Insert/templates/inner.tpl
+++ /dev/null
@@ -1 +0,0 @@
-Inner template
diff --git a/tests/UnitTests/TemplateSource/TagTests/Insert/templates/insertplugintest.tpl b/tests/UnitTests/TemplateSource/TagTests/Insert/templates/insertplugintest.tpl
deleted file mode 100644
index 579f2548..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Insert/templates/insertplugintest.tpl
+++ /dev/null
@@ -1 +0,0 @@
-{insert name='insertplugintest' foo=$foo} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/Insert/templates/insertplugintest2.tpl b/tests/UnitTests/TemplateSource/TagTests/Insert/templates/insertplugintest2.tpl
deleted file mode 100644
index a1834ab0..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Insert/templates/insertplugintest2.tpl
+++ /dev/null
@@ -1,2 +0,0 @@
-{insert name='test2' var='insert'}
-{include 'inner.tpl'} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/Insert/templates_c/.gitignore b/tests/UnitTests/TemplateSource/TagTests/Insert/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Insert/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/TemplateSource/TagTests/Insert/templates_tmp/.gitignore b/tests/UnitTests/TemplateSource/TagTests/Insert/templates_tmp/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/Insert/templates_tmp/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/TemplateSource/TagTests/Literal/LiteralTest.php b/tests/UnitTests/TemplateSource/TagTests/Literal/LiteralTest.php
index 64c9432c..b71ed781 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Literal/LiteralTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Literal/LiteralTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests appendByRef method
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for appendByRef tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class LiteralTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/CompileMakeNocacheTest.php b/tests/UnitTests/TemplateSource/TagTests/MakeNocache/CompileMakeNocacheTest.php
deleted file mode 100644
index ca520b9c..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/CompileMakeNocacheTest.php
+++ /dev/null
@@ -1,309 +0,0 @@
-<?php
-/**
- * Smarty PHPunit tests compilation of {make_nocache} tags
- *
- * @package PHPunit
- * @author Uwe Tews
- */
-
-/**
- * class for {make_nocache} tags tests
- *
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
- */
-class CompileMakeNocacheTest extends PHPUnit_Smarty
-{
- public function setUp(): void
- {
- $this->setUpSmarty(__DIR__);
- $this->smarty->addPluginsDir("../../../__shared/PHPunitplugins/");
- $this->smarty->addTemplateDir("../../../__shared/templates/");
- $this->smarty->addTemplateDir("./templates_tmp");
- }
-
- public function testInit()
- {
- $this->cleanDirs();
- }
-
- /**
- * Test {make_nocache} tags caching disabled
- *
- * @not runInSeparateProcess
- * @preserveGlobalState disabled
- * @dataProvider dataTestMakeNocache001
- */
- public function testMakeNocache_001($foo, $result)
- {
- if ($foo) {
- $this->smarty->assign('foo', $foo);
- }
- $this->assertEquals($result, $this->smarty->fetch('001_test_foo.tpl'),
- "foo = {$foo}");
- }
-
- /*
- * Data provider für testMakeNocache_001
- */
- public function dataTestMakeNocache001()
- {
-
- /*
- * $foo
- * result
- *
- */
- return array(array(1, '#001_test_foo.tpl:$foo =1'), array(2, '#001_test_foo.tpl:$foo =2'),
- array(null, '#001_test_foo.tpl:$foo =>unassigned<'),);
- }
-
- /**
- * Test {make_nocache} cached tags
- *
- * @not runInSeparateProcess
- * @preserveGlobalState disabled
- * @dataProvider dataTestMakeNocache001_1
- */
- public function testMakeNocache_001_1($foo, $result)
- {
- $this->smarty->setCaching(true);
- if ($foo) {
- $this->smarty->assign('foo', $foo);
- }
- $this->assertEquals($result, $this->smarty->fetch('001_test_foo.tpl'),
- "foo = {$foo}");
- }
-
- /*
- * Data provider für testMakeNocache_001_1
- */
- public function dataTestMakeNocache001_1()
- {
-
- /*
- * $foo
- * result
- *
- */
- return array(array(1, '#001_test_foo.tpl:$foo =1'), array(2, '#001_test_foo.tpl:$foo =1'),
- array(null, '#001_test_foo.tpl:$foo =1'),);
- }
-
- /**
- * Test {make_nocache} cached tags existing nocahe variable
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @dataProvider dataTestMakeNocache001_2
- */
- public function testMakeNocache_001_2($foo, $result)
- {
- $this->smarty->setCaching(true);
- if ($foo) {
- $this->smarty->assign('foo', $foo, true);
- }
- $this->assertEquals($result, $this->smarty->fetch('001_test_foo.tpl'),
- "foo = {$foo}");
- }
-
- /*
- * Data provider für testMakeNocache_001_2
- */
- public function dataTestMakeNocache001_2()
- {
-
- /*
- * $foo
- * result
- *
- */
- return array(array(1, '#001_test_foo.tpl:$foo =1'), array(2, '#001_test_foo.tpl:$foo =2'),
- array(null, '#001_test_foo.tpl:$foo =1'),);
- }
-
- /**
- * Test {make_nocache} cached tags reassign
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @dataProvider dataTestMakeNocache001_3
- */
- public function testMakeNocache_001_3($foo, $result)
- {
- $this->smarty->setCaching(true);
- if ($foo) {
- $this->smarty->assign('foo', $foo);
- }
- $this->smarty->assign('bar', $foo + 4, true);
- $this->assertEquals($result, $this->smarty->fetch('001_test_foo_assign.tpl'),
- "foo = {$foo}");
- }
-
- /*
- * Data provider für testMakeNocache_001_3
- */
- public function dataTestMakeNocache001_3()
- {
-
- /*
- * $foo
- * result
- *
- */
- return array(array(1, '#001_test_foo_assign.tpl:$foo =5'), array(2, '#001_test_foo_assign.tpl:$foo =6'),
- array(null, '#001_test_foo_assign.tpl:$foo =4'),);
- }
-
- /**
- * Test {make_nocache} cached tags {if}
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @dataProvider dataTestMakeNocache001_4
- */
- public function testMakeNocache_001_4($foo, $bar, $result)
- {
- $this->smarty->setCaching(true);
- $this->smarty->assign('foo', $foo);
- $this->smarty->assign('bar', $bar);
- $this->assertEquals($result, $this->smarty->fetch('001_test_foo_if.tpl'),
- "foo = {$foo}");
- }
-
- /*
- * Data provider für testMakeNocache_001_4
- */
- public function dataTestMakeNocache001_4()
- {
- /*
- * $foo
- * $bar
- * result
- *
- */
- return array(array(10, 9, 'greater'), array(9, 10, 'greater'),);
- }
-
- /**
- * Test {make_nocache} cached tags {if} nocache
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @dataProvider dataTestMakeNocache001_5
- */
- public function testMakeNocache_001_5($foo, $bar, $result)
- {
- $this->smarty->setCaching(true);
- $this->smarty->compile_id = 1;
- if ($foo) {
- $this->smarty->assign('foo', $foo);
- }
- $this->smarty->assign('bar', $bar, true);
- $this->assertEquals($result, $this->smarty->fetch('001_test_foo_if.tpl'),
- "foo = {$foo}");
- }
-
- /*
- * Data provider für testMakeNocache_001_5
- */
- public function dataTestMakeNocache001_5()
- {
- /*
- * $foo
- * $bar
- * result
- *
- */
- return array(array(10, 9, 'greater'), array(9, 10, 'not greater'), array(null, 11, 'not greater'),
- array(null, 2, 'greater'),);
- }
-
- /**
- * Test {make_nocache} cached tags {foreach}
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @dataProvider dataTestMakeNocache001_6
- */
- public function testMakeNocache_001_6($foo, $bar, $result)
- {
- $this->smarty->setCaching(true);
- $this->smarty->assign('foo', $foo, true);
- $this->smarty->assign('bar', $bar);
- $this->assertEquals($result, $this->smarty->fetch('001_test_foo_foreach.tpl'),
- "foo = {$foo}");
- }
-
- /*
- * Data provider für testMakeNocache_001_6
- */
- public function dataTestMakeNocache001_6()
- {
-
- /*
- * $foo
- * $bar
- * result
- *
- */
- return array(array(2, array(1, 2, 3, 4), ' 1 2match 3 4'), array(3, array(7, 8, 9), ' 1 2 3match 4'),);
- }
-
- /**
- * Test {make_nocache} cached tags {foreach} nocache
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
- * @dataProvider dataTestMakeNocache001_7
- */
- public function testMakeNocache_001_7($foo, $bar, $result)
- {
- $this->smarty->setCaching(true);
- $this->smarty->compile_id = 1;
- $this->smarty->assign('foo', $foo, true);
- $this->smarty->assign('bar', $bar, true);
- $this->assertEquals($result, $this->smarty->fetch('001_test_foo_foreach.tpl'),
- "foo = {$foo}");
- }
-
- /*
- * Data provider für testMakeNocache_001_7
- */
- public function dataTestMakeNocache001_7()
- {
-
- /*
- * $foo
- * $bar
- * result
- *
- */
- return array(array(2, array(1, 2, 3, 4), ' 1 2match 3 4'), array(7, array(7, 8, 9), ' 7match 8 9'),);
- }
- /**
- * Test {make_nocache} with values containing '\'
- *
- * @preserveGlobalState disabled
- */
- public function testMakeNocache_002()
- {
- $this->smarty->setCaching(true);
- $this->smarty->assign('foo', 'uwe\'s');
- $this->assertEquals($this->strip('uwe\'s'), $this->smarty->fetch('002_test_backslash.tpl'));
- }
-
- /**
- * Test {make_nocache} with values containing spaces
- *
- * @preserveGlobalState disabled
- */
- public function testMakeNocache_003()
- {
- $this->smarty->setCaching(true);
- $this->smarty->assign('foo', 'the Smarty template engine');
- $this->assertEquals('the Smarty template engine', $this->smarty->fetch('003_test_spaces.tpl'));
- }
-
-}
diff --git a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/cache/.gitignore b/tests/UnitTests/TemplateSource/TagTests/MakeNocache/cache/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/cache/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo.tpl b/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo.tpl
deleted file mode 100644
index 4253b8dd..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo.tpl
+++ /dev/null
@@ -1 +0,0 @@
-{make_nocache $foo}{checkvar var=foo types='template' nocache} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_assign.tpl b/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_assign.tpl
deleted file mode 100644
index 7042daf3..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_assign.tpl
+++ /dev/null
@@ -1 +0,0 @@
-{make_nocache $foo}{$foo=$bar nocache}{checkvar var=foo types='template' nocache} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_foreach.tpl b/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_foreach.tpl
deleted file mode 100644
index 326fa569..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_foreach.tpl
+++ /dev/null
@@ -1,3 +0,0 @@
-{foreach $bar as $i}
- {$i}{make_nocache $i}{if $i == $foo}match{/if}
-{/foreach} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_if.tpl b/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_if.tpl
deleted file mode 100644
index fe2c88e1..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/001_test_foo_if.tpl
+++ /dev/null
@@ -1 +0,0 @@
-{make_nocache $foo}{if $foo > $bar}greater{else}not greater{/if} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/002_test_backslash.tpl b/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/002_test_backslash.tpl
deleted file mode 100644
index ab21fba8..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/002_test_backslash.tpl
+++ /dev/null
@@ -1 +0,0 @@
-{make_nocache $foo}{$foo nocache} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/003_test_spaces.tpl b/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/003_test_spaces.tpl
deleted file mode 100644
index ab21fba8..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates/003_test_spaces.tpl
+++ /dev/null
@@ -1 +0,0 @@
-{make_nocache $foo}{$foo nocache} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates_c/.gitignore b/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates_c/.gitignore
deleted file mode 100644
index d88cc144..00000000
--- a/tests/UnitTests/TemplateSource/TagTests/MakeNocache/templates_c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore anything in here, but keep this directory
-*
diff --git a/tests/UnitTests/TemplateSource/TagTests/Nocache/CompileNocacheTest.php b/tests/UnitTests/TemplateSource/TagTests/Nocache/CompileNocacheTest.php
index 5aea12b2..9efd5329 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Nocache/CompileNocacheTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Nocache/CompileNocacheTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of {nocache} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {nocache} tag tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class CompileNocacheTest extends PHPUnit_Smarty
{
@@ -59,8 +59,8 @@ class CompileNocacheTest extends PHPUnit_Smarty
/**
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*
*/
public function testNocacheCachingYes2()
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginBlock/PluginBlockTextformatTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginBlock/PluginBlockTextformatTest.php
index 854d2b4a..d6dc3cd6 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginBlock/PluginBlockTextformatTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginBlock/PluginBlockTextformatTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginBlockTextformatTest extends PHPUnit_Smarty
{
@@ -22,20 +22,16 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
$this->setUpSmarty(__DIR__);
}
- public function testDefault()
- {
- $result = "This is foo. This is foo. This is foo.\nThis is foo. This is foo. This is foo.\n\nThis is bar.\n\nbar foo bar foo foo. bar foo bar foo\nfoo. bar foo bar foo foo. bar foo bar\nfoo foo. bar foo bar foo foo. bar foo\nbar foo foo. bar foo bar foo foo.\n\n";
- $tpl = $this->smarty->createTemplate('string:{textformat wrap=40}' . $this->string . '{/textformat}');
- $this->assertEquals($result, $this->smarty->fetch($tpl));
- }
+ public function testInit()
+ {
+ $this->cleanDirs();
+ }
- public function testDefaultWithoutMbstring()
+ public function testDefault()
{
- Smarty::$_MBSTRING = false;
$result = "This is foo. This is foo. This is foo.\nThis is foo. This is foo. This is foo.\n\nThis is bar.\n\nbar foo bar foo foo. bar foo bar foo\nfoo. bar foo bar foo foo. bar foo bar\nfoo foo. bar foo bar foo foo. bar foo\nbar foo foo. bar foo bar foo foo.\n\n";
$tpl = $this->smarty->createTemplate('string:{textformat wrap=40}' . $this->string . '{/textformat}');
$this->assertEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
}
public function testIndent()
@@ -45,15 +41,6 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
$this->assertEquals($result, $this->smarty->fetch($tpl));
}
- public function testIndentWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = " This is foo. This is foo. This is\n foo. This is foo. This is foo. This\n is foo.\n\n This is bar.\n\n bar foo bar foo foo. bar foo bar foo\n foo. bar foo bar foo foo. bar foo\n bar foo foo. bar foo bar foo foo.\n bar foo bar foo foo. bar foo bar foo\n foo.\n\n";
- $tpl = $this->smarty->createTemplate('string:{textformat wrap=40 indent=4}' . $this->string . '{/textformat}');
- $this->assertEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testIndentFirst()
{
$result = " This is foo. This is foo. This\n is foo. This is foo. This is foo.\n This is foo.\n\n This is bar.\n\n bar foo bar foo foo. bar foo bar\n foo foo. bar foo bar foo foo. bar\n foo bar foo foo. bar foo bar foo\n foo. bar foo bar foo foo. bar foo\n bar foo foo.\n\n";
@@ -61,15 +48,6 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
$this->assertEquals($result, $this->smarty->fetch($tpl));
}
- public function testIndentFirstWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = " This is foo. This is foo. This\n is foo. This is foo. This is foo.\n This is foo.\n\n This is bar.\n\n bar foo bar foo foo. bar foo bar\n foo foo. bar foo bar foo foo. bar\n foo bar foo foo. bar foo bar foo\n foo. bar foo bar foo foo. bar foo\n bar foo foo.\n\n";
- $tpl = $this->smarty->createTemplate('string:{textformat wrap=40 indent=4 indent_first=4}' . $this->string . '{/textformat}');
- $this->assertEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testIndentchar()
{
$result = "####This is foo. This is foo. This is\n####foo. This is foo. This is foo. This\n####is foo.\n\n####This is bar.\n\n####bar foo bar foo foo. bar foo bar foo\n####foo. bar foo bar foo foo. bar foo\n####bar foo foo. bar foo bar foo foo.\n####bar foo bar foo foo. bar foo bar foo\n####foo.\n\n";
@@ -77,15 +55,6 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
$this->assertEquals($result, $this->smarty->fetch($tpl));
}
- public function testIndentcharWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = "####This is foo. This is foo. This is\n####foo. This is foo. This is foo. This\n####is foo.\n\n####This is bar.\n\n####bar foo bar foo foo. bar foo bar foo\n####foo. bar foo bar foo foo. bar foo\n####bar foo foo. bar foo bar foo foo.\n####bar foo bar foo foo. bar foo bar foo\n####foo.\n\n";
- $tpl = $this->smarty->createTemplate('string:{textformat wrap=40 indent=4 indent_char="#"}' . $this->string . '{/textformat}');
- $this->assertEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testIndentcharFirst()
{
$result = "########This is foo. This is foo. This\n####is foo. This is foo. This is foo.\n####This is foo.\n\n########This is bar.\n\n########bar foo bar foo foo. bar foo bar\n####foo foo. bar foo bar foo foo. bar\n####foo bar foo foo. bar foo bar foo\n####foo. bar foo bar foo foo. bar foo\n####bar foo foo.\n\n";
@@ -93,15 +62,6 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
$this->assertEquals($result, $this->smarty->fetch($tpl));
}
- public function testIndentcharFirstWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = "########This is foo. This is foo. This\n####is foo. This is foo. This is foo.\n####This is foo.\n\n########This is bar.\n\n########bar foo bar foo foo. bar foo bar\n####foo foo. bar foo bar foo foo. bar\n####foo bar foo foo. bar foo bar foo\n####foo. bar foo bar foo foo. bar foo\n####bar foo foo.\n\n";
- $tpl = $this->smarty->createTemplate('string:{textformat wrap=40 indent=4 indent_first=4 indent_char="#"}' . $this->string . '{/textformat}');
- $this->assertEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testWrapchar()
{
$result = " This is foo. This is foo. This is#foo. This is foo. This is foo. This#is foo.## This is bar.## bar foo bar foo foo. bar foo bar foo#foo. bar foo bar foo foo. bar foo#bar foo foo. bar foo bar foo foo.#bar foo bar foo foo. bar foo bar foo#foo.##";
@@ -109,15 +69,6 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
$this->assertEquals($result, $this->smarty->fetch($tpl));
}
- public function testWrapcharWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = " This is foo. This is foo. This is#foo. This is foo. This is foo. This#is foo.## This is bar.## bar foo bar foo foo. bar foo bar foo#foo. bar foo bar foo foo. bar foo#bar foo foo. bar foo bar foo foo.#bar foo bar foo foo. bar foo bar foo#foo.##";
- $tpl = $this->smarty->createTemplate('string:{textformat wrap=40 indent=4 wrap_char="#"}' . $this->string . '{/textformat}');
- $this->assertEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testStyleEmail()
{
$result = "This is foo. This is foo. This is foo. This is foo. This is foo. This is\nfoo.\n\nThis is bar.\n\nbar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo\nbar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo\nfoo.\n\n";
@@ -125,12 +76,4 @@ class PluginBlockTextformatTest extends PHPUnit_Smarty
$this->assertEquals($result, $this->smarty->fetch($tpl));
}
- public function testStyleEmailWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = "This is foo. This is foo. This is foo. This is foo. This is foo. This is\nfoo.\n\nThis is bar.\n\nbar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo\nbar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo\nfoo.\n\n";
- $tpl = $this->smarty->createTemplate('string:{textformat style="email"}' . $this->string . '{/textformat}');
- $this->assertEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/CountTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/CountTest.php
new file mode 100644
index 00000000..b4e78c48
--- /dev/null
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/CountTest.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace UnitTests\TemplateSource\TagTests\PluginFunction;
+class CountTest extends \PHPUnit_Smarty {
+
+ public function setUp(): void {
+ $this->setUpSmarty(__DIR__);
+ }
+
+ public function testBasicSyntax() {
+ $this->assertEquals('3', $this->smarty->fetch("string:{count([1,2,3])}"));
+ }
+
+ public function testNonRecursive() {
+ $this->assertEquals('3', $this->smarty->fetch("string:{count([1,2,[3,4]])}"));
+ }
+
+ public function testRecursive() {
+ $this->assertEquals('5', $this->smarty->fetch("string:{count([1,2,[3,4]], 1)}"));
+ }
+
+ public function testInvalidParameters() {
+ $this->expectException(\Smarty\Exception::class);
+ $this->expectExceptionMessage('Invalid number of arguments');
+ $this->assertEquals("", $this->smarty->fetch("string:{count()}"));
+ }
+
+} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/EmptyTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/EmptyTest.php
new file mode 100644
index 00000000..34a56eb3
--- /dev/null
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/EmptyTest.php
@@ -0,0 +1,44 @@
+<?php
+
+namespace UnitTests\TemplateSource\TagTests\PluginFunction;
+class EmptyTest extends \PHPUnit_Smarty {
+
+ public function setUp(): void {
+ $this->setUpSmarty(__DIR__);
+ }
+
+ public function testBasicSyntax() {
+ $this->assertEquals("yay", $this->smarty->fetch("string:{if empty(\$noSuch)}yay{/if}"));
+ }
+
+ public function testEmptyStringIsEmpty() {
+ $this->assertEquals("yay", $this->smarty->fetch("string:{if empty('')}yay{/if}"));
+ }
+
+ public function testFalseIsEmpty() {
+ $this->smarty->assign('test', false);
+ $this->assertEquals("yay", $this->smarty->fetch("string:{if empty(\$test)}yay{/if}"));
+ }
+
+ public function testIntZeroIsEmpty() {
+ $this->smarty->assign('test', 0);
+ $this->assertEquals("yay", $this->smarty->fetch("string:{if empty(\$test)}yay{/if}"));
+ }
+
+ public function testStringZeroIsEmpty() {
+ $this->smarty->assign('test', '0');
+ $this->assertEquals("yay", $this->smarty->fetch("string:{if empty(\$test)}yay{/if}"));
+ }
+
+ public function testIntThreeIsNotEmpty() {
+ $this->smarty->assign('test', 3);
+ $this->assertEquals("nay", $this->smarty->fetch("string:{if empty(\$test)}yay{else}nay{/if}"));
+ }
+
+ public function testInvalidParameters() {
+ $this->expectException(\Smarty\CompilerException::class);
+ $this->expectExceptionMessage('Invalid number of arguments');
+ $this->assertEquals("", $this->smarty->fetch("string:{empty(3, 'foo')}"));
+ }
+
+} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/InArrayTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/InArrayTest.php
new file mode 100644
index 00000000..b27c2585
--- /dev/null
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/InArrayTest.php
@@ -0,0 +1,27 @@
+<?php
+
+class InArrayTest extends \PHPUnit_Smarty {
+
+ public function setUp(): void
+ {
+ $this->setUpSmarty(__DIR__);
+ }
+
+ public function testBasicSyntax()
+ {
+ $this->assertEquals("yay", $this->smarty->fetch("string:{if in_array(3,[3])}yay{/if}"));
+ }
+
+ public function testNotInArray()
+ {
+ $this->assertEquals("nay", $this->smarty->fetch("string:{if in_array(2,[3])}yay{else}nay{/if}"));
+ }
+
+ public function testInvalidParameters()
+ {
+ $this->expectException(\Smarty\Exception::class);
+ $this->expectExceptionMessage('Invalid number of arguments');
+ $this->assertEquals("", $this->smarty->fetch("string:{in_array('foo')}"));
+ }
+
+} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/IsArrayTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/IsArrayTest.php
new file mode 100644
index 00000000..65731d27
--- /dev/null
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/IsArrayTest.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace UnitTests\TemplateSource\TagTests\PluginFunction;
+class IsArrayTest extends \PHPUnit_Smarty {
+
+ public function setUp(): void {
+ $this->setUpSmarty(__DIR__);
+ }
+
+ public function testBasicSyntax() {
+ $this->assertEquals("yay", $this->smarty->fetch("string:{if is_array([3])}yay{/if}"));
+ }
+
+ public function testIntNotIsArray() {
+ $this->assertEquals("nay", $this->smarty->fetch("string:{if is_array(2)}yay{else}nay{/if}"));
+ }
+
+ public function testStringNotIsArray() {
+ $this->assertEquals("nay", $this->smarty->fetch("string:{if is_array('foo')}yay{else}nay{/if}"));
+ }
+
+ public function testInvalidParameters() {
+ $this->expectException(\Smarty\Exception::class);
+ $this->expectExceptionMessage('Invalid number of arguments');
+ $this->assertEquals("", $this->smarty->fetch("string:{is_array(3, 'foo')}"));
+ }
+
+} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/IssetTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/IssetTest.php
new file mode 100644
index 00000000..a54b244a
--- /dev/null
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/IssetTest.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace UnitTests\TemplateSource\TagTests\PluginFunction;
+class IssetTest extends \PHPUnit_Smarty {
+
+ public function setUp(): void {
+ $this->setUpSmarty(__DIR__);
+ }
+
+ public function testBasicSyntax() {
+ $this->assertEquals("nay", $this->smarty->fetch("string:{if isset(\$noSuch)}yay{else}nay{/if}"));
+ }
+
+ public function testEmptyStringIsset() {
+ $this->assertEquals("yay", $this->smarty->fetch("string:{if isset('')}yay{/if}"));
+ }
+
+ public function testFalseIsset() {
+ $this->smarty->assign('test', false);
+ $this->assertEquals("yay", $this->smarty->fetch("string:{if isset(\$test)}yay{/if}"));
+ }
+
+ public function testIntZeroIsset() {
+ $this->smarty->assign('test', 0);
+ $this->assertEquals("yay", $this->smarty->fetch("string:{if isset(\$test)}yay{/if}"));
+ }
+
+ public function testMultivar() {
+ $this->smarty->assign('test', 0);
+ $this->smarty->assign('test2', 'pizza');
+ $this->assertEquals("yay", $this->smarty->fetch("string:{if isset(\$test, \$test2)}yay{/if}"));
+ }
+
+ public function testMultivarOneNotset() {
+ $this->smarty->assign('test', 0);
+ $this->assertEquals("nay", $this->smarty->fetch("string:{if isset(\$test, \$test2)}yay{else}nay{/if}"));
+ }
+
+ public function testInvalidParameters() {
+ $this->expectException(\Smarty\CompilerException::class);
+ $this->expectExceptionMessage('Invalid number of arguments');
+ $this->assertEquals("", $this->smarty->fetch("string:{if isset()}blurp{/if}"));
+ }
+
+} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionFetchTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionFetchTest.php
index 13e9f3a3..bece9d6d 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionFetchTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionFetchTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginFunctionFetchTest extends PHPUnit_Smarty
{
@@ -29,8 +29,8 @@ class PluginFunctionFetchTest extends PHPUnit_Smarty
/**
* test {fetch} from UIR
*
-* @runInSeparateProcess
-* @preserveGlobalState disabled
+*
+*
*/
public function testFetchUri()
{
@@ -40,12 +40,12 @@ class PluginFunctionFetchTest extends PHPUnit_Smarty
/**
* test {fetch} invalid uri
*
-* @runInSeparateProcess
-* @preserveGlobalState disabled
+*
+*
*/
public function testFetchInvalidUri()
{
- $this->expectException('SmartyException');
+ $this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage('{fetch} cannot read resource \'https://foo.smarty.net/foo.dat\'');
$this->smarty->fetch('string:{fetch file="https://foo.smarty.net/foo.dat"}');
}
@@ -54,11 +54,11 @@ class PluginFunctionFetchTest extends PHPUnit_Smarty
* test {fetch file=...} access to file from path not aloo/wed by security settings
*
* @run InSeparateProcess
- * @preserveGlobalState disabled
+ *
*/
public function testFetchSecurity()
{
- $this->expectException('SmartyException');
+ $this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage('not trusted file path');
$this->cleanDirs();
$dir=$this->smarty->getTemplateDir();
@@ -69,11 +69,11 @@ class PluginFunctionFetchTest extends PHPUnit_Smarty
* test {fetch file=...} access to file from path not aloo/wed by security settings
*
* @run InSeparateProcess
- * @preserveGlobalState disabled
+ *
*/
public function testFetchSecurity2()
{
- $this->expectException('SmartyException');
+ $this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage('not trusted file path');
$this->cleanDirs();
$this->smarty->getTemplateDir();
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlCheckboxesTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlCheckboxesTest.php
index 7deb4df7..0bf8b51e 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlCheckboxesTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlCheckboxesTest.php
@@ -2,7 +2,7 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
@@ -11,9 +11,9 @@ require_once(__DIR__ . '/helpers/_object_tostring.php');
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginFunctionHtmlCheckboxesTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlOptionsTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlOptionsTest.php
index 7520f87c..36b33dd1 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlOptionsTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlOptionsTest.php
@@ -2,7 +2,7 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
@@ -11,9 +11,9 @@ require_once(__DIR__ . '/helpers/_object_tostring.php');
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginFunctionHtmlOptionsTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlRadiosTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlRadiosTest.php
index ac9046ba..dc05456b 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlRadiosTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlRadiosTest.php
@@ -2,7 +2,7 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
@@ -10,9 +10,9 @@ require_once(__DIR__ . '/helpers/_object_tostring.php');
/**
* class for modifier tests
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginFunctionHtmlRadiosTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectDateTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectDateTest.php
index 633a1c81..f48dc8a0 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectDateTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectDateTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginFunctionHtmlSelectDateTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectTimeTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectTimeTest.php
index 1077b599..d13862d7 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectTimeTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectTimeTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginFunctionHtmlSelectTimeTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionMailtoTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionMailtoTest.php
index 792142c6..db3430b6 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionMailtoTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionMailtoTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginFunctionMailtoTest extends PHPUnit_Smarty
{
@@ -27,15 +27,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testDefaultWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = '<a href="mailto:me@example.com" >me@example.com</a>';
- $tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com"}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testText()
{
$result = '<a href="mailto:me@example.com" >send me some mail</a>';
@@ -43,47 +34,20 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testTextWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = '<a href="mailto:me@example.com" >send me some mail</a>';
- $tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" text="send me some mail"}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testEncodeJavascript()
{
- $result = '<script type="text/javascript">document.write(unescape(\'%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%22%20%3e%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%3c%2f%61%3e\'))</script>';
+ $result = '<script>document.write(unescape(\'%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%22%20%3e%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%3c%2f%61%3e\'))</script>';
$tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" encode="javascript"}');
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testEncodeJavascriptWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = '<script type="text/javascript">document.write(unescape(\'%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%22%20%3e%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%3c%2f%61%3e\'))</script>';
- $tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" encode="javascript"}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testEncodeJavascriptCharcode()
{
- $result = '<script type="text/javascript">document.write(String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,109,101,64,101,120,97,109,112,108,101,46,99,111,109,34,32,62,109,101,64,101,120,97,109,112,108,101,46,99,111,109,60,47,97,62))</script>';
+ $result = '<script>document.write(String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,109,101,64,101,120,97,109,112,108,101,46,99,111,109,34,32,62,109,101,64,101,120,97,109,112,108,101,46,99,111,109,60,47,97,62))</script>';
$tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" encode="javascript_charcode"}');
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testEncodeJavascriptCharcodeWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = '<script type="text/javascript">document.write(String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,109,101,64,101,120,97,109,112,108,101,46,99,111,109,34,32,62,109,101,64,101,120,97,109,112,108,101,46,99,111,109,60,47,97,62))</script>';
- $tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" encode="javascript_charcode"}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testEncodeHex()
{
$result = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;%6d%65@%65%78%61%6d%70%6c%65.%63%6f%6d" >&#x6d;&#x65;&#x40;&#x65;&#x78;&#x61;&#x6d;&#x70;&#x6c;&#x65;&#x2e;&#x63;&#x6f;&#x6d;</a>';
@@ -91,15 +55,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testEncodeHexWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;%6d%65@%65%78%61%6d%70%6c%65.%63%6f%6d" >&#x6d;&#x65;&#x40;&#x65;&#x78;&#x61;&#x6d;&#x70;&#x6c;&#x65;&#x2e;&#x63;&#x6f;&#x6d;</a>';
- $tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" encode="hex"}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testSubject()
{
$result = '<a href="mailto:me@example.com?subject=Hello%20to%20you%21" >me@example.com</a>';
@@ -107,15 +62,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testSubjectWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = '<a href="mailto:me@example.com?subject=Hello%20to%20you%21" >me@example.com</a>';
- $tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" subject="Hello to you!"}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testCc()
{
$result = '<a href="mailto:me@example.com?cc=you@example.com,they@example.com" >me@example.com</a>';
@@ -123,15 +69,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testCcWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = '<a href="mailto:me@example.com?cc=you@example.com,they@example.com" >me@example.com</a>';
- $tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" cc="you@example.com,they@example.com"}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testExtra()
{
$result = '<a href="mailto:me@example.com" class="email">me@example.com</a>';
@@ -139,15 +76,6 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testExtraWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = '<a href="mailto:me@example.com" class="email">me@example.com</a>';
- $tpl = $this->smarty->createTemplate('eval:{mailto address="me@example.com" extra=\'class="email"\'}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testUmlauts()
{
$result = '<a href="mailto:me+smtpext@example.com?cc=you@example.com,they@example.com&amp;subject=h%C3%A4llo%20w%C3%B6rld" >me+smtpext@example.com</a>';
@@ -155,18 +83,9 @@ class PluginFunctionMailtoTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testUmlautsWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $result = '<a href="mailto:me+smtpext@example.com?cc=you@example.com,they@example.com&amp;subject=h%C3%A4llo%20w%C3%B6rld" >me+smtpext@example.com</a>';
- $tpl = $this->smarty->createTemplate('eval:{mailto address="me+smtpext@example.com" cc="you@example.com,they@example.com" subject="hällo wörld"}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testJavascriptChars()
{
- $result = '<script type="text/javascript">document.write(unescape(\'%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%71%75%6f%74%3b%26%67%74%3b%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%23%30%33%39%3b%29%3b%20%61%6c%65%72%74%28%26%71%75%6f%74%3b%69%6e%6a%65%63%74%69%6f%6e%26%71%75%6f%74%3b%29%3b%20%2f%2f%22%20%3e%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%71%75%6f%74%3b%26%67%74%3b%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%23%30%33%39%3b%29%3b%20%61%6c%65%72%74%28%26%71%75%6f%74%3b%69%6e%6a%65%63%74%69%6f%6e%26%71%75%6f%74%3b%29%3b%20%2f%2f%3c%2f%61%3e\'))</script>';
+ $result = '<script>document.write(unescape(\'%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%71%75%6f%74%3b%26%67%74%3b%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%23%30%33%39%3b%29%3b%20%61%6c%65%72%74%28%26%71%75%6f%74%3b%69%6e%6a%65%63%74%69%6f%6e%26%71%75%6f%74%3b%29%3b%20%2f%2f%22%20%3e%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%71%75%6f%74%3b%26%67%74%3b%6d%65%40%65%78%61%6d%70%6c%65%2e%63%6f%6d%26%23%30%33%39%3b%29%3b%20%61%6c%65%72%74%28%26%71%75%6f%74%3b%69%6e%6a%65%63%74%69%6f%6e%26%71%75%6f%74%3b%29%3b%20%2f%2f%3c%2f%61%3e\'))</script>';
$this->smarty->assign('address', 'me@example.com">me@example.com\'); alert("injection"); //');
$tpl = $this->smarty->createTemplate('eval:{mailto address=$address encode=javascript}');
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/TimeTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/TimeTest.php
new file mode 100644
index 00000000..d64fd92d
--- /dev/null
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/TimeTest.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace UnitTests\TemplateSource\TagTests\PluginFunction;
+class TimeTest extends \PHPUnit_Smarty {
+
+ public function setUp(): void {
+ $this->setUpSmarty(__DIR__);
+ }
+
+ public function testBasicSyntax() {
+ $this->assertStringMatchesFormat('%d', $this->smarty->fetch("string:{time()}"));
+ }
+
+ public function testInvalidParameters() {
+ $this->expectException(\Smarty\Exception::class);
+ $this->expectExceptionMessage('Invalid number of arguments');
+ $this->assertEquals("", $this->smarty->fetch("string:{time(3, 'foo')}"));
+ }
+
+} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCapitalizeTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCapitalizeTest.php
index 9fc10d75..577d430b 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCapitalizeTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCapitalizeTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class PluginModifierCapitalizeTest extends PHPUnit_Smarty
{
@@ -40,33 +40,6 @@ class PluginModifierCapitalizeTest extends PHPUnit_Smarty
$this->assertEquals("Next X-Men Film, X3, Delayed. Ümlauts Äre Cööl.", $this->smarty->fetch($tpl));
}
- public function testDefaultWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, delayed."|capitalize}');
- $this->assertEquals("Next X-Men FiLm, x3, Delayed.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
- public function testDigitsWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, delayed."|capitalize:true}');
- $this->assertEquals("Next X-Men FiLm, X3, Delayed.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
- public function testTrueCaptialsWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, delayed."|capitalize:true:true}');
- $this->assertEquals("Next X-Men Film, X3, Delayed.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testQuotes()
{
$tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, \"delayed. umlauts\" foo."|capitalize}');
@@ -75,17 +48,6 @@ class PluginModifierCapitalizeTest extends PHPUnit_Smarty
$this->assertEquals("Next X-Men FiLm, x3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
}
- public function testQuotesWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, \"delayed. umlauts\" foo."|capitalize}');
- $this->assertEquals("Next X-Men FiLm, x3, \"Delayed. Umlauts\" Foo.", $this->smarty->fetch($tpl));
- $tpl = $this->smarty->createTemplate('string:{"next x-men fiLm, x3, \'delayed. umlauts\' foo."|capitalize}');
- $this->assertEquals("Next X-Men FiLm, x3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testQuotesDigits()
{
$tpl =
@@ -96,19 +58,6 @@ class PluginModifierCapitalizeTest extends PHPUnit_Smarty
$this->assertEquals("Next X-Men FiLm, X3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
}
- public function testQuotesDigitsWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl =
- $this->smarty->createTemplate('string:{"next x-men fiLm, x3, \"delayed. umlauts\" foo."|capitalize:true}');
- $this->assertEquals("Next X-Men FiLm, X3, \"Delayed. Umlauts\" Foo.", $this->smarty->fetch($tpl));
- $tpl =
- $this->smarty->createTemplate('string:{"next x-men fiLm, x3, \'delayed. umlauts\' foo."|capitalize:true}');
- $this->assertEquals("Next X-Men FiLm, X3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testQuotesTrueCapitals()
{
$tpl =
@@ -119,19 +68,6 @@ class PluginModifierCapitalizeTest extends PHPUnit_Smarty
$this->assertEquals("Next X-Men Film, X3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
}
- public function testQuotesTrueCapitalsWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl =
- $this->smarty->createTemplate('string:{"next x-men fiLm, x3, \"delayed. umlauts\" foo."|capitalize:true:true}');
- $this->assertEquals("Next X-Men Film, X3, \"Delayed. Umlauts\" Foo.", $this->smarty->fetch($tpl));
- $tpl =
- $this->smarty->createTemplate('string:{"next x-men fiLm, x3, \'delayed. umlauts\' foo."|capitalize:true:true}');
- $this->assertEquals("Next X-Men Film, X3, 'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testQuotesBeginning()
{
$tpl = $this->smarty->createTemplate('string:{"\"delayed. umlauts\" foo."|capitalize}');
@@ -140,14 +76,4 @@ class PluginModifierCapitalizeTest extends PHPUnit_Smarty
$this->assertEquals("'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
}
- public function testQuotesBeginningWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"\"delayed. umlauts\" foo."|capitalize}');
- $this->assertEquals("\"Delayed. Umlauts\" Foo.", $this->smarty->fetch($tpl));
- $tpl = $this->smarty->createTemplate('string:{"\'delayed. umlauts\' foo."|capitalize}');
- $this->assertEquals("'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCharsetTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCharsetTest.php
index 92ff9514..e463ca05 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCharsetTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCharsetTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class PluginModifierCharsetTest extends PHPUnit_Smarty
{
@@ -28,17 +28,6 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
}
- public function testToLatin1WithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $encoded = "hällö wörld 2";
- $result = mb_convert_encoding($encoded, 'ISO-8859-1', 'UTF-8');
- $tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|to_charset}');
- $this->assertEquals($encoded, $tpl->fetch());
- Smarty::$_MBSTRING = true;
- }
-
public function testFromLatin1()
{
$result = "hällö wörld 3";
@@ -47,17 +36,6 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
}
- public function testFromLatin1WithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $result = "hällö wörld 4";
- $encoded = mb_convert_encoding($result, 'ISO-8859-1', 'UTF-8');
- $tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|from_charset}');
- $this->assertEquals($encoded, $tpl->fetch());
- Smarty::$_MBSTRING = true;
- }
-
public function testFromUtf32le()
{
$result = "hällö wörld 5";
@@ -66,17 +44,6 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
}
- public function testFromUtf32leWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $result = "hällö wörld 6";
- $encoded = mb_convert_encoding($result, "UTF-32LE", "UTF-8");
- $tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|from_charset:"UTF-32LE"}');
- $this->assertEquals($encoded, $tpl->fetch());
- Smarty::$_MBSTRING = true;
- }
-
public function testToUtf32le()
{
$encoded = "hällö wörld 7";
@@ -85,14 +52,4 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
}
- public function testToUtf32leWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $encoded = "hällö wörld 8";
- $result = mb_convert_encoding($encoded, "UTF-32LE", "UTF-8");
- $tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|to_charset:"UTF-32LE"}');
- $this->assertEquals($encoded, $tpl->fetch());
- Smarty::$_MBSTRING = true;
- }
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountCharactersTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountCharactersTest.php
index 14955ded..7e4ebe6c 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountCharactersTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountCharactersTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class PluginModifierCountCharactersTest extends PHPUnit_Smarty
{
@@ -27,16 +27,6 @@ class PluginModifierCountCharactersTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testDefaultWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId ('mb');
- $result = "29";
- $tpl = $this->smarty->createTemplate('string:{"Cold Wave Linked to Temperatures."|count_characters}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testSpaces()
{
$result = "33";
@@ -44,16 +34,6 @@ class PluginModifierCountCharactersTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testSpacesWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId ('mb');
- $result = "33";
- $tpl = $this->smarty->createTemplate('string:{"Cold Wave Linked to Temperatures."|count_characters:true}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testUmlauts()
{
$result = "29";
@@ -61,16 +41,6 @@ class PluginModifierCountCharactersTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testUmlautsWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId ('mb');
- $result = "29";
- $tpl = $this->smarty->createTemplate('string:{"Cold Wäve Linked tö Temperatures."|count_characters}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testUmlautsSpaces()
{
$result = "33";
@@ -78,13 +48,4 @@ class PluginModifierCountCharactersTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testUmlautsSpacesWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId ('mb');
- $result = "33";
- $tpl = $this->smarty->createTemplate('string:{"Cold Wäve Linked tö Temperatures."|count_characters:true}');
- $this->assertNotEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountSentencesTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountSentencesTest.php
index 1abd12b8..caec7630 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountSentencesTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountSentencesTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierCountSentencesTest extends PHPUnit_Smarty
{
@@ -35,18 +35,6 @@ class PluginModifierCountSentencesTest extends PHPUnit_Smarty
$this->assertEquals("0", $this->smarty->fetch($tpl));
}
- public function testDefaultWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"hello world."|count_sentences}');
- $this->assertEquals("1", $this->smarty->fetch($tpl));
- $tpl = $this->smarty->createTemplate('string:{"hello world. I\'m another? Sentence!"|count_sentences}');
- $this->assertEquals("3", $this->smarty->fetch($tpl));
- $tpl = $this->smarty->createTemplate('string:{"hello world.wrong"|count_sentences}');
- $this->assertEquals("0", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testUmlauts()
{
$tpl = $this->smarty->createTemplate('string:{"hello worldä."|count_sentences}');
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountTest.php
index 2bbcb573..2e8b24e8 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountTest.php
@@ -6,9 +6,9 @@
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class PluginModifierCountTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountWordsTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountWordsTest.php
index c6c1b543..97a3cc53 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountWordsTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierCountWordsTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierCountWordsTest extends PHPUnit_Smarty
{
@@ -27,15 +27,6 @@ class PluginModifierCountWordsTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testDefaultWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = "7";
- $tpl = $this->smarty->createTemplate('string:{"Dealers Will Hear Car Talk at Noon."|count_words}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testDashes()
{
$result = "7";
@@ -43,15 +34,6 @@ class PluginModifierCountWordsTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testDashesWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = "7";
- $tpl = $this->smarty->createTemplate('string:{"Smalltime-Dealers Will Hear Car Talk at Noon."|count_words}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testUmlauts()
{
$result = "7";
@@ -59,12 +41,4 @@ class PluginModifierCountWordsTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testUmlautsWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = "7";
- $tpl = $this->smarty->createTemplate('string:{"Dealers Will Hear Cär Talk at Nöön."|count_words}');
- $this->assertNotEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierDefaultTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierDefaultTest.php
index a2582011..0400e017 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierDefaultTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierDefaultTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierDefaultTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierEscapeTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierEscapeTest.php
index 073f9fcf..5c0c2edf 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierEscapeTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierEscapeTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierEscapeTest extends PHPUnit_Smarty
{
@@ -33,28 +33,12 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
$this->assertEquals("I&#039;m some &lt;html&gt; to ä be &quot;escaped&quot; or &amp;copy;", $this->smarty->fetch($tpl));
}
- public function testHtmlWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or &copy;"|escape:"html"}');
- $this->assertEquals("I&#039;m some &lt;html&gt; to ä be &quot;escaped&quot; or &amp;copy;", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testHtmlDouble()
{
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or &copy;"|escape:"html":null:false}');
$this->assertEquals("I&#039;m some &lt;html&gt; to ä be &quot;escaped&quot; or &copy;", $this->smarty->fetch($tpl));
}
- public function testHtmlDoubleWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or &copy;"|escape:"html":null:false}');
- $this->assertEquals("I&#039;m some &lt;html&gt; to ä be &quot;escaped&quot; or &copy;", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testHtmlallCompiled()
{
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or &copy;"|escape:"htmlall"}');
@@ -68,37 +52,12 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
$this->assertEquals("I&#039;m some &lt;html&gt; to &auml; be &quot;escaped&quot; or &amp;copy;", $this->smarty->fetch($tpl));
}
- public function testHtmlallWithoutMbstringCompiled()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or &copy;"|escape:"htmlall"}');
- $this->assertEquals("I&#039;m some &lt;html&gt; to &auml; be &quot;escaped&quot; or &amp;copy;", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
- public function testHtmlallWithoutMbstringModifier()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or &copy;"|escape:$mode}');
- $this->smarty->assign('mode', 'htmlall');
- $this->assertEquals("I&#039;m some &lt;html&gt; to &auml; be &quot;escaped&quot; or &amp;copy;", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testHtmlallDouble()
{
$tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or &copy;"|escape:"htmlall":null:false}');
$this->assertEquals("I&#039;m some &lt;html&gt; to &auml; be &quot;escaped&quot; or &copy;", $this->smarty->fetch($tpl));
}
- public function testHtmlallDoubleWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"I\'m some <html> to ä be \"escaped\" or &copy;"|escape:"htmlall":null:false}');
- $this->assertEquals("I&#039;m some &lt;html&gt; to &auml; be &quot;escaped&quot; or &copy;", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testUrlCompiled()
{
$tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"url"}');
@@ -112,42 +71,18 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
$this->assertEquals("http%3A%2F%2Fsome.encoded.com%2Furl%3Fparts%23foo", $this->smarty->fetch($tpl));
}
- public function testUrlWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"url"}');
- $this->assertEquals("http%3A%2F%2Fsome.encoded.com%2Furl%3Fparts%23foo", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testUrlpathinfo()
{
$tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"urlpathinfo"}');
$this->assertEquals("http%3A//some.encoded.com/url%3Fparts%23foo", $this->smarty->fetch($tpl));
}
- public function testUrlpathinfoWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"http://some.encoded.com/url?parts#foo"|escape:"urlpathinfo"}');
- $this->assertEquals("http%3A//some.encoded.com/url%3Fparts%23foo", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testHex()
{
$tpl = $this->smarty->createTemplate('string:{"a/cäa"|escape:"hex"}');
$this->assertEquals("%61%2f%63%c3%a4%61", $this->smarty->fetch($tpl));
}
- public function testHexWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"a/cäa"|escape:"hex"}');
- $this->assertEquals("%61%2f%63%c3%a4%61", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testHexentity()
{
$q = "a&#228;&#1047;&#1076;&#1088;&#1072;&#1074;&#1089;&#1089;&#1090;&#1074;&#1091;&#1081;&#1090;&#1077;";
@@ -159,19 +94,6 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
$this->assertEquals("&#x61;&#x62;&#x63;", $this->smarty->fetch($tpl));
}
- public function testHexentityWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $q = "a&#228;&#1047;&#1076;&#1088;&#1072;&#1074;&#1089;&#1089;&#1090;&#1074;&#1091;&#1081;&#1090;&#1077;";
- $r = html_entity_decode($q, ENT_NOQUOTES, 'UTF-8');
- $tpl = $this->smarty->createTemplate('string:{"' . $r . '"|escape:"hexentity"}');
- $this->assertNotEquals("&#x61;&#xE4;&#x417;&#x434;&#x440;&#x430;&#x432;&#x441;&#x441;&#x442;&#x432;&#x443;&#x439;&#x442;&#x435;", $this->smarty->fetch($tpl));
-
- $tpl = $this->smarty->createTemplate('string:{"abc"|escape:"hexentity"}');
- $this->assertEquals("&#x61;&#x62;&#x63;", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testDecentity()
{
$q = "a&#228;&#1047;&#1076;&#1088;&#1072;&#1074;&#1089;&#1089;&#1090;&#1074;&#1091;&#1081;&#1090;&#1077;";
@@ -183,79 +105,42 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
$this->assertEquals("&#97;&#98;&#99;", $this->smarty->fetch($tpl));
}
- public function testDecentityWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $q = "a&#228;&#1047;&#1076;&#1088;&#1072;&#1074;&#1089;&#1089;&#1090;&#1074;&#1091;&#1081;&#1090;&#1077;";
- $r = html_entity_decode($q, ENT_NOQUOTES, 'UTF-8');
- $tpl = $this->smarty->createTemplate('string:{"' . $r . '"|escape:"decentity"}');
- $this->assertNotEquals("&#97;&#228;&#1047;&#1076;&#1088;&#1072;&#1074;&#1089;&#1089;&#1090;&#1074;&#1091;&#1081;&#1090;&#1077;", $this->smarty->fetch($tpl));
-
- $tpl = $this->smarty->createTemplate('string:{"abc"|escape:"decentity"}');
- $this->assertEquals("&#97;&#98;&#99;", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testJavascript()
{
$tpl = $this->smarty->createTemplate('string:{"var x = { foo : \"bar\n\" };"|escape:"javascript"}');
$this->assertEquals("var x = { foo : \\\"bar\\n\\\" };", $this->smarty->fetch($tpl));
}
- public function testJavascriptWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"var x = { foo : \"bar\n\" };"|escape:"javascript"}');
- $this->assertEquals("var x = { foo : \\\"bar\\n\\\" };", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testMail()
{
$tpl = $this->smarty->createTemplate('string:{"smarty@example.com"|escape:"mail"}');
$this->assertEquals("smarty [AT] example [DOT] com", $this->smarty->fetch($tpl));
}
- public function testMailWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"smarty@example.com"|escape:"mail"}');
- $this->assertEquals("smarty [AT] example [DOT] com", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testNonstd()
{
$tpl = $this->smarty->createTemplate('string:{"sma\'rty|»example«.com"|escape:"nonstd"}');
$this->assertEquals("sma'rty|&#187;example&#171;.com", $this->smarty->fetch($tpl));
}
- public function testNonstdWithoutMbstring()
+ public function testTemplateLiteralBackticks()
{
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"' . mb_convert_encoding('sma\'rty@»example«.com', 'ISO-8859-1', 'UTF-8') . '"|escape:"nonstd"}');
- $this->assertEquals("sma'rty@&#187;example&#171;.com", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
+ $tpl = $this->smarty->createTemplate('string:{"`Hello, World!`"|escape:"javascript"}');
+ $this->assertEquals("\\`Hello, World!\\`", $this->smarty->fetch($tpl));
}
- public function testTemplateLiteralBackticks()
- {
- $tpl = $this->smarty->createTemplate('string:{"`Hello, World!`"|escape:"javascript"}');
- $this->assertEquals("\\`Hello, World!\\`", $this->smarty->fetch($tpl));
- }
-
- public function testTemplateLiteralInterpolation()
- {
- $tpl = $this->smarty->createTemplate('string:{$vector|escape:"javascript"}');
- $this->smarty->assign('vector', "`Hello, \${name}!`");
- $this->assertEquals("\\`Hello, \\\$\\{name}!\\`", $this->smarty->fetch($tpl));
- }
+ public function testTemplateLiteralInterpolation()
+ {
+ $tpl = $this->smarty->createTemplate('string:{$vector|escape:"javascript"}');
+ $this->smarty->assign('vector', "`Hello, \${name}!`");
+ $this->assertEquals("\\`Hello, \\\$\\{name}!\\`", $this->smarty->fetch($tpl));
+ }
- public function testTemplateLiteralBackticksAndInterpolation()
- {
- $this->smarty->assign('vector', '`${alert(`Hello, ${name}!`)}${`\n`}`');
- $tpl = $this->smarty->createTemplate('string:{$vector|escape:"javascript"}');
- $this->assertEquals("\\`\\\$\\{alert(\\`Hello, \\\$\\{name}!\\`)}\\\$\\{\\`\\\\n\\`}\\`", $this->smarty->fetch($tpl));
- }
+ public function testTemplateLiteralBackticksAndInterpolation()
+ {
+ $this->smarty->assign('vector', '`${alert(`Hello, ${name}!`)}${`\n`}`');
+ $tpl = $this->smarty->createTemplate('string:{$vector|escape:"javascript"}');
+ $this->assertEquals("\\`\\\$\\{alert(\\`Hello, \\\$\\{name}!\\`)}\\\$\\{\\`\\\\n\\`}\\`", $this->smarty->fetch($tpl));
+ }
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierExplodeTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierExplodeTest.php
index 5cd13dd3..ecefc6f8 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierExplodeTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierExplodeTest.php
@@ -5,9 +5,9 @@ namespace UnitTests\TemplateSource\TagTests\PluginModifier;
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierExplodeTest extends \PHPUnit_Smarty
{
@@ -19,7 +19,7 @@ class PluginModifierExplodeTest extends \PHPUnit_Smarty
/**
* @return void
- * @throws \SmartyException
+ * @throws \Smarty\Exception
*
* @dataProvider explodeDataProvider
*/
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierLowerTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierLowerTest.php
index 06235551..c5567a1d 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierLowerTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierLowerTest.php
@@ -2,15 +2,15 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierLowerTest extends PHPUnit_Smarty
{
@@ -26,15 +26,6 @@ class PluginModifierLowerTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testDefaultWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = "two convicts evade noose, jury hung.";
- $tpl = $this->smarty->createTemplate('string:{"Two Convicts Evade Noose, Jury Hung."|lower}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testUmlauts()
{
$result = "two convicts eväde nööse, jury hung.";
@@ -42,12 +33,4 @@ class PluginModifierLowerTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testUmlautsWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = "two convicts eväde nööse, jury hung.";
- $tpl = $this->smarty->createTemplate('string:{"Two Convicts Eväde NöÖse, Jury Hung."|lower}');
- $this->assertNotEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierNl2brTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierNl2brTest.php
index 9b2c50b4..52aa2c00 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierNl2brTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierNl2brTest.php
@@ -6,9 +6,9 @@
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class PluginModifierNl2brTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierNumberFormatTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierNumberFormatTest.php
index 27feeac3..8a2ea8e5 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierNumberFormatTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierNumberFormatTest.php
@@ -5,9 +5,9 @@ namespace UnitTests\TemplateSource\TagTests\PluginModifier;
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierNumberFormatTest extends \PHPUnit_Smarty
{
@@ -18,7 +18,7 @@ class PluginModifierNumberFormatTest extends \PHPUnit_Smarty
/**
* @return void
- * @throws \SmartyException
+ * @throws \Smarty\Exception
*
* @dataProvider numberFormatDataProvider
*/
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierRegexReplaceTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierRegexReplaceTest.php
index f0a79ffc..fb6bc604 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierRegexReplaceTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierRegexReplaceTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierRegexReplaceTest extends PHPUnit_Smarty
{
@@ -26,14 +26,6 @@ class PluginModifierRegexReplaceTest extends PHPUnit_Smarty
$this->assertEquals("Infertility unlikely to be passed on, experts say.", $this->smarty->fetch($tpl));
}
- public function testDefaultWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"Infertility unlikely to\nbe passed on, experts say."|regex_replace:"/[\r\t\n]/":" "}');
- $this->assertEquals("Infertility unlikely to be passed on, experts say.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testUmlauts()
{
$tpl = $this->smarty->createTemplate('string:{"Infertility unlikely tö\näe passed on, experts say."|regex_replace:"/[\r\t\n]/u":" "}');
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierReplaceTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierReplaceTest.php
index a4b6a12e..cf7e2bd9 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierReplaceTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierReplaceTest.php
@@ -5,9 +5,9 @@ namespace UnitTests\TemplateSource\TagTests\PluginModifier;
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierReplaceTest extends \PHPUnit_Smarty
{
@@ -18,7 +18,7 @@ class PluginModifierReplaceTest extends \PHPUnit_Smarty
/**
* @return void
- * @throws \SmartyException
+ * @throws \Smarty\Exception
*
* @dataProvider replaceDataProvider
*/
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierSpacifyTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierSpacifyTest.php
index 79e2b1ce..52569081 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierSpacifyTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierSpacifyTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierSpacifyTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierStrRepeatTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierStrRepeatTest.php
index 6a2d0966..59d5b989 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierStrRepeatTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierStrRepeatTest.php
@@ -6,9 +6,9 @@
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class PluginModifierStrRepeatTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierStripTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierStripTest.php
index ab1a4384..152341cd 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierStripTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierStripTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierStripTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierTruncateTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierTruncateTest.php
index 667fb7d7..4aa9383e 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierTruncateTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierTruncateTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierTruncateTest extends PHPUnit_Smarty
{
@@ -27,15 +27,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testDefaultWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = 'Two Sisters Reunite after Eighteen Years at Checkout Counter.';
- $tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testLength()
{
$result = 'Two Sisters Reunite after...';
@@ -43,15 +34,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testLengthWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = 'Two Sisters Reunite after...';
- $tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testEtc()
{
$result = 'Two Sisters Reunite after';
@@ -59,15 +41,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testEtcWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = 'Two Sisters Reunite after';
- $tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30:""}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testEtc2()
{
$result = 'Two Sisters Reunite after---';
@@ -75,15 +48,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testEtc2WithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = 'Two Sisters Reunite after---';
- $tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30:"---"}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testBreak()
{
$result = 'Two Sisters Reunite after Eigh';
@@ -91,15 +55,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testBreakWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = 'Two Sisters Reunite after Eigh';
- $tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30:"":true}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testBreak2()
{
$result = 'Two Sisters Reunite after E...';
@@ -107,15 +62,6 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testBreak2WithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = 'Two Sisters Reunite after E...';
- $tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30:"...":true}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testMiddle()
{
$result = 'Two Sisters Re..ckout Counter.';
@@ -123,12 +69,4 @@ class PluginModifierTruncateTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testMiddleWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = 'Two Sisters Re..ckout Counter.';
- $tpl = $this->smarty->createTemplate('string:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30:"..":true:true}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierUnescapeTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierUnescapeTest.php
index 2fdefb2e..3a7e51b1 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierUnescapeTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierUnescapeTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierUnescapeTest extends PHPUnit_Smarty
{
@@ -28,16 +28,6 @@ class PluginModifierUnescapeTest extends PHPUnit_Smarty
$this->assertEquals($result, $this->smarty->fetch($tpl));
}
- public function testHtmlWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $encoded = "a&#228;&#1047;&#1076;&#1088;&#1072;&gt;&lt;&amp;amp;&auml;&#228;&#1074;&#1089;&#1089;&#1090;&#1074;&#1091;&#1081;&#1090;&#1077;";
- $result = "a&#228;&#1047;&#1076;&#1088;&#1072;><&amp;&auml;&#228;&#1074;&#1089;&#1089;&#1090;&#1074;&#1091;&#1081;&#1090;&#1077;";
- $tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|unescape:"html"}');
- $this->assertEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testHtmlall()
{
$encoded = "&#039;&quot;a&#228;&#1047;&#1076;&#1088;&#1072;&gt;&lt;&amp;amp;&auml;&#228;&#1074;&#1089;&#1089;&#1090;&#1074;&#1091;&#1081;&#1090;&#1077;";
@@ -46,16 +36,6 @@ class PluginModifierUnescapeTest extends PHPUnit_Smarty
$this->assertEquals($result, $this->smarty->fetch($tpl));
}
- public function testHtmlallWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $encoded = "&#039;&quot;a&#228;&#1047;&#1076;&#1088;&#1072;&gt;&lt;&amp;amp;&auml;&#228;&#1074;&#1089;&#1089;&#1090;&#1074;&#1091;&#1081;&#1090;&#1077;";
- $result = "'\"aäЗдра><&amp;ääвсствуйте";
- $tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|unescape:"htmlall"}');
- $this->assertEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testUrl()
{
$encoded = "a%C3%A4%D0%97%D0%B4%D1%80%D0%B0%3E%3C%26amp%3B%C3%A4%C3%A4%D0%B2%D1%81%D1%81%D1%82%D0%B2%3F%3D%2B%D1%83%D0%B9%D1%82%D0%B5";
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierUpperTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierUpperTest.php
index 84d35a7c..7616f5ea 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierUpperTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierUpperTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierUpperTest extends PHPUnit_Smarty
{
@@ -27,15 +27,6 @@ class PluginModifierUpperTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testDefaultWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = "IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE.";
- $tpl = $this->smarty->createTemplate('string:{"If Strike isn\'t Settled Quickly it may Last a While."|upper}');
- $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testUmlauts()
{
$result = "IF STRIKE ISN'T SÄTTLED ÜQUICKLY IT MAY LAST A WHILE.";
@@ -43,12 +34,4 @@ class PluginModifierUpperTest extends PHPUnit_Smarty
$this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
}
- public function testUmlautsWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
- $result = "IF STRIKE ISN'T SÄTTLED ÜQUICKLY IT MAY LAST A WHILE.";
- $tpl = $this->smarty->createTemplate('string:{"If Strike isn\'t Sättled ÜQuickly it may Last a While."|upper}');
- $this->assertNotEquals($result, $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierWordwrapTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierWordwrapTest.php
index 20b6f223..a833735f 100644
--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierWordwrapTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierWordwrapTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PluginModifierWordwrapTest extends PHPUnit_Smarty
{
@@ -26,15 +26,6 @@ class PluginModifierWordwrapTest extends PHPUnit_Smarty
$this->assertEquals("Blind woman gets new kidney from dad she hasn't seen in years.", $this->smarty->fetch($tpl));
}
- public function testDefaultWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"Blind woman gets new kidney from dad she hasn\'t seen in years."|wordwrap}');
- $this->assertEquals("Blind woman gets new kidney from dad she hasn't seen in years.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testDefaultUmlauts()
{
$tpl = $this->smarty->createTemplate('string:{"äöüßñ woman ñsä new kidney from dad she hasn\'t seen in years."|wordwrap:30}');
@@ -47,45 +38,18 @@ class PluginModifierWordwrapTest extends PHPUnit_Smarty
$this->assertEquals("Blind woman gets new kidney\nfrom dad she hasn't seen in\nyears.", $this->smarty->fetch($tpl));
}
- public function testLengthWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"Blind woman gets new kidney from dad she hasn\'t seen in years."|wordwrap:30}');
- $this->assertEquals("Blind woman gets new kidney\nfrom dad she hasn't seen in\nyears.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testBreak()
{
$tpl = $this->smarty->createTemplate('string:{"Blind woman gets new kidney from dad she hasn\'t seen in years."|wordwrap:30:"<br />\n"}');
$this->assertEquals("Blind woman gets new kidney<br />\nfrom dad she hasn't seen in<br />\nyears.", $this->smarty->fetch($tpl));
}
- public function testBreakWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"Blind woman gets new kidney from dad she hasn\'t seen in years."|wordwrap:30:"<br />\n"}');
- $this->assertEquals("Blind woman gets new kidney<br />\nfrom dad she hasn't seen in<br />\nyears.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testLong()
{
$tpl = $this->smarty->createTemplate('string:{"Blind woman withaverylongandunpronoucablenameorso gets new kidney from dad she hasn\'t seen in years."|wordwrap:26:"\n"}');
$this->assertEquals("Blind woman\nwithaverylongandunpronoucablenameorso\ngets new kidney from dad\nshe hasn't seen in years.", $this->smarty->fetch($tpl));
}
- public function testLongWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"Blind woman withaverylongandunpronoucablenameorso gets new kidney from dad she hasn\'t seen in years."|wordwrap:26:"\n"}');
- $this->assertEquals("Blind woman\nwithaverylongandunpronoucablenameorso\ngets new kidney from dad\nshe hasn't seen in years.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testLongUmlauts()
{
$tpl = $this->smarty->createTemplate('string:{"äöüßñ woman ñsääöüßñameorsoäöüßñäöüßñäöüßñäöüßñßñ gets new kidney from dad she hasn\'t seen in years."|wordwrap:26}');
@@ -98,15 +62,6 @@ class PluginModifierWordwrapTest extends PHPUnit_Smarty
$this->assertEquals("Blind woman\nwithaverylongandunpronouca\nblenameorso gets new\nkidney from dad she hasn't\nseen in years.", $this->smarty->fetch($tpl));
}
- public function testLongCutWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"Blind woman withaverylongandunpronoucablenameorso gets new kidney from dad she hasn\'t seen in years."|wordwrap:26:"\n":true}');
- $this->assertEquals("Blind woman\nwithaverylongandunpronouca\nblenameorso gets new\nkidney from dad she hasn't\nseen in years.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testLongCutUmlauts()
{
$tpl = $this->smarty->createTemplate('string:{"äöüßñ woman ñsääöüßñameorsoäöüßñäöüßñäöüßñäöüßñßñ gets new kidney from dad she hasn\'t seen in years."|wordwrap:26:"\n":true}');
@@ -119,15 +74,6 @@ class PluginModifierWordwrapTest extends PHPUnit_Smarty
$this->assertEquals("Blind woman\ngets new kidney from dad she\nhasn't seen in years.", $this->smarty->fetch($tpl));
}
- public function testLinebreaksWithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"Blind woman\ngets new kidney from dad she hasn\'t seen in years."|wordwrap:30}');
- $this->assertEquals("Blind woman\ngets new kidney from dad she\nhasn't seen in years.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
-
public function testLinebreaks2()
{
$tpl = $this->smarty->createTemplate('string:{"Blind woman
@@ -138,26 +84,4 @@ class PluginModifierWordwrapTest extends PHPUnit_Smarty
new kidney from\ndad she hasn't seen in years.", $this->smarty->fetch($tpl));
}
- public function testLinebreaks2WithoutMbstring()
- {
- Smarty::$_MBSTRING = false;
- $this->smarty->setCompileId('mb');
- $tpl = $this->smarty->createTemplate('string:{"Blind woman
- gets
- new kidney from dad she hasn\'t seen in years."|wordwrap:30}');
- $this->assertEquals("Blind woman
- gets
- new kidney from\ndad she hasn't seen in years.", $this->smarty->fetch($tpl));
- Smarty::$_MBSTRING = true;
- }
- /*
- public function testUnicodeSpaces()
- {
- // Some Unicode Spaces
- $string = "&#8199;hello spaced&#8196; &#8239; &#8197;&#8199; words ";
- $string = mb_convert_encoding($string, 'UTF-8', "HTML-ENTITIES");
- $tpl = $this->smarty->createTemplate('string:{"' . $string . '"|strip}');
- $this->assertEquals(" hello spaced words ", $this->smarty->fetch($tpl));
- }
- */
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/Section/CompileSectionTest.php b/tests/UnitTests/TemplateSource/TagTests/Section/CompileSectionTest.php
index bb196012..c8cb33b4 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Section/CompileSectionTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Section/CompileSectionTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of {section} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {section} tag tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class CompileSectionTest extends PHPUnit_Smarty
{
@@ -65,9 +65,9 @@ class CompileSectionTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacing($code, $result, $testName, $testNumber)
{
@@ -109,9 +109,9 @@ class CompileSectionTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestElseSpacing
- * @runInSeparateProcess
+ *
*/
public function testElseSpacing($code, $result, $testName, $testNumber)
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/SetFilter/CompileSetfilterTest.php b/tests/UnitTests/TemplateSource/TagTests/SetFilter/CompileSetfilterTest.php
index e86f28fe..cdc27e40 100644
--- a/tests/UnitTests/TemplateSource/TagTests/SetFilter/CompileSetfilterTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/SetFilter/CompileSetfilterTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of {setfilter} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {setfilter} tag tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class CompileSetfilterTest extends PHPUnit_Smarty
{
@@ -28,29 +28,29 @@ class CompileSetfilterTest extends PHPUnit_Smarty
/**
* @run
* InSeparateProcess
- * @preserveGlobalState disabled
+ *
*/
public function testNestedSetfilter()
{
$this->smarty->setCaching(1);
- $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter htmlspecialchars} {$foo}{$foo nocache}{setfilter escape:"mail"} {$foo}{$foo nocache}{/setfilter} {$foo}{/setfilter} {$foo}');
+ $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter escape} {$foo}{$foo nocache}{setfilter escape:"mail"} {$foo}{$foo nocache}{/setfilter} {$foo}{/setfilter} {$foo}');
$tpl->assign('foo', '<a@b.c>');
$this->assertEquals("<a@b.c> &lt;a@b.c&gt;&lt;a@b.c&gt; <a [AT] b [DOT] c><a [AT] b [DOT] c> &lt;a@b.c&gt; <a@b.c>", $this->smarty->fetch($tpl));
}
public function testNestedSetfilter1()
{
$this->smarty->setCaching(1);
- $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter htmlspecialchars} {$foo}{$foo nocache}{setfilter escape:"mail"} {$foo}{$foo nocache}{/setfilter} {$foo}{/setfilter} {$foo}');
+ $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter escape} {$foo}{$foo nocache}{setfilter escape:"mail"} {$foo}{$foo nocache}{/setfilter} {$foo}{/setfilter} {$foo}');
$tpl->assign('foo', '<e@f.d>');
$this->assertEquals("<a@b.c> &lt;a@b.c&gt;&lt;e@f.d&gt; <a [AT] b [DOT] c><e [AT] f [DOT] d> &lt;a@b.c&gt; <a@b.c>", $this->smarty->fetch($tpl));
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testNestedSetfilter2()
{
- $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter htmlspecialchars} {$foo}{setfilter escape:"mail"} {$foo}{/setfilter} {$foo}{/setfilter} {$foo}');
+ $tpl = $this->smarty->createTemplate('string:{$foo}{setfilter escape} {$foo}{setfilter escape:"mail"} {$foo}{/setfilter} {$foo}{/setfilter} {$foo}');
$tpl->assign('foo', '<a@b.c>');
$this->assertEquals("<a@b.c> &lt;a@b.c&gt; <a [AT] b [DOT] c> &lt;a@b.c&gt; <a@b.c>", $this->smarty->fetch($tpl));
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php b/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php
index 5e26728d..35b2eaac 100644
--- a/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/Strip/CompileStripTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of strip tags
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for strip tags tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class CompileStripTest extends PHPUnit_Smarty
{
@@ -31,7 +31,7 @@ class CompileStripTest extends PHPUnit_Smarty
* Test {strip} tags
*
* @not runInSeparateProcess
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestStrip
*/
public function testStrip($code, $result, $testName, $testNumber)
diff --git a/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php
index 6d1da7f5..3f13cb4c 100644
--- a/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/TemplateFunction/CompileFunctionTest.php
@@ -2,16 +2,18 @@
/**
* Smarty PHPunit tests compilation of {function} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
+use Smarty\CompilerException;
+
/**
* class for {function} tag tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class CompileFunctionTest extends PHPUnit_Smarty
{
@@ -26,8 +28,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
$this->cleanDirs();
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProvider
* test simple function call tag
*
@@ -39,8 +41,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
$this->assertEquals("default param default 1 2 1", $this->smarty->fetch('test_template_function_001.tpl'), $text);
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProvider
* test simple function call tag
*
@@ -53,8 +55,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProvider
* test simple function call tag cached
*/
@@ -67,8 +69,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProvider
* test simple function call tag cached
*/
@@ -82,8 +84,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProvider
* test simple function call tag cached no cache default variable
*/
@@ -99,8 +101,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
/**
* test simple function call tag cached no cache default variable 2
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
*/
public function testSimpleFunctionCachedNocacheDefault_002_2()
{
@@ -112,8 +114,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProviderCachingValue
* test simple function call tag plugin
*
@@ -130,8 +132,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProvider
* test simple function call tag 2
*
@@ -143,8 +145,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProvider
* test simple function call recursive
*/
@@ -154,8 +156,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProviderInline
* test inherited function call tag
*
@@ -167,8 +169,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProviderInline
* test function definition in include
*
@@ -182,8 +184,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProviderInline
* test external function definition cached
*
@@ -200,8 +202,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* test external function definition and called by fetch
*
*/
@@ -214,8 +216,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProviderInline
* test external function definition cached 2
*
@@ -233,8 +235,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProviderInline
* test external function definition nocache call
*
@@ -251,8 +253,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
}
/**
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProviderInline
* test external function definition nocache call 2
*
@@ -272,8 +274,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
/**
* test external function definition nocache call 3
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProviderInline
*/
public function testExternalDefinedFunctionNocachedCall3($merge, $text)
@@ -291,8 +293,8 @@ class CompileFunctionTest extends PHPUnit_Smarty
/**
* test external defined recursion
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider functionProvider
*/
public function testExternalDefinedFunctionRecursion($text)
@@ -349,9 +351,9 @@ class CompileFunctionTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacing($code, $result, $testName, $testNumber)
{
@@ -367,9 +369,9 @@ class CompileFunctionTest extends PHPUnit_Smarty
/**
* Test Output nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacingNocache($code, $result, $testName, $testNumber)
{
@@ -386,9 +388,9 @@ class CompileFunctionTest extends PHPUnit_Smarty
/**
* Test Output nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacingNocache2($code, $result, $testName, $testNumber)
{
@@ -437,7 +439,7 @@ class CompileFunctionTest extends PHPUnit_Smarty
* Test handling of function names that are a security risk
*/
public function testIllegalFunctionName() {
- $this->expectException(SmartyCompilerException::class);
+ $this->expectException(CompilerException::class);
$this->smarty->fetch('string:{function name=\'rce(){};echo "hi";function \'}{/function}');
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/While/CompileWhileTest.php b/tests/UnitTests/TemplateSource/TagTests/While/CompileWhileTest.php
index 984dd7bd..eaabf29b 100644
--- a/tests/UnitTests/TemplateSource/TagTests/While/CompileWhileTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/While/CompileWhileTest.php
@@ -2,7 +2,7 @@
/**
* Smarty PHPunit tests compilation of {while} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
@@ -10,8 +10,8 @@
* class for {while} tag tests
*
* @not runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
*/
class CompileWhileTest extends PHPUnit_Smarty
{
@@ -46,9 +46,9 @@ class CompileWhileTest extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacing($code, $result, $testName, $testNumber)
{
@@ -101,8 +101,8 @@ class CompileWhileTest extends PHPUnit_Smarty
/**
* Test nocache
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider dataTestNocache
*/
public function testNocache($value, $nocache, $code, $result, $testName, $testNumber)
@@ -120,7 +120,7 @@ class CompileWhileTest extends PHPUnit_Smarty
}
/*
- * Data provider für testNocache
+ * Data provider for testNocache
*/
public function dataTestNocache()
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/_Attributes/AttributeTest.php b/tests/UnitTests/TemplateSource/TagTests/_Attributes/AttributeTest.php
index c6778469..9beb5d09 100644
--- a/tests/UnitTests/TemplateSource/TagTests/_Attributes/AttributeTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/_Attributes/AttributeTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests for tag attributes
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for tag attribute tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class AttributeTest extends PHPUnit_Smarty
{
@@ -32,7 +32,7 @@ class AttributeTest extends PHPUnit_Smarty
*/
public function testRequiredAttributeVar()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('missing \'var\' attribute');
$this->smarty->fetch('string:{assign value=1}');
}
@@ -42,7 +42,7 @@ class AttributeTest extends PHPUnit_Smarty
*/
public function testUnexpectedAttribute()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('unexpected \'bar\' attribute');
$this->smarty->fetch('string:{assign var=foo value=1 bar=2}');
}
@@ -52,7 +52,7 @@ class AttributeTest extends PHPUnit_Smarty
*/
public function testIllegalOptionValue()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('for option flag \'nocache\'');
$this->expectExceptionMessage('illegal value');
$this->smarty->fetch('string:{assign var=foo value=1 nocache=buh}');
@@ -63,7 +63,7 @@ class AttributeTest extends PHPUnit_Smarty
*/
public function testTooManyShorthands()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('too many shorthand attributes');
$this->smarty->fetch('string:{assign foo 1 2}');
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/_Error/CompileErrorTest.php b/tests/UnitTests/TemplateSource/TagTests/_Error/CompileErrorTest.php
index 05e1e160..e3c3191b 100644
--- a/tests/UnitTests/TemplateSource/TagTests/_Error/CompileErrorTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/_Error/CompileErrorTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compiler errors
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for compiler tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class CompileErrorTest extends PHPUnit_Smarty
{
@@ -30,7 +30,7 @@ class CompileErrorTest extends PHPUnit_Smarty
*/
public function testNoneExistingTemplateError()
{
- $this->expectException('SmartyException');
+ $this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage('no.tpl');
$this->smarty->fetch('eval:{include file=\'no.tpl\'}');
}
@@ -40,7 +40,7 @@ class CompileErrorTest extends PHPUnit_Smarty
*/
public function testUnknownTagError()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('unknown tag \'unknown\'');
$this->smarty->fetch('eval:{unknown}');
}
@@ -50,7 +50,7 @@ class CompileErrorTest extends PHPUnit_Smarty
*/
public function testUnclosedTagError()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('unclosed {if} tag');
$this->smarty->fetch('eval:{if true}');
}
@@ -60,7 +60,7 @@ class CompileErrorTest extends PHPUnit_Smarty
*/
public function testSyntaxError()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('Unexpected "}"');
$this->smarty->fetch('eval:{assign var=}');
}
diff --git a/tests/UnitTests/TemplateSource/TagTests/_Print/PrintTest.php b/tests/UnitTests/TemplateSource/TagTests/_Print/PrintTest.php
index 8d2b2fc6..f10af7da 100644
--- a/tests/UnitTests/TemplateSource/TagTests/_Print/PrintTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/_Print/PrintTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests variable output with nocache attribute
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for variable output with nocache attribute tag tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PrintTest extends PHPUnit_Smarty
{
@@ -28,9 +28,9 @@ class PrintTest extends PHPUnit_Smarty
/**
* Test Output spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestOutputSpacing
- * @runInSeparateProcess
+ *
*/
public function testOutputSpacing($code, $result, $testName, $testNumber)
{
@@ -46,9 +46,9 @@ class PrintTest extends PHPUnit_Smarty
/**
* Test Output nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestOutputSpacing
- * @runInSeparateProcess
+ *
*/
public function testOutputSpacingNocache($code, $result, $testName, $testNumber)
{
@@ -65,9 +65,9 @@ class PrintTest extends PHPUnit_Smarty
/**
* Test Output nocache spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestOutputSpacing
- * @runInSeparateProcess
+ *
*/
public function testOutputSpacingNocache2($code, $result, $testName, $testNumber)
{
diff --git a/tests/UnitTests/TemplateSource/TagTests/break/CompileBreakTest.php b/tests/UnitTests/TemplateSource/TagTests/break/CompileBreakTest.php
index c731e4d0..85e9aaaf 100644
--- a/tests/UnitTests/TemplateSource/TagTests/break/CompileBreakTest.php
+++ b/tests/UnitTests/TemplateSource/TagTests/break/CompileBreakTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compilation of {break} tag
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {break} tag tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class CompileBreakTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/TernaryTest.php b/tests/UnitTests/TemplateSource/TernaryTest.php
new file mode 100644
index 00000000..95ce4b34
--- /dev/null
+++ b/tests/UnitTests/TemplateSource/TernaryTest.php
@@ -0,0 +1,41 @@
+<?php
+
+class TernaryTest extends PHPUnit_Smarty {
+
+ public function setUp(): void
+ {
+ $this->setUpSmarty('/tmp');
+ $this->cleanDirs();
+ }
+
+ public function testTernaryTrue() {
+ $tpl = $this->smarty->createTemplate('string:{$a ? $b : $c}');
+ $tpl->assign('a', true);
+ $tpl->assign('b', 'B');
+ $tpl->assign('c', 'C');
+ $this->assertEquals('B', $this->smarty->fetch($tpl));
+ }
+
+ public function testTernaryFalse() {
+ $tpl = $this->smarty->createTemplate('string:{$a ? $b : $c}');
+ $tpl->assign('a', false);
+ $tpl->assign('b', 'B');
+ $tpl->assign('c', 'C');
+ $this->assertEquals('C', $this->smarty->fetch($tpl));
+ }
+
+ public function testShorthandTernaryTrue() {
+ $tpl = $this->smarty->createTemplate('string:{$a ?: $c}');
+ $tpl->assign('a', true);
+ $tpl->assign('c', 'C');
+ $this->assertEquals(true, $this->smarty->fetch($tpl));
+ }
+
+ public function testShorthandTernaryFalse() {
+ $tpl = $this->smarty->createTemplate('string:{$a ? $b : $c}');
+ $tpl->assign('a', false);
+ $tpl->assign('c', 'C');
+ $this->assertEquals('C', $this->smarty->fetch($tpl));
+ }
+
+}
diff --git a/tests/UnitTests/TemplateSource/ValueTests/Array/ArrayTest.php b/tests/UnitTests/TemplateSource/ValueTests/Array/ArrayTest.php
index 75b1db85..94391ddd 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/Array/ArrayTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/Array/ArrayTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests array definitions and access
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for array tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class ArrayTest extends PHPUnit_Smarty
{
@@ -27,9 +27,9 @@ class ArrayTest extends PHPUnit_Smarty
/**
* Test array access
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestArray
- * @runInSeparateProcess
+ *
*/
public function testArray($code, $result, $testName, $testNumber)
{
diff --git a/tests/UnitTests/TemplateSource/ValueTests/BoolenNull/BooleanNullTest.php b/tests/UnitTests/TemplateSource/ValueTests/BoolenNull/BooleanNullTest.php
index d60a9a00..41b5a10c 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/BoolenNull/BooleanNullTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/BoolenNull/BooleanNullTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests literals true false null
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {$smarty.ldelim} {$smarty.rdelim} tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class BooleanNullTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/ValueTests/ConstantTests/ConstantsTest.php b/tests/UnitTests/TemplateSource/ValueTests/ConstantTests/ConstantsTest.php
index fd821a8c..f85acafb 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/ConstantTests/ConstantsTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/ConstantTests/ConstantsTest.php
@@ -3,11 +3,11 @@
/**
* Smarty PHPunit tests of constants
*
- * @package PHPunit
+
* @author Uwe Tews
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
Class TestConst
{
diff --git a/tests/UnitTests/TemplateSource/ValueTests/DoubleQuoted/DoubleQuotedStringTest.php b/tests/UnitTests/TemplateSource/ValueTests/DoubleQuoted/DoubleQuotedStringTest.php
index b6830230..688afb2e 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/DoubleQuoted/DoubleQuotedStringTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/DoubleQuoted/DoubleQuotedStringTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests double quoted strings
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for double quoted string tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class DoubleQuotedStringTest extends PHPUnit_Smarty
{
@@ -31,7 +31,7 @@ class DoubleQuotedStringTest extends PHPUnit_Smarty
/**
* Test double qouted strings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestDoubleQuoted
*/
public function testDoubleQuoted($code, $result, $testName, $testNumber)
@@ -84,7 +84,7 @@ class DoubleQuotedStringTest extends PHPUnit_Smarty
*/
public function testDoubleQuotedUnclosedBlock_001()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('unclosed \'{if}\' in doubled quoted string');
$this->smarty->fetch('001_unclosedBlock.tpl');
}
diff --git a/tests/UnitTests/TemplateSource/ValueTests/Math/MathTest.php b/tests/UnitTests/TemplateSource/ValueTests/Math/MathTest.php
index e4522e06..8d9f07f5 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/Math/MathTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/Math/MathTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class MathTest extends PHPUnit_Smarty
{
@@ -69,14 +69,6 @@ class MathTest extends PHPUnit_Smarty
$this->assertEquals($expected, $this->smarty->fetch($tpl));
}
- public function testSyntaxSin()
- {
- $this->smarty->disableSecurity();
- $expected = sin(4) . ' -- ' . sin(4);
- $tpl = $this->smarty->createTemplate('eval:{$x = 4}{$x|sin} -- {$y = sin($x)}{$y}');
- $this->assertEquals($expected, $this->smarty->fetch($tpl));
- }
-
public function testFunctionSin()
{
$this->smarty->disableSecurity();
diff --git a/tests/UnitTests/TemplateSource/ValueTests/Modifier/ModifierTest.php b/tests/UnitTests/TemplateSource/ValueTests/Modifier/ModifierTest.php
index 065a4920..2895ad97 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/Modifier/ModifierTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/Modifier/ModifierTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for modifier tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class ModifierTest extends PHPUnit_Smarty
{
@@ -30,7 +30,7 @@ class ModifierTest extends PHPUnit_Smarty
* Test modifier
*
* @not runInSeparateProcess
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestModifier
*/
public function testModifier($code, $result, $testName, $testNumber)
@@ -79,7 +79,7 @@ class ModifierTest extends PHPUnit_Smarty
*/
public function testModifierRegisteredStaticClass()
{
- $this->smarty->registerPlugin(Smarty::PLUGIN_MODIFIER, 'testmodifier', array('testmodifierclass', 'staticcall'));
+ $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'testmodifier', array('testmodifierclass', 'staticcall'));
$this->smarty->assign('foo', 1);
$this->assertEquals("mymodifier static 1", $this->smarty->fetch('testModifier_RegisteredStatic.tpl'));
}
@@ -90,7 +90,7 @@ class ModifierTest extends PHPUnit_Smarty
public function testModifierRegisteredMethodCall()
{
$obj = new testmodifierclass();
- $this->smarty->registerPlugin(Smarty::PLUGIN_MODIFIER, 'testmodifier', array($obj, 'method'));
+ $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'testmodifier', array($obj, 'method'));
$this->smarty->assign('foo', 3);
$this->assertEquals("mymodifier method 3", $this->smarty->fetch('testModifier_RegisteredMethod.tpl'));
}
@@ -100,7 +100,7 @@ class ModifierTest extends PHPUnit_Smarty
*/
public function testUnknownModifier()
{
- $this->expectException('SmartyCompilerException');
+ $this->expectException(\Smarty\CompilerException::class);
$this->expectExceptionMessage('unknown modifier \'unknown\'');
$this->smarty->fetch('eval:{"hello world"|unknown}');
}
@@ -110,7 +110,7 @@ class ModifierTest extends PHPUnit_Smarty
*/
public function testDefaultModifier()
{
- $this->smarty->default_modifiers = array('escape');
+ $this->smarty->setDefaultModifiers(array('escape'));
$this->smarty->assign('foo', '<bar>');
$this->assertEquals('&lt;bar&gt;<bar>', $this->smarty->fetch('testModifier_Default.tpl'));
}
diff --git a/tests/UnitTests/TemplateSource/ValueTests/Objects/ObjectVariableTest.php b/tests/UnitTests/TemplateSource/ValueTests/Objects/ObjectVariableTest.php
index 502a2271..9be49105 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/Objects/ObjectVariableTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/Objects/ObjectVariableTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests object variables
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for object variable tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class ObjectVariableTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/ValueTests/PHPfunctions/PhpFunctionTest.php b/tests/UnitTests/TemplateSource/ValueTests/PHPfunctions/PhpFunctionTest.php
index cf8970c5..cfbb32bb 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/PHPfunctions/PhpFunctionTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/PHPfunctions/PhpFunctionTest.php
@@ -2,7 +2,7 @@
/**
* Smarty PHPunit tests of modifier
*
- * @package PHPunit
+
* @author Rodney Rehm
*/
@@ -11,9 +11,9 @@
*
*
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PhpFunctionTest extends PHPUnit_Smarty
{
@@ -57,6 +57,7 @@ class PhpFunctionTest extends PHPUnit_Smarty
public function testEmpty2()
{
$this->smarty->disableSecurity();
+ $this->getSmarty()->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'pass', function ($v) { return $v; });
$this->smarty->assign('var', array(null,
false,
(int) 0,
@@ -78,6 +79,7 @@ class PhpFunctionTest extends PHPUnit_Smarty
public function testEmpty3()
{
$this->smarty->disableSecurity();
+ $this->getSmarty()->registerPlugin(\Smarty\Smarty::PLUGIN_FUNCTION, 'pass', function ($v) { return $v; });
$this->smarty->assign('var', array(true,
(int) 1,
(float) 0.1,
@@ -97,6 +99,7 @@ class PhpFunctionTest extends PHPUnit_Smarty
public function testEmpty4()
{
$this->smarty->disableSecurity();
+ $this->getSmarty()->registerPlugin(\Smarty\Smarty::PLUGIN_FUNCTION, 'pass', function ($v) { return $v; });
$this->smarty->assign('var', new TestIsset());
$expected = ' true , false , false , true , true , true , false ';
$this->assertEquals($expected, $this->smarty->fetch('string:{strip}{if empty($var->isNull)} true {else} false {/IF}
@@ -114,6 +117,7 @@ class PhpFunctionTest extends PHPUnit_Smarty
public function testIsset1()
{
$this->smarty->disableSecurity();
+ $this->getSmarty()->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'pass', function ($v) { return $v; });
$this->smarty->assign('isNull', null);
$this->smarty->assign('isSet', 1);
$this->smarty->assign('arr', array('isNull' => null, 'isSet' => 1));
@@ -135,6 +139,7 @@ class PhpFunctionTest extends PHPUnit_Smarty
{
$this->smarty->disableSecurity();
$this->smarty->assign('var', new TestIsset());
+ $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'pass', function ($v) { return $v; });
$expected = ' false , true , true , false , false , false , true ';
$this->assertEquals($expected, $this->smarty->fetch('string:{strip}{if isset($var->isNull)} true {else} false {/IF}
,{if isset($var->isSet)} true {else} false {/IF}
@@ -155,6 +160,7 @@ class PhpFunctionTest extends PHPUnit_Smarty
public function testIsset3($strTemplate, $result)
{
$this->smarty->disableSecurity();
+ $this->smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'intval', 'intval');
$this->smarty->assign('varobject', new TestIsset());
$this->smarty->assign('vararray', $vararray = array(
@@ -199,15 +205,6 @@ class PhpFunctionTest extends PHPUnit_Smarty
}
/**
- * @param mixed $v
- *
- * @return mixed
- */
-function pass($v) {
- return $v;
-}
-
-/**
* Class TestIsset
*/
class TestIsset {
diff --git a/tests/UnitTests/TemplateSource/ValueTests/SingleQouted/SingleQuotedStringTest.php b/tests/UnitTests/TemplateSource/ValueTests/SingleQouted/SingleQuotedStringTest.php
index 02919d93..e9f3333f 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/SingleQouted/SingleQuotedStringTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/SingleQouted/SingleQuotedStringTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests single quoted strings
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for single quoted string tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class SingleQuotedStringTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Constant/SmartyConstantTest.php b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Constant/SmartyConstantTest.php
index 08002c64..26ba767e 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Constant/SmartyConstantTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Constant/SmartyConstantTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests {$smarty.constant.foo}
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {$smarty.constant.foo} tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class SmartyConstantTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Cookie/CookieTest.php b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Cookie/CookieTest.php
index 84bafb09..f54cd12c 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Cookie/CookieTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Cookie/CookieTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests {$smarty.cookies.foo}
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for $smarty.cookies.foo} tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class CookieTest extends PHPUnit_Smarty
{
@@ -27,8 +27,8 @@ class CookieTest extends PHPUnit_Smarty
/**
* test cookies
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider dataProvider
*/
public function testCookie($caching, $value) {
@@ -49,8 +49,8 @@ class CookieTest extends PHPUnit_Smarty
/**
* test cookies with modifier
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider dataProviderModifier
*/
public function testCookieModifier($caching, $value, $result) {
diff --git a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Delimiter/SmartyDelimiterTest.php b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Delimiter/SmartyDelimiterTest.php
index 3cb1de4a..47304b0d 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Delimiter/SmartyDelimiterTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Delimiter/SmartyDelimiterTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests {$smarty.ldelim} {$smarty.rdelim}
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {$smarty.ldelim} {$smarty.rdelim} tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class SmartyDelimiterTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Error/SmartyErrorTest.php b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Error/SmartyErrorTest.php
index 40f85e59..baf805a6 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Error/SmartyErrorTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Error/SmartyErrorTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests undefined Smarty special variable
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for undefined Smarty special variable tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class SmartyErrorTest extends PHPUnit_Smarty
{
@@ -28,8 +28,8 @@ class SmartyErrorTest extends PHPUnit_Smarty
* test undefined Smarty special variable
*/
public function testSmartyError() {
- $this->expectException('SmartyException');
+ $this->expectException(\Smarty\Exception::class);
$this->expectExceptionMessage('$smarty.foo is not defined');
- $this->assertEquals(Smarty::SMARTY_VERSION, $this->smarty->fetch('error.tpl'));
+ $this->assertEquals(\Smarty\Smarty::SMARTY_VERSION, $this->smarty->fetch('error.tpl'));
}
}
diff --git a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Now/SmartyNowTest.php b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Now/SmartyNowTest.php
index 4e5f5f50..32116a7c 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Now/SmartyNowTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Now/SmartyNowTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests {$smarty.now}
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {$smarty.now} tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class SmartyNowTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Post/PostTest.php b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Post/PostTest.php
index b7204666..92bfea4a 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Post/PostTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Post/PostTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests {$smarty.post.foo}
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {$smarty.post.foo} tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class PostTest extends PHPUnit_Smarty
{
@@ -27,8 +27,8 @@ class PostTest extends PHPUnit_Smarty
/**
* test $_POST
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider dataProvider
*/
public function testPost($caching, $value) {
@@ -40,8 +40,8 @@ class PostTest extends PHPUnit_Smarty
/**
* test $_POST with modifier
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ *
+ *
* @dataProvider dataProviderModifier
*/
public function testPostModifier($caching, $value, $result) {
diff --git a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/TemplateObject/SmartyTemplateObjectTest.php b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/TemplateObject/SmartyTemplateObjectTest.php
index 0fb2fe38..1ee56beb 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/TemplateObject/SmartyTemplateObjectTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/TemplateObject/SmartyTemplateObjectTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests {$smarty.template_objects}
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {$smarty.template_objects} tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class SmartyTemplateObjectTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/TemplateObject/templates/template_object.tpl b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/TemplateObject/templates/template_object.tpl
index 08babe7e..d927d64b 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/TemplateObject/templates/template_object.tpl
+++ b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/TemplateObject/templates/template_object.tpl
@@ -1 +1 @@
-{if $smarty.template_object instanceof Smarty_Internal_Template}okay{/if} \ No newline at end of file
+{if $smarty.template_object instanceof \Smarty\Template}okay{/if} \ No newline at end of file
diff --git a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Version/SmartyVersionTest.php b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Version/SmartyVersionTest.php
index 8e295824..efbc2dd6 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Version/SmartyVersionTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/SmartySpecialVars/Version/SmartyVersionTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests {$smarty.version}
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for {$smarty.version} tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class SmartyVersionTest extends PHPUnit_Smarty
{
@@ -29,6 +29,6 @@ class SmartyVersionTest extends PHPUnit_Smarty
*
*/
public function testSmartyVersion() {
- $this->assertEquals(Smarty::SMARTY_VERSION, $this->smarty->fetch('version.tpl'));
+ $this->assertEquals(\Smarty\Smarty::SMARTY_VERSION, $this->smarty->fetch('version.tpl'));
}
}
diff --git a/tests/UnitTests/TemplateSource/ValueTests/Variables/Stream/StreamVariableTest.php b/tests/UnitTests/TemplateSource/ValueTests/Variables/Stream/StreamVariableTest.php
index c832fc70..500dcc62 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/Variables/Stream/StreamVariableTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/Variables/Stream/StreamVariableTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests stream variables
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for stream variables tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class StreamVariableTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableVariable/VariableVariableTest.php b/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableVariable/VariableVariableTest.php
index 84843262..997a342a 100644
--- a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableVariable/VariableVariableTest.php
+++ b/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableVariable/VariableVariableTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests variable variables
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for variable variables tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class VariableVariableTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/X_Scopes/ScopeTest.php b/tests/UnitTests/TemplateSource/X_Scopes/ScopeTest.php
index 8c0a7156..4f805fae 100644
--- a/tests/UnitTests/TemplateSource/X_Scopes/ScopeTest.php
+++ b/tests/UnitTests/TemplateSource/X_Scopes/ScopeTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests for scopes
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class scope tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class ScopeTest extends PHPUnit_Smarty
{
@@ -31,27 +31,26 @@ class ScopeTest extends PHPUnit_Smarty
/**
* Test scope
*
- * @runInSeparateProcess
- * @preserveGlobalState disabled
* @dataProvider dataTestAppendScope
*/
public function testAppendScope($code, $useSmarty, $result, $testName, $testNumber)
{
$file = "testAppendScope_{$testNumber}.tpl";
$this->makeTemplateFile($file, $code . '{checkvar var=foo}');
- $this->smarty->assignGlobal('file', $file);
- $this->smarty->assign('foo', 'smarty');
- $this->smarty->assignGlobal('foo', 'global');
+ $this->smarty->assign('file', $file);
+ $this->smarty->assign('foo', 'global');
$data1 = $this->smarty->createData($useSmarty ? $this->smarty : null);
$data = $this->smarty->createData($data1);
$data1->assign('foo', 'data1');
$data->assign('foo', 'data');
- $this->assertEquals($result, $this->smarty->fetch('scope_tag.tpl', $data),
- "test - {$code} - {$testName}");
+
+ $tpl = $this->smarty->createTemplate('scope_tag.tpl', $data);
+
+ $this->assertEquals($result, $this->smarty->fetch($tpl),"test - {$code} - {$testName}");
}
- /*
- * Data provider für testAppendScope
+ /**
+ * Data provider for testAppendScope
*/
public function dataTestAppendScope()
{
@@ -62,42 +61,76 @@ class ScopeTest extends PHPUnit_Smarty
* result
* test name
*/
- return array(array('{$foo[] = \'newvar\' scope=tpl_root}', true,
- '#testAppendScope_0.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#scope_include.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#scope_tag.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#data:$foo =\'data\'#data:$foo =\'data1\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++,),
- array('{append var=foo value=\'newvar\' scope=tpl_root}', true,
- '#testAppendScope_1.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#scope_include.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#scope_tag.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#data:$foo =\'data\'#data:$foo =\'data1\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++,),
- array('{append var=foo value=\'newvar\' scope=global}', true,
- '#testAppendScope_2.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#scope_include.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#scope_tag.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#data:$foo =\'data\'#data:$foo =\'data1\'#Smarty:$foo =\'smarty\'#global:$foo =array(0=>\'data\',1=>\'newvar\',)',
- '', $i ++,),
- array('{append var=foo value=\'newvar\' scope=smarty}', true,
- '#testAppendScope_3.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#scope_include.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#scope_tag.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)#data:$foo =\'data\'#data:$foo =\'data1\'#Smarty:$foo =array(0=>\'data\',1=>\'newvar\',)#global:$foo =\'global\'',
- '', $i ++,),);
+ return [
+ [
+ '{$foo[] = \'newvar\' scope=tpl_root}',
+ true,
+ '#testAppendScope_0.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)' .
+ '#scope_include.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)' .
+ '#scope_tag.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)' .
+ '#data:$foo =\'data\'' .
+ '#data:$foo =\'data1\'' .
+ '#global:$foo =\'global\'',
+ '',
+ $i++,
+ ],
+ [
+ '{append var=foo value=\'newvar\' scope=tpl_root}', true,
+ '#testAppendScope_1.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)' .
+ '#scope_include.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)' .
+ '#scope_tag.tpl:$foo =array(0=>\'data\',1=>\'newvar\',)' .
+ '#data:$foo =\'data\'' .
+ '#data:$foo =\'data1\'' .
+ '#global:$foo =\'global\'',
+ '',
+ $i++,
+ ],
+ [
+ '{append var=foo value=\'newvar\' scope=global}', true,
+ '#testAppendScope_2.tpl:$foo =\'data\'' .
+ '#scope_include.tpl:$foo =\'data\'' .
+ '#scope_tag.tpl:$foo =\'data\'' .
+ '#data:$foo =\'data\'' .
+ '#data:$foo =\'data1\'' .
+ '#global:$foo =array(0=>\'data\',1=>\'newvar\',)',
+ '',
+ $i++,
+ ],
+ [
+ '{append var=foo value=\'newvar\' scope=global}', true,
+ '#testAppendScope_3.tpl:$foo =\'data\'' .
+ '#scope_include.tpl:$foo =\'data\'' .
+ '#scope_tag.tpl:$foo =\'data\'' .
+ '#data:$foo =\'data\'' .
+ '#data:$foo =\'data1\'' .
+ '#global:$foo =array(0=>\'data\',1=>\'newvar\',)',
+ '',
+ $i++,
+ ],
+ ];
}
/**
* Test scope
- *
- * @not runInSeparateProcess
- * @preserveGlobalState disabled
* @dataProvider dataTestAssignScope
*/
public function testAssignScope($code, $useSmarty, $result, $testName, $testNumber)
{
$file = "testAssignScope_{$testNumber}.tpl";
$this->makeTemplateFile($file, $code . '{checkvar var=foo}');
- $this->smarty->assignGlobal('file', $file);
- $this->smarty->assign('foo', 'smarty');
- $this->smarty->assignGlobal('foo', 'global');
+
+ $this->smarty->assign('foo', 'global');
$data = $this->smarty->createData($useSmarty ? $this->smarty : null);
+ $data->assign('file', $file);
$data->assign('foo', 'data');
- $this->assertEquals('#' . $file . $result,
- $this->smarty->fetch('scope_tag.tpl', $data), "test - {$code} - {$testName}");
+
+ $tpl = $this->smarty->createTemplate('scope_tag.tpl', $data);
+
+ $this->assertEquals('#' . $file . $result, $this->smarty->fetch($tpl), "test - {$code} - {$testName}");
}
/*
- * Data provider für testAssignScope
+ * Data provider for testAssignScope
*/
public function dataTestAssignScope()
{
@@ -108,39 +141,48 @@ class ScopeTest extends PHPUnit_Smarty
* result
* test name
*/
- return array(array('{$foo = \'newvar\'}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++,), array('{assign var=foo value=\'newvar\'}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++,), array('{$foo = \'newvar\' scope=local}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++,),
- array('{assign var=foo value=\'newvar\' scope=local}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++,), array('{$foo = \'newvar\' scope=parent}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++,), array('{assign var=foo value=\'newvar\' scope=parent}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++,),
- array('{$foo = \'newvar\' scope=tpl_root}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++,), array('{$foo = \'newvar\' scope=global}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'newvar\'',
- '', $i ++,), array('{$foo = \'newvar\' scope=root}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'newvar\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++,),
- array('{$foo = \'newvar\' scope=root}', false,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'newvar\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- 'no smarty', $i ++,), array('{$foo = \'newvar\' scope=smarty}', false,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'data\'#Smarty:$foo =\'newvar\'#global:$foo =\'global\'',
- 'no smarty', $i ++,),);
+ return [
+ ['{$foo = \'newvar\'}', true,
+ ':$foo =\'newvar\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'global\'',
+ 'default', $i++,],
+ ['{assign var=foo value=\'newvar\'}', true,
+ ':$foo =\'newvar\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'global\'',
+ 'assign tag', $i++,],
+ ['{$foo = \'newvar\' scope=local}', true,
+ ':$foo =\'newvar\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'global\'',
+ 'local', $i++,],
+ ['{assign var=foo value=\'newvar\' scope=local}', true,
+ ':$foo =\'newvar\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'global\'',
+ 'assign tag local', $i++,],
+ ['{$foo = \'newvar\' scope=parent}', true,
+ ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'global\'',
+ 'parent', $i++,],
+ ['{assign var=foo value=\'newvar\' scope=parent}', true,
+ ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'global\'',
+ 'assign tag parent', $i++,],
+ ['{$foo = \'newvar\' scope=tpl_root}', true,
+ ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'data\'#global:$foo =\'global\'',
+ 'tpl_root', $i++,],
+ ['{$foo = \'newvar\' scope=global}', true,
+ ':$foo =\'data\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'newvar\'',
+ 'global', $i++,],
+ ['{$foo = \'newvar\' scope=root}', true,
+ ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'newvar\'#global:$foo =\'global\'',
+ 'root', $i++,],
+ ['{$foo = \'newvar\' scope=root}', false,
+ ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'newvar\'#global:$foo =\'global\'',
+ 'root, no smarty', $i++,],
+ ['{$foo = \'newvar\' scope=global}', false,
+ ':$foo =\'data\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'newvar\'',
+ 'global, no smarty', $i++,],
+ ];
}
- /**
- * Test scope nocache
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
+ /**
+ * Test scope nocache
+ *
+ *
+ *
* @dataProvider dataTestScopeNocache
*/
public function testScopeNocache($var, $file, $result)
@@ -163,36 +205,29 @@ class ScopeTest extends PHPUnit_Smarty
* result
*/
return array(array('b1', 'test_scope_assignbar.tpl',
- '#test_scope_assignbar.tpl:$foo =\'b1\'#Smarty:$foo =\'smarty\'#global:$foo =\'b1\'',),
+ '#test_scope_assignbar.tpl:$foo =\'b1\'#global:$foo =\'b1\'',),
array('b2', 'test_scope_assignbar.tpl',
- '#test_scope_assignbar.tpl:$foo =\'b2\'#Smarty:$foo =\'smarty\'#global:$foo =\'b2\'',),
+ '#test_scope_assignbar.tpl:$foo =\'b2\'#global:$foo =\'b2\'',),
array('b1', 'test_scope_assignnocache.tpl',
- '#test_scope_assignnocache.tpl:$foo =\'b1\'#Smarty:$foo =\'smarty\'#global:$foo =\'b1\'',),
+ '#test_scope_assignnocache.tpl:$foo =\'b1\'#global:$foo =\'b1\'',),
array('b2', 'test_scope_assignnocache.tpl',
- '#test_scope_assignnocache.tpl:$foo =\'b2\'#Smarty:$foo =\'smarty\'#global:$foo =\'b2\'',),);
+ '#test_scope_assignnocache.tpl:$foo =\'b2\'#global:$foo =\'b2\'',),);
}
/**
* Test scope
- *
- * @runInSeparateProcess
- * @preserveGlobalState disabled
* @dataProvider dataTestIncludeScope
*/
public function testIncludeScope($code, $useSmarty, $result, $testName, $testNumber = null)
{
$file = "testIncludeScope_{$testNumber}.tpl";
$this->makeTemplateFile($file, $code);
- $this->smarty->assignGlobal('file', $file);
- $this->smarty->assign('foo', 'smarty');
- $this->smarty->assignGlobal('foo', 'global');
+ $this->smarty->assign('foo', 'global');
$data = $this->smarty->createData($useSmarty ? $this->smarty : null);
$data->assign('foo', 'data');
- if (!$useSmarty) {
- $testName .= 'no smarty';
- }
- $this->assertEquals($result, $this->smarty->fetch('test_scope.tpl', $data),
- "test - {$code} - {$testName}");
+ $data->assign('file', $file);
+ $tpl = $this->smarty->createTemplate('test_scope.tpl', $data);
+ $this->assertEquals($result, $this->smarty->fetch($tpl), "test - {$code} - {$testName}");
}
/*
@@ -201,94 +236,85 @@ class ScopeTest extends PHPUnit_Smarty
public function dataTestIncludeScope()
{
$i = 0;
- return array(/*
- * Code
- * use Smarty object
- * result
- * test name
- */
- array('{include \'test_scope_assign.tpl\'}', true,
- '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
- '.tpl:$foo =\'data\'#test_scope.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++), array('{include \'test_scope_assign.tpl\' scope=parent}', true,
- '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
- '.tpl:$foo =\'newvar\'#test_scope.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++),
- array('{include \'test_scope_assign.tpl\' scope=tpl_root}', true,
- '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
- '.tpl:$foo =\'newvar\'#test_scope.tpl:$foo =\'newvar\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++), array('{include \'test_scope_assign.tpl\' scope=root}', true,
- '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
- '.tpl:$foo =\'newvar\'#test_scope.tpl:$foo =\'newvar\'#data:$foo =\'newvar\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++), array('{include \'test_scope_assign.tpl\' scope=root}', false,
- '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' .
- $i .
- '.tpl:$foo =\'newvar\'#test_scope.tpl:$foo =\'newvar\'#data:$foo =\'newvar\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++),
- array('{include \'test_scope_assign.tpl\' scope=smarty}', true,
- '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
- '.tpl:$foo =\'newvar\'#test_scope.tpl:$foo =\'newvar\'#data:$foo =\'data\'#Smarty:$foo =\'newvar\'#global:$foo =\'global\'',
- '', $i ++), array('{include \'test_scope_assign.tpl\' scope=global}', true,
- '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
- '.tpl:$foo =\'newvar\'#test_scope.tpl:$foo =\'newvar\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'newvar\'',
- '', $i ++),
- array('{include \'test_scope_pluginassign.tpl\' scope=global}', true,
- '#test_scope_pluginassign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
- '.tpl:$foo =\'newvar\'#test_scope.tpl:$foo =\'newvar\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'newvar\'',
- '', $i ++), array('{include \'test_scope_assign_noscope.tpl\' scope=root}', true,
- '#test_scope_assign_noscope.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
- '.tpl:$foo =\'data\'#test_scope.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'#global:$foo =\'global\'',
- '', $i ++),);
+ return [
+ /*
+ * Code
+ * use Smarty object
+ * result
+ * test name
+ */
+ ['{include \'test_scope_assign.tpl\'}', true,
+ '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
+ '.tpl:$foo =\'data\'#test_scope.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'global\'',
+ 'basic', $i++],
+ ['{include \'test_scope_assign.tpl\' scope=parent}', true,
+ '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
+ '.tpl:$foo =\'newvar\'#test_scope.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'global\'',
+ 'parent scope', $i++],
+ ['{include \'test_scope_assign.tpl\' scope=tpl_root}', true,
+ '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
+ '.tpl:$foo =\'newvar\'#test_scope.tpl:$foo =\'newvar\'#data:$foo =\'data\'#global:$foo =\'global\'',
+ 'tpl_root scope', $i++],
+ ['{include \'test_scope_assign.tpl\' scope=root}', true,
+ '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
+ '.tpl:$foo =\'newvar\'#test_scope.tpl:$foo =\'newvar\'#data:$foo =\'newvar\'#global:$foo =\'global\'',
+ 'root scope', $i++],
+ ['{include \'test_scope_assign.tpl\' scope=root}', false,
+ '#test_scope_assign.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
+ '.tpl:$foo =\'newvar\'#test_scope.tpl:$foo =\'newvar\'#data:$foo =\'newvar\'#global:$foo =\'global\'',
+ 'root scope / no smarty', $i++],
+ ['{include \'test_scope_assign.tpl\' scope=global}', true,
+ '#test_scope_assign.tpl:$foo =\'data\'#testIncludeScope_' . $i .
+ '.tpl:$foo =\'data\'#test_scope.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'newvar\'',
+ 'global scope', $i++],
+ ['{include \'test_scope_pluginassign.tpl\' scope=global}', true,
+ '#test_scope_pluginassign.tpl:$foo =\'data\'#testIncludeScope_' . $i .
+ '.tpl:$foo =\'data\'#test_scope.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'newvar\'',
+ 'pluginassign global', $i++],
+ ['{include \'test_scope_assign_noscope.tpl\' scope=root}', true,
+ '#test_scope_assign_noscope.tpl:$foo =\'newvar\'#testIncludeScope_' . $i .
+ '.tpl:$foo =\'data\'#test_scope.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'global\'',
+ 'noscope root', $i++],
+ ];
}
/**
* Test scope
- *
- * @not runInSeparateProcess
- * @preserveGlobalState disabled
* @dataProvider dataTestConfigScope
*/
public function testConfigScope($code, $useSmarty, $result, $testName, $testNumber)
{
$file = "testConfigScope_{$testNumber}.tpl";
$this->makeTemplateFile($file, $code . '{checkconfigvar var=foo}');
- $this->smarty->assignGlobal('file', $file);
- $this->smarty->configLoad('smarty.conf');
- $data = $this->smarty->createData($useSmarty ? $this->smarty : null);
- $data->configLoad('data.conf');
- $this->assertEquals('#' . $file . $result,
- $this->smarty->fetch('scope_tag.tpl', $data), "test - {$code} - {$testName}");
+ $this->smarty->configLoad('smarty.conf');
+ $data = $this->smarty->createData($useSmarty ? $this->smarty : null);
+ $data->assign('file', $file);
+ $data->configLoad('data.conf');
+ $tpl = $this->smarty->createTemplate('scope_tag.tpl', $data);
+ $this->assertEquals(
+ '#' . $file . $result,
+ $this->smarty->fetch($tpl),
+ "test - {$code} - {$testName}
+ ");
}
/*
- * Data provider für testConfigScope
+ * Data provider for testConfigScope
*/
public function dataTestConfigScope()
{
- $i = 0;
- /*
- * Code
- * use Smarty object
- * result
- * test name
- */
- return array(array('{config_load \'template.conf\'}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'',
- '', $i ++,), array('{config_load \'template.conf\' scope=local}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'',
- '', $i ++,), array('{config_load \'template.conf\' scope=parent}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'',
- '', $i ++,),
- array('{config_load \'template.conf\' scope=tpl_root}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'data\'#Smarty:$foo =\'smarty\'',
- '', $i ++,), array('{config_load \'template.conf\' scope=root}', true,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'newvar\'#Smarty:$foo =\'smarty\'',
- '', $i ++,), array('{config_load \'template.conf\' scope=root}', false,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'newvar\'#Smarty:$foo =\'smarty\'',
- 'no smarty', $i ++,),
- array('{config_load \'template.conf\' scope=smarty}', false,
- ':$foo =\'newvar\'#scope_include.tpl:$foo =\'newvar\'#scope_tag.tpl:$foo =\'newvar\'#data:$foo =\'data\'#Smarty:$foo =\'newvar\'',
- 'no smarty', $i ++,),);
+ $i = 0;
+ /*
+ * Code
+ * use Smarty object
+ * result
+ * test name
+ */
+ return [
+ ['{config_load \'template.conf\'}', true,
+ ':$foo =\'newvar\'#scope_include.tpl:$foo =\'data\'#scope_tag.tpl:$foo =\'data\'#data:$foo =\'data\'#global:$foo =\'smarty\'',
+ '', $i++,],
+ ];
}
/**
diff --git a/tests/UnitTests/TemplateSource/Xml/XmlTest.php b/tests/UnitTests/TemplateSource/Xml/XmlTest.php
index 542f2c41..fe7de221 100644
--- a/tests/UnitTests/TemplateSource/Xml/XmlTest.php
+++ b/tests/UnitTests/TemplateSource/Xml/XmlTest.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests of the <?xml...> tag handling
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for <?xml...> tests
*
- * @runTestsInSeparateProcess
- * @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
+ *
+ *
*/
class XmlTest extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/_Issues/327/ModifierIssue327Test.php b/tests/UnitTests/TemplateSource/_Issues/327/ModifierIssue327Test.php
index caacbebd..c9ba0d26 100644
--- a/tests/UnitTests/TemplateSource/_Issues/327/ModifierIssue327Test.php
+++ b/tests/UnitTests/TemplateSource/_Issues/327/ModifierIssue327Test.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compiler errors
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for compiler tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class ModifierIssue327Test extends PHPUnit_Smarty
{
diff --git a/tests/UnitTests/TemplateSource/_Issues/419/ExtendsIssue419Test.php b/tests/UnitTests/TemplateSource/_Issues/419/ExtendsIssue419Test.php
index 5ea20027..2079fc0a 100644
--- a/tests/UnitTests/TemplateSource/_Issues/419/ExtendsIssue419Test.php
+++ b/tests/UnitTests/TemplateSource/_Issues/419/ExtendsIssue419Test.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compiler errors
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for compiler tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class ExtendsIssue419Test extends PHPUnit_Smarty
{
@@ -27,8 +27,8 @@ class ExtendsIssue419Test extends PHPUnit_Smarty
public function testextends419()
{
- $this->smarty->left_delimiter = '{{';
- $this->smarty->right_delimiter = '}}';
+ $this->smarty->setLeftDelimiter('{{');
+ $this->smarty->setRightDelimiter('}}');
$this->assertEquals('child', $this->smarty->fetch('extends:001_parent.tpl|001_child.tpl'));
}
diff --git a/tests/UnitTests/TemplateSource/_Issues/422/NestedLoopIssue422Test.php b/tests/UnitTests/TemplateSource/_Issues/422/NestedLoopIssue422Test.php
index e8104d5c..03a48e1f 100644
--- a/tests/UnitTests/TemplateSource/_Issues/422/NestedLoopIssue422Test.php
+++ b/tests/UnitTests/TemplateSource/_Issues/422/NestedLoopIssue422Test.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compiler errors
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for compiler tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*
* Problem with total property of {section} and {foreach} in nested loop
*/
diff --git a/tests/UnitTests/TemplateSource/_Issues/428/SectionPropertiesShortSyntaxIssue428Test.php b/tests/UnitTests/TemplateSource/_Issues/428/SectionPropertiesShortSyntaxIssue428Test.php
index 7a9c6ab2..c880bcb2 100644
--- a/tests/UnitTests/TemplateSource/_Issues/428/SectionPropertiesShortSyntaxIssue428Test.php
+++ b/tests/UnitTests/TemplateSource/_Issues/428/SectionPropertiesShortSyntaxIssue428Test.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compiler errors
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for compiler tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*
* Short syntax of section properties did not work
*/
diff --git a/tests/UnitTests/TemplateSource/_Issues/549/MbSplitEncodingIssue549Test.php b/tests/UnitTests/TemplateSource/_Issues/549/MbSplitEncodingIssue549Test.php
index 7490c56b..7ddb9283 100644
--- a/tests/UnitTests/TemplateSource/_Issues/549/MbSplitEncodingIssue549Test.php
+++ b/tests/UnitTests/TemplateSource/_Issues/549/MbSplitEncodingIssue549Test.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests - issue #549 regression tests
*
- * @package PHPunit
+
* @author Andrey Repin <anrdaemon@yandex.ru>
*/
/**
* class for compiler tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*
* mb_split breaks if Smarty encoding is not the same as mbstring regex encoding.
*/
@@ -30,18 +30,13 @@ class MbSplitEncodingIssue549Test extends PHPUnit_Smarty
public function setUp(): void
{
- if(!\Smarty::$_MBSTRING)
- {
- $this->markTestSkipped("mbstring extension is not in use by Smarty");
- }
-
- $this->charset = \Smarty::$_CHARSET;
+ $this->charset = \Smarty\Smarty::$_CHARSET;
$this->setUpSmarty(__DIR__);
}
protected function tearDown(): void
{
- \Smarty::$_CHARSET = $this->charset ?: \Smarty::$_CHARSET;
+ \Smarty\Smarty::$_CHARSET = $this->charset ?: \Smarty\Smarty::$_CHARSET;
$this->cleanDirs();
}
@@ -70,7 +65,7 @@ class MbSplitEncodingIssue549Test extends PHPUnit_Smarty
\extract($data, \EXTR_SKIP);
\mb_regex_encoding($mb_regex_encoding);
- \Smarty::$_CHARSET = $mb_int_encoding;
+ \Smarty\Smarty::$_CHARSET = $mb_int_encoding;
$this->assertEquals($result, $this->smarty->fetch("string:{\"$subject\"|replace:\"$pattern\":\"$replacement\"}"));
}
diff --git a/tests/UnitTests/TemplateSource/_Issues/topic26878/NewlineSpacing.php b/tests/UnitTests/TemplateSource/_Issues/topic26878/NewlineSpacing.php
index 6fcf32ac..6de26639 100644
--- a/tests/UnitTests/TemplateSource/_Issues/topic26878/NewlineSpacing.php
+++ b/tests/UnitTests/TemplateSource/_Issues/topic26878/NewlineSpacing.php
@@ -2,16 +2,16 @@
/**
* Smarty PHPunit tests compiler errors
*
- * @package PHPunit
+
* @author Uwe Tews
*/
/**
* class for compiler tests
*
- * @runTestsInSeparateProcess
+ *
* @preserveGlobalState disabled
- * @backupStaticAttributes enabled
+ *
*/
class NewlineSpacing extends PHPUnit_Smarty
{
@@ -28,16 +28,16 @@ class NewlineSpacing extends PHPUnit_Smarty
/**
* Test spacings
*
- * @preserveGlobalState disabled
+ *
* @dataProvider dataTestSpacing
- * @runInSeparateProcess
+ *
*/
public function testSpacing($code, $result, $testName, $testNumber)
{
$name = empty($testName) ? $testNumber : $testName;
$file = "Spacing_{$name}.tpl";
$this->makeTemplateFile($file, $code);
- $this->smarty->template_dir = './templates_tmp';
+ $this->smarty->setTemplateDir('./templates_tmp');
$this->smarty->assign('file', $file);
$this->smarty->assign('foo', 'bar');
$this->assertEquals($result,