diff --git a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/VariableScopeTest.php b/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/VariableScopeTest.php deleted file mode 100644 index c35a8495..00000000 --- a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/VariableScopeTest.php +++ /dev/null @@ -1,214 +0,0 @@ -setUpSmarty(dirname(__FILE__)); - - $this->smarty->assign('foo', 'bar'); - } - - public function testInit() - { - $this->cleanDirs(); - } - - /** - * test root variable - */ - public function testVariableScope1_0() - { - $tpl = $this->smarty->createTemplate('foo.tpl', null, null, $this->smarty); - $this->assertEquals("bar", $this->smarty->fetch($tpl)); - } - - public function testVariableScope1_1() - { - $this->assertEquals("bar", $this->smarty->fetch('foo.tpl', null, null, $this->smarty)); - } - - public function testVariableScope12_0() - { - $tpl = $this->smarty->createTemplate('foo.tpl', $this->smarty); - $this->assertEquals("bar", $this->smarty->fetch($tpl)); - } - - public function testVariableScope12_1() - { - $this->assertEquals("bar", $this->smarty->fetch('foo.tpl', $this->smarty)); - } - - public function testVariableScope13() - { - $tpl = $this->smarty->createTemplate('foo.tpl', $this->smarty); - $this->assertEquals("bar", $tpl->fetch()); - } - - /** - * test root variable with data object chain - */ - public function testVariableScope2() - { - $data1 = new Smarty_Data($this->smarty); - $data2 = new Smarty_Data($data1); - $tpl = $this->smarty->createTemplate('foo.tpl', null, null, $data2); - $this->assertEquals("bar", $this->smarty->fetch($tpl)); - } - - public function testVariableScope22() - { - $data1 = new Smarty_Data($this->smarty); - $data2 = new Smarty_Data($data1); - $tpl = $this->smarty->createTemplate('foo.tpl', $data2); - $this->assertEquals("bar", $this->smarty->fetch($tpl)); - } - - public function testVariableScope23() - { - $data1 = new Smarty_Data($this->smarty); - $data2 = new Smarty_Data($data1); - $tpl = $this->smarty->createTemplate('foo.tpl', $data2); - $this->assertEquals("bar", $tpl->fetch()); - } - - /** - * test overwrite variable with data object chain - */ - public function testVariableScope3() - { - $data1 = new Smarty_Data($this->smarty); - $data1->assign('foo', 'newvalue'); - $data2 = new Smarty_Data($data1); - $tpl = $this->smarty->createTemplate('foo.tpl', null, null, $data2); - // must see the new value - $this->assertEquals("newvalue", $this->smarty->fetch($tpl)); - } - - public function testVariableScope32() - { - $data1 = new Smarty_Data($this->smarty); - $data2 = new Smarty_Data($data1); - $tpl = $this->smarty->createTemplate('foo.tpl', $data2); - // must see the old value at root - $this->assertEquals("bar", $this->smarty->fetch($tpl)); - } - - /** - * test local variable not seen global - */ - public function testVariableScope4() - { - $this->smarty->setErrorReporting(error_reporting() & ~(E_NOTICE | E_USER_NOTICE)); - $tpl = $this->smarty->createTemplate("eval:{\$foo2='localvar'}{\$foo2}", null, null, $this->smarty); - // must see local value - $this->assertEquals("localvar", $this->smarty->fetch($tpl)); - // must see $foo2 - $tpl2 = $this->smarty->createTemplate("eval:{\$foo2}", null, null, $this->smarty); - $this->assertEquals("", $this->smarty->fetch($tpl2)); - } - - public function testVariableScope42() - { - $this->smarty->setErrorReporting(error_reporting() & ~(E_NOTICE | E_USER_NOTICE)); - $tpl = $this->smarty->createTemplate("eval:{\$foo2='localvar'}{\$foo2}", null, null, $this->smarty); - // must see local value - $this->assertEquals("localvar", $this->smarty->fetch($tpl)); - // must see $foo2 - $tpl2 = $this->smarty->createTemplate("eval:{\$foo2}", $this->smarty); - $this->assertEquals("", $this->smarty->fetch($tpl2)); - } - - /** - * test overwriting by global variable - */ - public function testVariableScope5() - { - // create variable $foo2 - $this->smarty->assign('foo2', 'oldvalue'); - $tpl = $this->smarty->createTemplate("eval:{assign var=foo2 value='newvalue' scope=parent}{\$foo2}", null, null, $this->smarty); - // must see the new value - $this->assertEquals("newvalue", $this->smarty->fetch($tpl)); - $tpl2 = $this->smarty->createTemplate("eval:{\$foo2}", null, null, $this->smarty); - // must see the new value at root - $this->assertEquals("newvalue", $this->smarty->fetch($tpl2)); - } - - public function testVariableScope52() - { - // create variable $foo2 - $this->smarty->assign('foo2', 'oldvalue'); - $tpl = $this->smarty->createTemplate("eval:{assign var=foo2 value='newvalue' scope=parent}{\$foo2}", null, null, $this->smarty); - // must see the new value - $this->assertEquals("newvalue", $this->smarty->fetch($tpl)); - $tpl2 = $this->smarty->createTemplate("eval:{\$foo2}", $this->smarty); - // must see the new value at root - $this->assertEquals("newvalue", $this->smarty->fetch($tpl2)); - } - - /** - * test creation of global variable in outerscope - */ - public function testVariableScope6() - { - // create global variable $foo2 in template - $tpl = $this->smarty->createTemplate("eval:{assign var=foo2 value='newvalue' scope=parent}{\$foo2}", null, null, $this->smarty); - // must see the new value - $this->assertEquals("newvalue", $this->smarty->fetch($tpl)); - $tpl2 = $this->smarty->createTemplate("eval:{\$foo2}", null, null, $this->smarty); - // must see the new value at root - $this->assertEquals("newvalue", $this->smarty->fetch($tpl2)); - } - - public function testVariableScope62() - { - // create global variable $foo2 in template - $tpl = $this->smarty->createTemplate("eval:{assign var=foo2 value='newvalue' scope=parent}{\$foo2}", null, null, $this->smarty); - // must see the new value - $this->assertEquals("newvalue", $this->smarty->fetch($tpl)); - $tpl2 = $this->smarty->createTemplate("eval:{\$foo2}", $this->smarty); - // must see the new value at root - $this->assertEquals("newvalue", $this->smarty->fetch($tpl2)); - } - - public function testDataArray() - { - // create global variable $foo2 in template - $tpl = $this->smarty->createTemplate("eval:{\$foo} {\$foo2}", array('foo' => 'bar', 'foo2' => 'bar2')); - $this->assertEquals("bar bar2", $this->smarty->fetch($tpl)); - } - - public function testDataArray2() - { - // create global variable $foo2 in template - $this->assertEquals("bar bar2", $this->smarty->fetch("eval:{\$foo} {\$foo2}", array('foo' => 'bar', 'foo2' => 'bar2'))); - } - - public function testAssigns() - { - $expected = " local local local parent root global parent root global parent root global"; - $result = $this->smarty->fetch('assign.tpl'); - $this->assertEquals($expected, $result); - } - - public function testAssignsMerge() - { - $this->smarty->setMergeCompiledIncludes(true); - $expected = " local local local parent root global parent root global parent root global"; - $result = $this->smarty->fetch('assign.tpl'); - $this->assertEquals($expected, $result); - } -} diff --git a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/cache/dummy.txt b/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/cache/dummy.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.global.tpl b/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.global.tpl deleted file mode 100644 index 1c0381f1..00000000 --- a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.global.tpl +++ /dev/null @@ -1 +0,0 @@ -{assign var="global" value="global" scope="global"} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.parent.tpl b/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.parent.tpl deleted file mode 100644 index d66b7328..00000000 --- a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.parent.tpl +++ /dev/null @@ -1 +0,0 @@ -{assign var="parent" value="parent" scope="parent"} {$local|default:"no-local"} {include "assign.root.tpl"} {$parent|default:"no-parent"} {$root|default:"no-root"} {$global|default:"no-global"} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.root.tpl b/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.root.tpl deleted file mode 100644 index a8559190..00000000 --- a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.root.tpl +++ /dev/null @@ -1 +0,0 @@ -{assign var="root" value="root" scope="root"} {$local|default:"no-local"} {include "assign.global.tpl"} {$parent|default:"no-parent"} {$root|default:"no-root"} {$global|default:"no-global"} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.tpl b/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.tpl deleted file mode 100644 index 06a7be65..00000000 --- a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/assign.tpl +++ /dev/null @@ -1 +0,0 @@ -{assign var="local" value="local"} {$local|default:"no-local"} {include "assign.parent.tpl"} {$parent|default:"no-parent"} {$root|default:"no-root"} {$global|default:"no-global"} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/foo.tpl b/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/foo.tpl deleted file mode 100644 index b9490d3b..00000000 --- a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates/foo.tpl +++ /dev/null @@ -1 +0,0 @@ -{$foo} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates_c/dummy.txt b/tests/UnitTests/TemplateSource/ValueTests/Variables/VariableScope/templates_c/dummy.txt deleted file mode 100644 index e69de29b..00000000