This commit is contained in:
Uwe Tews
2015-05-04 03:52:20 +02:00
parent d3e78d81bc
commit 819b852809
7 changed files with 58 additions and 22 deletions

View File

@@ -4,10 +4,10 @@
For installing the PHPUnit test by composer use the following: For installing the PHPUnit test by composer use the following:
"require-dev": { "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 Starting with Smarty version 3.1.22 the "require-dev" section will be added
to the composer.json file of the Smarty distribution. to the composer.json file of the Smarty distribution.

View File

@@ -332,8 +332,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/** /**
* @expectedException SmartyCompilerException * @expectedException SmartyCompilerException
* @expectedExceptionMessage Syntax Error in template ".\templates\025_parent.tpl" * @expectedExceptionMessage Syntax error in template ".\templates\025_parent.tpl"
* @expectedExceptionMessage {$smarty.block.child} used out of context * @expectedExceptionMessage tag {$smarty.block.child} used outside {block} tags
* test {$this->smarty.block.child} outside {block] * test {$this->smarty.block.child} outside {block]
*/ */
public function testSmartyBlockChildOutsideBlock_025() public function testSmartyBlockChildOutsideBlock_025()
@@ -343,8 +343,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/** /**
* @expectedException SmartyCompilerException * @expectedException SmartyCompilerException
* @expectedExceptionMessage Syntax Error in template ".\templates\026_parent.tpl" * @expectedExceptionMessage Syntax error in template ".\templates\026_parent.tpl"
* @expectedExceptionMessage $smarty.block is invalid * @expectedExceptionMessage tag {$smarty.block.parent} used outside {block} tags
* test {$this->smarty.block.parent} outside {block] * test {$this->smarty.block.parent} outside {block]
*/ */
public function testSmartyBlockParentOutsideBlock_026() public function testSmartyBlockParentOutsideBlock_026()
@@ -354,8 +354,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
/** /**
* @expectedException SmartyCompilerException * @expectedException SmartyCompilerException
* @expectedExceptionMessage Syntax Error in template ".\templates\027_parent.tpl" * @expectedExceptionMessage Syntax error in template ".\templates\027_parent.tpl"
* @expectedExceptionMessage $smarty.block is invalid * @expectedExceptionMessage illegal {$smarty.block.parent} in parent template
* test {$this->smarty.block.parent} in parent template * test {$this->smarty.block.parent} in parent template
*/ */
public function testSmartyBlockParentInParent_027() public function testSmartyBlockParentInParent_027()

View File

@@ -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}'); $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)); $this->assertEquals(str_replace("\r", '', $result), $this->smarty->fetch($tpl));
} }
public function testMeridian3()
{
$n = "\n";
$time = mktime(0, 15, 11, 2, 20, 2011);
$result = '<select name="Time_Hour">' . $n . '<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12" selected="selected">12</option>
</select>
<select name="Time_Meridian">
<option value="am">AM</option>
<option value="pm">PM</option>
</select>';
$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() public function testMeridian4()
{ {
$n = "\n"; $n = "\n";

View File

@@ -26,8 +26,8 @@ class AttributeTest extends PHPUnit_Smarty
/** /**
* @expectedException SmartyCompilerException * @expectedException SmartyCompilerException
* @expectedExceptionMessage Syntax Error in template &quot;b8ecd121bbbc031241b1116a9db691a759eceadf&quot; * @expectedExceptionMessage Syntax error in template "b8ecd121bbbc031241b1116a9db691a759eceadf"
* @expectedExceptionMessage missing &quot;var&quot; attribute * @expectedExceptionMessage missing "var" attribute
* test required attribute * test required attribute
*/ */
public function testRequiredAttributeVar() public function testRequiredAttributeVar()
@@ -37,8 +37,8 @@ class AttributeTest extends PHPUnit_Smarty
/** /**
* @expectedException SmartyCompilerException * @expectedException SmartyCompilerException
* @expectedExceptionMessage Syntax Error in template &quot;46d3649920e0043f055702ef3ceef0ecdc44b892&quot; * @expectedExceptionMessage Syntax error in template "46d3649920e0043f055702ef3ceef0ecdc44b892"
* @expectedExceptionMessage unexpected &quot;bar&quot; attribute * @expectedExceptionMessage unexpected "bar" attribute
* test unexpected attribute * test unexpected attribute
*/ */
public function testUnexpectedAttribute() public function testUnexpectedAttribute()
@@ -48,8 +48,8 @@ class AttributeTest extends PHPUnit_Smarty
/** /**
* @expectedException SmartyCompilerException * @expectedException SmartyCompilerException
* @expectedExceptionMessage Syntax Error in template &quot;d6c824b50e89d8fe12b393ae8ab68daeb7b6c240&quot; * @expectedExceptionMessage Syntax error in template "d6c824b50e89d8fe12b393ae8ab68daeb7b6c240"
* @expectedExceptionMessage illegal value of option flag &quot;nocache&quot; * @expectedExceptionMessage illegal value of option flag "nocache"
* test illegal option value * test illegal option value
*/ */
public function testIllegalOptionValue() public function testIllegalOptionValue()
@@ -59,7 +59,7 @@ class AttributeTest extends PHPUnit_Smarty
/** /**
* @expectedException SmartyCompilerException * @expectedException SmartyCompilerException
* @expectedExceptionMessage Syntax Error in template &quot;a119616ffa139e7b1145b1cd36adbff7bc9be7cf&quot; * @expectedExceptionMessage Syntax error in template "a119616ffa139e7b1145b1cd36adbff7bc9be7cf"
* @expectedExceptionMessage too many shorthand attributes * @expectedExceptionMessage too many shorthand attributes
* test too many shorthands * test too many shorthands
*/ */

View File

@@ -35,8 +35,8 @@ class CompileErrorTest extends PHPUnit_Smarty
/** /**
* @expectedException SmartyCompilerException * @expectedException SmartyCompilerException
* @expectedExceptionMessage Syntax Error in template &quot;2510bcd51cbc69725f2c3d3484b2c70c00ddaeba&quot; * @expectedExceptionMessage Syntax error in template "2510bcd51cbc69725f2c3d3484b2c70c00ddaeba"
* @expectedExceptionMessage unknown tag &quot;unknown&quot; * @expectedExceptionMessage unknown tag "unknown"
* test unkown tag error * test unkown tag error
*/ */
public function testUnknownTagError() public function testUnknownTagError()
@@ -56,8 +56,8 @@ class CompileErrorTest extends PHPUnit_Smarty
/** /**
* @expectedException SmartyCompilerException * @expectedException SmartyCompilerException
* @expectedExceptionMessage Syntax Error in template &quot;599a9cf0e3623a3206bd02a0f5c151d5f5f3f69e&quot; * @expectedExceptionMessage Syntax error in template "599a9cf0e3623a3206bd02a0f5c151d5f5f3f69e"
* @expectedExceptionMessage Unexpected &quot;}&quot; * @expectedExceptionMessage Unexpected "}"
* test syntax error * test syntax error
*/ */
public function testSyntaxError() public function testSyntaxError()

View File

@@ -166,8 +166,8 @@ class ModifierTest extends PHPUnit_Smarty
/** /**
* @expectedException SmartyCompilerException * @expectedException SmartyCompilerException
* @expectedExceptionMessage Syntax Error in template &quot;4d2e368c483a648d14bbd59592da92aff3b96a2f&quot; * @expectedExceptionMessage Syntax error in template "4d2e368c483a648d14bbd59592da92aff3b96a2f"
* @expectedExceptionMessage unknown modifier &quot;unknown&quot; * @expectedExceptionMessage unknown modifier "unknown"
* test unknown modifier error * test unknown modifier error
*/ */
public function testUnknownModifier() public function testUnknownModifier()

View File

@@ -131,6 +131,19 @@ class FilterTest extends PHPUnit_Smarty
$tpl->assign('foo', '<?php ?>'); $tpl->assign('foo', '<?php ?>');
$this->assertEquals('&lt;?php ?&gt;', $this->smarty->fetch($tpl)); $this->assertEquals('&lt;?php ?&gt;', $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 Class VarFilter