summaryrefslogtreecommitdiff
path: root/tests/UnitTests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/UnitTests')
-rw-r--r--tests/UnitTests/TemplateSource/X_Scopes/ScopeTest.php9
-rw-r--r--tests/UnitTests/__shared/PHPunitplugins/function.checkvar.php6
2 files changed, 9 insertions, 6 deletions
diff --git a/tests/UnitTests/TemplateSource/X_Scopes/ScopeTest.php b/tests/UnitTests/TemplateSource/X_Scopes/ScopeTest.php
index 4f805fae..3999538e 100644
--- a/tests/UnitTests/TemplateSource/X_Scopes/ScopeTest.php
+++ b/tests/UnitTests/TemplateSource/X_Scopes/ScopeTest.php
@@ -325,4 +325,13 @@ class ScopeTest extends PHPUnit_Smarty
$this->smarty->assign('scope', 'none');
$r = $this->smarty->fetch('test_function_scope.tpl');
}
+
+ public function testFunctionScopeIsLocalByDefault()
+ {
+ $this->assertEquals(
+ 'a',
+ $this->smarty->fetch('string:{function name=test}{$var="b"}{/function}{$var="a"}{test}{$var}')
+ );
+ }
+
}
diff --git a/tests/UnitTests/__shared/PHPunitplugins/function.checkvar.php b/tests/UnitTests/__shared/PHPunitplugins/function.checkvar.php
index 62a4e674..71740902 100644
--- a/tests/UnitTests/__shared/PHPunitplugins/function.checkvar.php
+++ b/tests/UnitTests/__shared/PHPunitplugins/function.checkvar.php
@@ -29,12 +29,6 @@ function smarty_function_checkvar($params, \Smarty\Template $template)
if (in_array('template', $types) && $ptr instanceof Template) {
$output .= "#{$ptr->getSource()->name}:\${$var} =";
$output .= $ptr->hasVariable($var) ? preg_replace('/\s/', '', var_export($ptr->getValue($var), true)) : '>unassigned<';
- $i = 0;
- while (isset($ptr->_var_stack[ $i ])) {
- $output .= "#{$ptr->_var_stack[ $i ]['name']} = ";
- $output .= isset($ptr->_var_stack[ $i ][ 'tpl' ][$var]) ? preg_replace('/\s/', '', var_export($ptr->_var_stack[ $i ][ 'tpl' ][$var]->value, true)) : '>unassigned<';
- $i ++;
- }
$ptr = $ptr->parent;
} elseif (in_array('data', $types) && !($ptr instanceof Template || $ptr instanceof \Smarty\Smarty)) {
$output .= "#data:\${$var} =";