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); $data = $this->smarty->createData($data1);
$data1->assign('foo', 'data1'); $data1->assign('foo', 'data1');
$data->assign('foo', 'data'); $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 * result
* test name * test name
*/ */
return array( return array(array('{$foo[] = \'newvar\' scope=tpl_root}', true,
array( '#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\'',
'{$foo[] = \'newvar\' scope=tpl_root}', true, '', $i ++,), array('{append var=foo value=\'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\'', '#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 ++, '', $i ++,), array('{append var=foo value=\'newvar\' scope=global}', true,
), array( '#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\',)',
'{append var=foo value=\'newvar\' scope=tpl_root}', true, '', $i ++,),
'#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\'', array('{append var=foo value=\'newvar\' scope=smarty}', true,
'', $i ++, '#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\'',
), array( '', $i ++,),);
'{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 * Test scope
* *
@@ -97,7 +90,8 @@ class ScopeTest extends PHPUnit_Smarty
$this->smarty->assignGlobal('foo', 'global'); $this->smarty->assignGlobal('foo', 'global');
$data = $this->smarty->createData($useSmarty ? $this->smarty : null); $data = $this->smarty->createData($useSmarty ? $this->smarty : null);
$data->assign('foo', 'data'); $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() public function dataTestAssignScope()
{ {
$i = 1; $i = 0;
/* /*
* Code * Code
* use Smarty object * use Smarty object
* result * result
* test name * test name
*/ */
return array( return array(array('{$foo = \'newvar\'}', true,
array( ':$foo=\'newvar\'#scope_include.tpl:$foo=\'data\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'',
'{$foo = \'newvar\'}', true, '', $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\'', ':$foo=\'newvar\'#scope_include.tpl:$foo=\'data\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'',
'', $i ++, '', $i ++,), array('{$foo = \'newvar\' scope=local}', true,
), array( ':$foo=\'newvar\'#scope_include.tpl:$foo=\'data\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'',
'{assign var=foo value=\'newvar\'}', true, '', $i ++,),
':$foo=\'newvar\'#scope_include.tpl:$foo=\'data\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'', array('{assign var=foo value=\'newvar\' scope=local}', true,
'', $i ++, ':$foo=\'newvar\'#scope_include.tpl:$foo=\'data\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'',
), array( '', $i ++,), array('{$foo = \'newvar\' scope=parent}', true,
'{$foo = \'newvar\' scope=local}', true, ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'',
':$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=parent}', true,
'', $i ++, ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'',
), array( '', $i ++,),
'{assign var=foo value=\'newvar\' scope=local}', true, array('{$foo = \'newvar\' scope=tpl_root}', true,
':$foo=\'newvar\'#scope_include.tpl:$foo=\'data\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'', ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'newvar\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'',
'', $i ++, '', $i ++,), array('{$foo = \'newvar\' scope=global}', true,
), array( ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'newvar\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'newvar\'',
'{$foo = \'newvar\' scope=parent}', true, '', $i ++,), array('{$foo = \'newvar\' scope=root}', true,
':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'', ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'newvar\'#data:$foo=\'newvar\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'',
'', $i ++, '', $i ++,),
), array( array('{$foo = \'newvar\' scope=root}', false,
'{assign var=foo value=\'newvar\' scope=parent}', true, ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'newvar\'#data:$foo=\'newvar\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'',
':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'', 'no smarty', $i ++,), array('{$foo = \'newvar\' scope=smarty}', false,
'', $i ++, ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'newvar\'#data:$foo=\'data\'#Smarty:$foo=\'newvar\'#global:$foo=\'global\'',
), array( 'no smarty', $i ++,),);
'{$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 * variable value
* result * result
*/ */
return array( return array(array('b1', 'test_scope_assignbar.tpl',
array( '#test_scope_assignbar.tpl:$foo=\'b1\'#Smarty:$foo=\'smarty\'#global:$foo=\'b1\'',),
'b1', 'test_scope_assignbar.tpl', array('b2', 'test_scope_assignbar.tpl',
'#test_scope_assignbar.tpl:$foo=\'b1\'#Smarty:$foo=\'smarty\'#global:$foo=\'b1\'', '#test_scope_assignbar.tpl:$foo=\'b2\'#Smarty:$foo=\'smarty\'#global:$foo=\'b2\'',),
), array( array('b1', 'test_scope_assignnocache.tpl',
'b2', 'test_scope_assignbar.tpl', '#test_scope_assignnocache.tpl:$foo=\'b1\'#Smarty:$foo=\'smarty\'#global:$foo=\'b1\'',),
'#test_scope_assignbar.tpl:$foo=\'b2\'#Smarty:$foo=\'smarty\'#global:$foo=\'b2\'', array('b2', 'test_scope_assignnocache.tpl',
), array( '#test_scope_assignnocache.tpl:$foo=\'b2\'#Smarty:$foo=\'smarty\'#global:$foo=\'b2\'',),);
'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 * Test scope
* *
* @run InSeparateProcess * @run InSeparateProcess
* @preserveGlobalState disabled * @preserveGlobalState disabled
* @dataProvider dataTestIncludeScope * @dataProvider dataTestIncludeScope
*/ */
public function testIncludeScope($code, $useSmarty, $result, $testName, $testNumber = null) public function testIncludeScope($code, $useSmarty, $result, $testName, $testNumber = null)
{ {
if ($testNumber) { $file = "testIncludeScope_{$testNumber}.tpl";
$file = "testIncludeScope_{$testNumber}.tpl"; $this->makeTemplateFile($file, $code);
$this->makeTemplateFile($file, $code); $this->smarty->assignGlobal('file', $file);
$this->smarty->assignGlobal('file', $file);
}
$this->smarty->assign('foo', 'smarty'); $this->smarty->assign('foo', 'smarty');
$this->smarty->assignGlobal('foo', 'global'); $this->smarty->assignGlobal('foo', 'global');
$data = $this->smarty->createData($useSmarty ? $this->smarty : null); $data = $this->smarty->createData($useSmarty ? $this->smarty : null);
@@ -233,23 +198,47 @@ class ScopeTest extends PHPUnit_Smarty
*/ */
public function dataTestIncludeScope() public function dataTestIncludeScope()
{ {
$i = 1; $i = 0;
return array(/* return array(/*
* Code * Code
* use Smarty object * use Smarty object
* result * result
* test name * 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\'}', true,
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++), '#test_scope_assign.tpl:$foo=\'newvar\'#testIncludeScope_' . $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++), '.tpl:$foo=\'data\'#test_scope.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'',
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++), '', $i ++), array('{include \'test_scope_assign.tpl\' scope=parent}', true,
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++), '#test_scope_assign.tpl:$foo=\'newvar\'#testIncludeScope_' . $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++), '.tpl:$foo=\'newvar\'#test_scope.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'#global:$foo=\'global\'',
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++), '', $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\' 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 * Test scope
* *
@@ -265,7 +254,8 @@ class ScopeTest extends PHPUnit_Smarty
$this->smarty->configLoad('smarty.conf'); $this->smarty->configLoad('smarty.conf');
$data = $this->smarty->createData($useSmarty ? $this->smarty : null); $data = $this->smarty->createData($useSmarty ? $this->smarty : null);
$data->configLoad('data.conf'); $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() public function dataTestConfigScope()
{ {
$i = 1; $i = 0;
/* /*
* Code * Code
* use Smarty object * use Smarty object
* result * result
* test name * test name
*/ */
return array( return array(array('{config_load \'template.conf\'}', true,
array( ':$foo=\'newvar\'#scope_include.tpl:$foo=\'data\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'',
'{config_load \'template.conf\'}', true, '', $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\'', ':$foo=\'newvar\'#scope_include.tpl:$foo=\'data\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'',
'', $i ++, '', $i ++,), array('{config_load \'template.conf\' scope=parent}', true,
), array( ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'',
'{config_load \'template.conf\' scope=local}', true, '', $i ++,),
':$foo=\'newvar\'#scope_include.tpl:$foo=\'data\'#scope_tag.tpl:$foo=\'data\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'', array('{config_load \'template.conf\' scope=tpl_root}', true,
'', $i ++, ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'newvar\'#data:$foo=\'data\'#Smarty:$foo=\'smarty\'',
), array( '', $i ++,), array('{config_load \'template.conf\' scope=root}', true,
'{config_load \'template.conf\' scope=parent}', true, ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'newvar\'#data:$foo=\'newvar\'#Smarty:$foo=\'smarty\'',
':$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=root}', false,
'', $i ++, ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'newvar\'#data:$foo=\'newvar\'#Smarty:$foo=\'smarty\'',
), array( 'no smarty', $i ++,),
'{config_load \'template.conf\' scope=tpl_root}', true, 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=\'smarty\'', ':$foo=\'newvar\'#scope_include.tpl:$foo=\'newvar\'#scope_tag.tpl:$foo=\'newvar\'#data:$foo=\'data\'#Smarty:$foo=\'newvar\'',
'', $i ++, 'no 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'); $this->smarty->assign('scope', 'none');
$r = $this->smarty->fetch('test_function_scope.tpl'); $r = $this->smarty->fetch('test_function_scope.tpl');
} }
} }

View File

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