From 819b852809934bc77414fc74969fb7d5d7a91fc9 Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Mon, 4 May 2015 03:52:20 +0200 Subject: [PATCH] 3.1.15 --- tests/README.md | 4 +-- .../BockExtend/CompileBlockExtendsTest.php | 12 ++++----- .../PluginFunctionHtmlSelectTimeTest.php | 25 ++++++++++++++++++- .../TagTests/_Attributes/AttributeTest.php | 14 +++++------ .../TagTests/_Error/CompileErrorTest.php | 8 +++--- .../ValueTests/Modifier/ModifierTest.php | 4 +-- tests/UnitTests/_Core/Filter/FilterTest.php | 13 ++++++++++ 7 files changed, 58 insertions(+), 22 deletions(-) diff --git a/tests/README.md b/tests/README.md index b7400f19..395a35ba 100644 --- a/tests/README.md +++ b/tests/README.md @@ -4,10 +4,10 @@ For installing the PHPUnit test by composer use the following: "require-dev": { - "smarty/smarty-phpunit": "3.1.14" + "smarty/smarty-phpunit": "3.1.15" } -Replace 3.1.14 with the installed Smarty version number. +Replace 3.1.15 with the installed Smarty version number. Starting with Smarty version 3.1.22 the "require-dev" section will be added to the composer.json file of the Smarty distribution. diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php index 74101d4d..1133d485 100644 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php @@ -332,8 +332,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty /** * @expectedException SmartyCompilerException - * @expectedExceptionMessage Syntax Error in template ".\templates\025_parent.tpl" - * @expectedExceptionMessage {$smarty.block.child} used out of context + * @expectedExceptionMessage Syntax error in template ".\templates\025_parent.tpl" + * @expectedExceptionMessage tag {$smarty.block.child} used outside {block} tags * test {$this->smarty.block.child} outside {block] */ public function testSmartyBlockChildOutsideBlock_025() @@ -343,8 +343,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty /** * @expectedException SmartyCompilerException - * @expectedExceptionMessage Syntax Error in template ".\templates\026_parent.tpl" - * @expectedExceptionMessage $smarty.block is invalid + * @expectedExceptionMessage Syntax error in template ".\templates\026_parent.tpl" + * @expectedExceptionMessage tag {$smarty.block.parent} used outside {block} tags * test {$this->smarty.block.parent} outside {block] */ public function testSmartyBlockParentOutsideBlock_026() @@ -354,8 +354,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty /** * @expectedException SmartyCompilerException - * @expectedExceptionMessage Syntax Error in template ".\templates\027_parent.tpl" - * @expectedExceptionMessage $smarty.block is invalid + * @expectedExceptionMessage Syntax error in template ".\templates\027_parent.tpl" + * @expectedExceptionMessage illegal {$smarty.block.parent} in parent template * test {$this->smarty.block.parent} in parent template */ public function testSmartyBlockParentInParent_027() diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectTimeTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectTimeTest.php index 6584d7f4..e2b920b2 100644 --- a/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectTimeTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/PluginFunction/PluginFunctionHtmlSelectTimeTest.php @@ -848,7 +848,30 @@ class PluginFunctionHtmlSelectTimeTest extends PHPUnit_Smarty $tpl = $this->smarty->createTemplate('eval:{html_select_time time=' . $this->now . ' use_24_hours=false display_meridian=false}'); $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl)); } - + public function testMeridian3() + { + $n = "\n"; + $time = mktime(0, 15, 11, 2, 20, 2011); + $result = ' +'; + $tpl = $this->smarty->createTemplate('eval:{html_select_time time=' . $time . ' use_24_hours=false display_minutes=false display_seconds=false}'); + $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl)); + } public function testMeridian4() { $n = "\n"; diff --git a/tests/UnitTests/TemplateSource/TagTests/_Attributes/AttributeTest.php b/tests/UnitTests/TemplateSource/TagTests/_Attributes/AttributeTest.php index 0ac1e2cb..23a2885b 100644 --- a/tests/UnitTests/TemplateSource/TagTests/_Attributes/AttributeTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/_Attributes/AttributeTest.php @@ -26,8 +26,8 @@ class AttributeTest extends PHPUnit_Smarty /** * @expectedException SmartyCompilerException - * @expectedExceptionMessage Syntax Error in template "b8ecd121bbbc031241b1116a9db691a759eceadf" - * @expectedExceptionMessage missing "var" attribute + * @expectedExceptionMessage Syntax error in template "b8ecd121bbbc031241b1116a9db691a759eceadf" + * @expectedExceptionMessage missing "var" attribute * test required attribute */ public function testRequiredAttributeVar() @@ -37,8 +37,8 @@ class AttributeTest extends PHPUnit_Smarty /** * @expectedException SmartyCompilerException - * @expectedExceptionMessage Syntax Error in template "46d3649920e0043f055702ef3ceef0ecdc44b892" - * @expectedExceptionMessage unexpected "bar" attribute + * @expectedExceptionMessage Syntax error in template "46d3649920e0043f055702ef3ceef0ecdc44b892" + * @expectedExceptionMessage unexpected "bar" attribute * test unexpected attribute */ public function testUnexpectedAttribute() @@ -48,8 +48,8 @@ class AttributeTest extends PHPUnit_Smarty /** * @expectedException SmartyCompilerException - * @expectedExceptionMessage Syntax Error in template "d6c824b50e89d8fe12b393ae8ab68daeb7b6c240" - * @expectedExceptionMessage illegal value of option flag "nocache" + * @expectedExceptionMessage Syntax error in template "d6c824b50e89d8fe12b393ae8ab68daeb7b6c240" + * @expectedExceptionMessage illegal value of option flag "nocache" * test illegal option value */ public function testIllegalOptionValue() @@ -59,7 +59,7 @@ class AttributeTest extends PHPUnit_Smarty /** * @expectedException SmartyCompilerException - * @expectedExceptionMessage Syntax Error in template "a119616ffa139e7b1145b1cd36adbff7bc9be7cf" + * @expectedExceptionMessage Syntax error in template "a119616ffa139e7b1145b1cd36adbff7bc9be7cf" * @expectedExceptionMessage too many shorthand attributes * test too many shorthands */ diff --git a/tests/UnitTests/TemplateSource/TagTests/_Error/CompileErrorTest.php b/tests/UnitTests/TemplateSource/TagTests/_Error/CompileErrorTest.php index bbd63eab..ca561774 100644 --- a/tests/UnitTests/TemplateSource/TagTests/_Error/CompileErrorTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/_Error/CompileErrorTest.php @@ -35,8 +35,8 @@ class CompileErrorTest extends PHPUnit_Smarty /** * @expectedException SmartyCompilerException - * @expectedExceptionMessage Syntax Error in template "2510bcd51cbc69725f2c3d3484b2c70c00ddaeba" - * @expectedExceptionMessage unknown tag "unknown" + * @expectedExceptionMessage Syntax error in template "2510bcd51cbc69725f2c3d3484b2c70c00ddaeba" + * @expectedExceptionMessage unknown tag "unknown" * test unkown tag error */ public function testUnknownTagError() @@ -56,8 +56,8 @@ class CompileErrorTest extends PHPUnit_Smarty /** * @expectedException SmartyCompilerException - * @expectedExceptionMessage Syntax Error in template "599a9cf0e3623a3206bd02a0f5c151d5f5f3f69e" - * @expectedExceptionMessage Unexpected "}" + * @expectedExceptionMessage Syntax error in template "599a9cf0e3623a3206bd02a0f5c151d5f5f3f69e" + * @expectedExceptionMessage Unexpected "}" * test syntax error */ public function testSyntaxError() diff --git a/tests/UnitTests/TemplateSource/ValueTests/Modifier/ModifierTest.php b/tests/UnitTests/TemplateSource/ValueTests/Modifier/ModifierTest.php index 969ec878..a488d583 100644 --- a/tests/UnitTests/TemplateSource/ValueTests/Modifier/ModifierTest.php +++ b/tests/UnitTests/TemplateSource/ValueTests/Modifier/ModifierTest.php @@ -166,8 +166,8 @@ class ModifierTest extends PHPUnit_Smarty /** * @expectedException SmartyCompilerException - * @expectedExceptionMessage Syntax Error in template "4d2e368c483a648d14bbd59592da92aff3b96a2f" - * @expectedExceptionMessage unknown modifier "unknown" + * @expectedExceptionMessage Syntax error in template "4d2e368c483a648d14bbd59592da92aff3b96a2f" + * @expectedExceptionMessage unknown modifier "unknown" * test unknown modifier error */ public function testUnknownModifier() diff --git a/tests/UnitTests/_Core/Filter/FilterTest.php b/tests/UnitTests/_Core/Filter/FilterTest.php index 2ab4700f..e65e9d1b 100644 --- a/tests/UnitTests/_Core/Filter/FilterTest.php +++ b/tests/UnitTests/_Core/Filter/FilterTest.php @@ -131,6 +131,19 @@ class FilterTest extends PHPUnit_Smarty $tpl->assign('foo', ''); $this->assertEquals('<?php ?>', $this->smarty->fetch($tpl)); } + + /** + * test registered post filter + */ + public function testRegisteredVariableFilter2() + { + $var = new VarFilter(); + + $this->smarty->registerFilter(Smarty::FILTER_VARIABLE, array($var, 'variablefilter')); + $tpl = $this->smarty->createTemplate('string:{$foo}'); + $tpl->assign('foo', 'bar'); + $this->assertEquals('var{$foo}bar', $this->smarty->fetch($tpl)); + } } Class VarFilter