diff options
Diffstat (limited to 'tests/UnitTests/A_1/ProtectedFolderVars')
| -rw-r--r-- | tests/UnitTests/A_1/ProtectedFolderVars/ProtectedFolderVarsTest.php | 81 |
1 files changed, 19 insertions, 62 deletions
diff --git a/tests/UnitTests/A_1/ProtectedFolderVars/ProtectedFolderVarsTest.php b/tests/UnitTests/A_1/ProtectedFolderVars/ProtectedFolderVarsTest.php index a6fb46a3..1b7cd61a 100644 --- a/tests/UnitTests/A_1/ProtectedFolderVars/ProtectedFolderVarsTest.php +++ b/tests/UnitTests/A_1/ProtectedFolderVars/ProtectedFolderVarsTest.php @@ -3,12 +3,14 @@ * This file is part of the Smarty PHPUnit tests. */ +use Smarty\Smarty; + /** * class for protected $template_dir, $compile_dir, $cache_dir, $config_dir, $plugins_dir property tests * - * @runTestsInSeparateProcess + * * @preserveGlobalState disabled - * @backupStaticAttributes enabled + * */ class ProtectedFolderVarsTest extends PHPUnit_Smarty { @@ -27,7 +29,7 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty public function testTemplateDirDirectRelative() { $s = new Smarty(); - $s->template_dir = './foo'; + $s->setTemplateDir('./foo'); $d = $s->getTemplateDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, $d[ 0 ]); } @@ -35,8 +37,8 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty public function testTemplateDirDirectRelativeArray() { $s = new Smarty(); - $s->template_dir = array('./foo', './bar/'); - $d = $s->template_dir; + $s->setTemplateDir(array('./foo', './bar/')); + $d = $s->getTemplateDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, $d[ 0 ]); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR, $d[ 1 ]); } @@ -44,7 +46,7 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty public function testTemplateDirDirectRelativeArrayAdd() { $s = new Smarty(); - $s->template_dir = './foo'; + $s->setTemplateDir('./foo'); $s->addTemplateDir('./bar/'); $d = $s->getTemplateDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, $d[ 0 ]); @@ -61,7 +63,7 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty public function testTemplateDirDirectRelativeExtends2() { $s = new FolderT(); - $s->template_dir = './bar'; + $s->setTemplateDir('./bar'); $d = $s->getTemplateDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR, $d[ 0 ]); } @@ -73,7 +75,7 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty public function testConfigDirDirectRelative() { $s = new Smarty(); - $s->config_dir = './foo'; + $s->setConfigDir('./foo'); $d = $s->getConfigDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, $d[ 0 ]); } @@ -81,8 +83,8 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty public function testConfigDirDirectRelativeArray() { $s = new Smarty(); - $s->config_dir = array('./foo', './bar/'); - $d = $s->config_dir; + $s->setConfigDir(array('./foo', './bar/')); + $d = $s->getConfigDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, $d[ 0 ]); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR, $d[ 1 ]); } @@ -90,7 +92,7 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty public function testConfigDirDirectRelativeArrayAdd() { $s = new Smarty(); - $s->config_dir = './foo'; + $s->setConfigDir('./foo'); $s->addConfigDir('./bar/'); $d = $s->getConfigDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, $d[ 0 ]); @@ -107,64 +109,19 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty public function testConfigDirDirectRelativeExtends2() { $s = new FolderT(); - $s->config_dir = './bar'; + $s->setConfigDir('./bar'); $d = $s->getConfigDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR, $d[ 0 ]); } /* - * plugins_dir - */ - - public function testPluginDirDirectRelative() - { - $s = new Smarty(); - $s->plugins_dir = './foo'; - $d = $s->getPluginsDir(); - $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, $d[ 0 ]); - } - - public function testPluginDirDirectRelativeArray() - { - $s = new Smarty(); - $s->plugins_dir = array('./foo', './bar/'); - $d = $s->plugins_dir; - $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, $d[ 0 ]); - $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR, $d[ 1 ]); - } - - public function testPluginDirDirectRelativeArrayAdd() - { - $s = new Smarty(); - $s->plugins_dir = './foo'; - $s->addPluginsDir('./bar/'); - $d = $s->getPluginsDir(); - $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, $d[ 0 ]); - $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR, $d[ 1 ]); - } - - public function testPluginDirDirectRelativeExtends() - { - $s = new FolderT(); - $d = $s->getPluginsDir(); - $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'plug' . DIRECTORY_SEPARATOR, $d[ 0 ]); - } - - public function testPluginDirDirectRelativeExtends2() - { - $s = new FolderT(); - $s->plugins_dir = './bar'; - $d = $s->getPluginsDir(); - $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR, $d[ 0 ]); - } - /* * compile_dir */ public function testCompileDirDirectRelative() { $s = new Smarty(); - $s->compile_dir = './foo'; + $s->setCompileDir('./foo'); $d = $s->getCompileDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, $d); } @@ -179,7 +136,7 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty public function testCompileDirDirectRelativeExtends2() { $s = new FolderT(); - $s->compile_dir = './bar'; + $s->setCompileDir('./bar'); $d = $s->getCompileDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR, $d); } @@ -190,7 +147,7 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty public function testCacheDirDirectRelative() { $s = new Smarty(); - $s->cache_dir = './foo'; + $s->setCacheDir('./foo'); $d = $s->getCacheDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'foo' . DIRECTORY_SEPARATOR, $d); } @@ -205,13 +162,13 @@ class ProtectedFolderVarsTest extends PHPUnit_Smarty public function testCacheDirDirectRelativeExtends2() { $s = new FolderT(); - $s->cache_dir = './bar'; + $s->setCacheDir('./bar'); $d = $s->getCacheDir(); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR, $d); } } -class FolderT extends Smarty +class FolderT extends \Smarty\Smarty { protected $template_dir = './foo'; |
