update scope with test for {assign.. noscope}

This commit is contained in:
uwetews
2016-08-14 03:11:10 +02:00
parent e3f5e325ab
commit 1d76572e9a
2 changed files with 112 additions and 135 deletions

View File

@@ -46,7 +46,8 @@ class ScopeTest extends PHPUnit_Smarty
$data = $this->smarty->createData($data1);
$data1->assign('foo', 'data1');
$data->assign('foo', 'data');
$this->assertEquals($this->strip($result), $this->strip($this->smarty->fetch('scope_tag.tpl', $data)), "test - {$code} - {$testName}");
$this->assertEquals($this->strip($result), $this->strip($this->smarty->fetch('scope_tag.tpl', $data)),
"test - {$code} - {$testName}");
}
/*
@@ -61,26 +62,18 @@ 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 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 ++,),);
}
/**
* Test scope
*
@@ -97,7 +90,8 @@ class ScopeTest extends PHPUnit_Smarty
$this->smarty->assignGlobal('foo', 'global');
$data = $this->smarty->createData($useSmarty ? $this->smarty : null);
$data->assign('foo', 'data');
$this->assertEquals($this->strip('#' . $file . $result), $this->strip($this->smarty->fetch('scope_tag.tpl', $data)), "test - {$code} - {$testName}");
$this->assertEquals($this->strip('#' . $file . $result),
$this->strip($this->smarty->fetch('scope_tag.tpl', $data)), "test - {$code} - {$testName}");
}
/*
@@ -105,60 +99,39 @@ class ScopeTest extends PHPUnit_Smarty
*/
public function dataTestAssignScope()
{
$i = 1;
$i = 0;
/*
* Code
* use Smarty object
* 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 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 ++,),);
}
/**
@@ -187,36 +160,28 @@ class ScopeTest extends PHPUnit_Smarty
* variable value
* result
*/
return array(
array(
'b1', 'test_scope_assignbar.tpl',
'#test_scope_assignbar.tpl:$foo=\'b1\'#Smarty:$foo=\'smarty\'#global:$foo=\'b1\'',
), array(
'b2', 'test_scope_assignbar.tpl',
'#test_scope_assignbar.tpl:$foo=\'b2\'#Smarty:$foo=\'smarty\'#global:$foo=\'b2\'',
), array(
'b1', 'test_scope_assignnocache.tpl',
'#test_scope_assignnocache.tpl:$foo=\'b1\'#Smarty:$foo=\'smarty\'#global:$foo=\'b1\'',
), array(
'b2', 'test_scope_assignnocache.tpl',
'#test_scope_assignnocache.tpl:$foo=\'b2\'#Smarty:$foo=\'smarty\'#global:$foo=\'b2\'',
),
);
return array(array('b1', 'test_scope_assignbar.tpl',
'#test_scope_assignbar.tpl:$foo=\'b1\'#Smarty:$foo=\'smarty\'#global:$foo=\'b1\'',),
array('b2', 'test_scope_assignbar.tpl',
'#test_scope_assignbar.tpl:$foo=\'b2\'#Smarty:$foo=\'smarty\'#global:$foo=\'b2\'',),
array('b1', 'test_scope_assignnocache.tpl',
'#test_scope_assignnocache.tpl:$foo=\'b1\'#Smarty:$foo=\'smarty\'#global:$foo=\'b1\'',),
array('b2', 'test_scope_assignnocache.tpl',
'#test_scope_assignnocache.tpl:$foo=\'b2\'#Smarty:$foo=\'smarty\'#global:$foo=\'b2\'',),);
}
/**
* Test scope
*
* @run InSeparateProcess
* @run InSeparateProcess
* @preserveGlobalState disabled
* @dataProvider dataTestIncludeScope
*/
public function testIncludeScope($code, $useSmarty, $result, $testName, $testNumber = null)
{
if ($testNumber) {
$file = "testIncludeScope_{$testNumber}.tpl";
$this->makeTemplateFile($file, $code);
$this->smarty->assignGlobal('file', $file);
}
$file = "testIncludeScope_{$testNumber}.tpl";
$this->makeTemplateFile($file, $code);
$this->smarty->assignGlobal('file', $file);
$this->smarty->assign('foo', 'smarty');
$this->smarty->assignGlobal('foo', 'global');
$data = $this->smarty->createData($useSmarty ? $this->smarty : null);
@@ -233,23 +198,47 @@ class ScopeTest extends PHPUnit_Smarty
*/
public function dataTestIncludeScope()
{
$i = 1;
$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.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 ++),);
}
/**
* Test scope
*
@@ -265,7 +254,8 @@ class ScopeTest extends PHPUnit_Smarty
$this->smarty->configLoad('smarty.conf');
$data = $this->smarty->createData($useSmarty ? $this->smarty : null);
$data->configLoad('data.conf');
$this->assertEquals($this->strip('#' . $file . $result), $this->strip($this->smarty->fetch('scope_tag.tpl', $data)), "test - {$code} - {$testName}");
$this->assertEquals($this->strip('#' . $file . $result),
$this->strip($this->smarty->fetch('scope_tag.tpl', $data)), "test - {$code} - {$testName}");
}
/*
@@ -273,49 +263,35 @@ class ScopeTest extends PHPUnit_Smarty
*/
public function dataTestConfigScope()
{
$i = 1;
$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 ++,
),
);
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 ++,),);
}
public function testFunctionScope() {
public function testFunctionScope()
{
$this->smarty->assign('scope', 'none');
$r = $this->smarty->fetch('test_function_scope.tpl');
}
}

View File

@@ -0,0 +1 @@
{$foo = 'newvar' noscope}{checkvar var=foo}