From 576bd4cc01b9b7b3f79f2af30ad3903e1c72fe34 Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Thu, 5 Jan 2023 21:58:29 +0100 Subject: [PATCH] Removed support for PHP include path, and removed the ::loadPlugin method. --- docs/programmers/api-variables.md | 1 - .../api-variables/variable-template-dir.md | 10 -- .../variable-use-include-path.md | 49 ------ docs/programmers/resources/resources-file.md | 6 - src/Resource/FilePlugin.php | 4 - src/Security.php | 16 -- src/Smarty.php | 163 ------------------ src/TestInstall.php | 73 ++------ .../Plugins/include/function.plugin1.php | 5 - .../Plugins/include1/function.plugin2.php | 5 - .../Tpl/include/include_test2.tpl | 1 - .../Tpl/include/include_test4.tpl | 1 - tests/Include_Path/Tpl/templates_2/test4.tpl | 1 - tests/Include_Path/Tpl/test5.tpl | 1 - .../A_Core/LoadPlugin/IncludePathTest.php | 51 ------ .../A_Core/LoadPlugin/LoadPluginTest.php | 54 ------ .../LoadPlugin/include/function.plugin3.php | 5 - .../templates/test_include_path1.tpl | 1 - .../templates/test_include_path2.tpl | 1 - .../templates/test_include_path3.tpl | 1 - .../PHPunitplugins/function.chain1.php | 7 - .../PHPunitplugins/function.chain2.php | 7 - .../PHPunitplugins/function.chain3.php | 5 - .../PluginTests/PluginChainedLoadTest.php | 33 ---- .../Shared/SharedFunctionsTest.php | 27 --- .../PluginTests/Shared/cache/.gitignore | 2 - .../PluginTests/Shared/templates_c/.gitignore | 2 - .../A_Core/PluginTests/cache/.gitignore | 2 - .../PluginTests/helpers/_object_tostring.php | 26 --- .../templates/test_plugin_chained_load.tpl | 1 - .../A_Core/PluginTests/templates_c/.gitignore | 2 - .../CacheResourceCustomPDOGzipTest.php | 2 - .../FileIncludePath/FileIncludePathTest.php | 67 ------- .../FileIncludePath/cache/.gitignore | 2 - .../FileIncludePath/include_test3.tpl | 1 - .../FileIncludePath/templates/dirname.tpl | 1 - .../FileIncludePath/templates/test1.tpl | 1 - .../FileIncludePath/templates/test2.tpl | 1 - .../FileIncludePath/templates/test3.tpl | 1 - .../FileIncludePath/templates_2/dirname.tpl | 1 - .../templates_2/include_test1.tpl | 1 - .../FileIncludePath/templates_3/dirname.tpl | 1 - .../FileIncludePath/templates_4/dirname.tpl | 1 - .../FileIncludePath/templates_c/.gitignore | 2 - .../ResourcePlugins/ResourcePluginTest.php | 1 - 45 files changed, 12 insertions(+), 634 deletions(-) delete mode 100644 docs/programmers/api-variables/variable-use-include-path.md delete mode 100644 tests/Include_Path/Plugins/include/function.plugin1.php delete mode 100644 tests/Include_Path/Plugins/include1/function.plugin2.php delete mode 100644 tests/Include_Path/Tpl/include/include_test2.tpl delete mode 100644 tests/Include_Path/Tpl/include/include_test4.tpl delete mode 100644 tests/Include_Path/Tpl/templates_2/test4.tpl delete mode 100644 tests/Include_Path/Tpl/test5.tpl delete mode 100644 tests/UnitTests/A_Core/LoadPlugin/IncludePathTest.php delete mode 100644 tests/UnitTests/A_Core/LoadPlugin/LoadPluginTest.php delete mode 100644 tests/UnitTests/A_Core/LoadPlugin/include/function.plugin3.php delete mode 100644 tests/UnitTests/A_Core/LoadPlugin/templates/test_include_path1.tpl delete mode 100644 tests/UnitTests/A_Core/LoadPlugin/templates/test_include_path2.tpl delete mode 100644 tests/UnitTests/A_Core/LoadPlugin/templates/test_include_path3.tpl delete mode 100644 tests/UnitTests/A_Core/PluginTests/PHPunitplugins/function.chain1.php delete mode 100644 tests/UnitTests/A_Core/PluginTests/PHPunitplugins/function.chain2.php delete mode 100644 tests/UnitTests/A_Core/PluginTests/PHPunitplugins/function.chain3.php delete mode 100644 tests/UnitTests/A_Core/PluginTests/PluginChainedLoadTest.php delete mode 100644 tests/UnitTests/A_Core/PluginTests/Shared/SharedFunctionsTest.php delete mode 100644 tests/UnitTests/A_Core/PluginTests/Shared/cache/.gitignore delete mode 100644 tests/UnitTests/A_Core/PluginTests/Shared/templates_c/.gitignore delete mode 100644 tests/UnitTests/A_Core/PluginTests/cache/.gitignore delete mode 100644 tests/UnitTests/A_Core/PluginTests/helpers/_object_tostring.php delete mode 100644 tests/UnitTests/A_Core/PluginTests/templates/test_plugin_chained_load.tpl delete mode 100644 tests/UnitTests/A_Core/PluginTests/templates_c/.gitignore delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/FileIncludePathTest.php delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/cache/.gitignore delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/include_test3.tpl delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/templates/dirname.tpl delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/templates/test1.tpl delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/templates/test2.tpl delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/templates/test3.tpl delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/templates_2/dirname.tpl delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/templates_2/include_test1.tpl delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/templates_3/dirname.tpl delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/templates_4/dirname.tpl delete mode 100644 tests/UnitTests/ResourceTests/FileIncludePath/templates_c/.gitignore diff --git a/docs/programmers/api-variables.md b/docs/programmers/api-variables.md index e3b8d885..5c6c33eb 100644 --- a/docs/programmers/api-variables.md +++ b/docs/programmers/api-variables.md @@ -41,7 +41,6 @@ them directly, or use the corresponding setter/getter methods. - [$smarty_debug_id](./api-variables/variable-smarty-debug-id.md) - [$template_dir](./api-variables/variable-template-dir.md) - [$trusted_dir](./api-variables/variable-trusted-dir.md) -- [$use_include_path](./api-variables/variable-use-include-path.md) - [$use_sub_dirs](./api-variables/variable-use-sub-dirs.md) > **Note** diff --git a/docs/programmers/api-variables/variable-template-dir.md b/docs/programmers/api-variables/variable-template-dir.md index e49578b1..eb91d2c2 100644 --- a/docs/programmers/api-variables/variable-template-dir.md +++ b/docs/programmers/api-variables/variable-template-dir.md @@ -15,22 +15,12 @@ found. > document root. > **Note** -> -> If the directories known to `$template_dir` are relative to -> directories known to the -> [include\_path](&url.php-manual;ini.core.php#ini.include-path) you -> need to activate the [`$use_include_path`](#variable.use.include.path) -> option. - -> **Note** -> > As of Smarty 3.1 the attribute \$template\_dir is no longer accessible > directly. Use [`getTemplateDir()`](#api.get.template.dir), > [`setTemplateDir()`](#api.set.template.dir) and > [`addTemplateDir()`](#api.add.template.dir) instead. See also [`Template Resources`](#resources), -[`$use_include_path`](#variable.use.include.path), [`getTemplateDir()`](#api.get.template.dir), [`setTemplateDir()`](#api.set.template.dir) and [`addTemplateDir()`](#api.add.template.dir). diff --git a/docs/programmers/api-variables/variable-use-include-path.md b/docs/programmers/api-variables/variable-use-include-path.md deleted file mode 100644 index 103a9767..00000000 --- a/docs/programmers/api-variables/variable-use-include-path.md +++ /dev/null @@ -1,49 +0,0 @@ -\$use\_include\_path {#variable.use.include.path} -==================== - -This tells smarty to respect the -[include\_path](&url.php-manual;ini.core.php#ini.include-path) within -the [`File Template Resource`](#resources.file) handler and the plugin -loader to resolve the directories known to -[`$template_dir`](#variable.template.dir). The flag also makes the -plugin loader check the include\_path for -[`$plugins_dir`](#variable.plugins.dir). - -> **Note** -> -> You should not design your applications to rely on the include\_path, -> as this may - depending on your implementation - slow down your system -> (and Smarty) considerably. - -If use\_include\_path is enabled, file discovery for -[`$template_dir`](#variable.template.dir) and -[`$plugins_dir`](#variable.plugins.dir) work as follows. - -- For each element `$directory` in array (\$template\_dir or - \$plugins\_dir) do - -- Test if requested file is in `$directory` relative to the [current - working directory](&url.php-manual;function.getcwd.php). If file - found, return it. - -- For each `$path` in include\_path do - -- Test if requested file is in `$directory` relative to the `$path` - (possibly relative to the [current working - directory](&url.php-manual;function.getcwd.php)). If file found, - return it. - -- Try default\_handler or fail. - -This means that whenever a directory/file relative to the current -working directory is encountered, it is preferred over anything -potentially accessible through the include\_path. - -> **Note** -> -> Smarty does not filter elements of the include\_path. That means a -> \".:\" within your include path will trigger the current working -> directory lookup twice. - -See also [`Template Resources`](#resources) and -[`$template_dir`](#variable.template.dir) diff --git a/docs/programmers/resources/resources-file.md b/docs/programmers/resources/resources-file.md index e49f4737..1e58ba2c 100644 --- a/docs/programmers/resources/resources-file.md +++ b/docs/programmers/resources/resources-file.md @@ -11,12 +11,6 @@ If the file resource cannot find the requested template, the [`$default_template_handler_func`](#variable.default.template.handler.func) is invoked. -> **Note** -> -> As of Smarty 3.1 the file resource no longer walks through the -> [include\_path](&url.php-manual;ini.core.php#ini.include-path) unless -> [`$use_include_path` is activated](#variable.use.include.path) - Templates from \$template\_dir {#templates.from.template.dir} ------------------------------ diff --git a/src/Resource/FilePlugin.php b/src/Resource/FilePlugin.php index e9732427..059c297a 100644 --- a/src/Resource/FilePlugin.php +++ b/src/Resource/FilePlugin.php @@ -170,10 +170,6 @@ class FilePlugin extends BasePlugin { return $path; } } - // Use include path ? - if ($source->smarty->use_include_path) { - return $source->smarty->getIncludePath($_directories, $file); - } return false; } } diff --git a/src/Security.php b/src/Security.php index 4bad8b48..88379613 100644 --- a/src/Security.php +++ b/src/Security.php @@ -230,13 +230,6 @@ class Security { */ protected $_trusted_dir = null; - /** - * Cache for include path status - * - * @var bool - */ - protected $_include_path_status = false; - /** * Cache for $_include_array lookup * @@ -481,15 +474,6 @@ class Security { * @throws \Smarty\Exception if directory is not trusted */ public function isTrustedResourceDir($filepath, $isConfig = null) { - if ($this->_include_path_status !== $this->smarty->use_include_path) { - $_dir = - $this->smarty->use_include_path ? $this->smarty->getIncludePathDirs() : []; - if ($this->_include_dir !== $_dir) { - $this->_updateResourceDir($this->_include_dir, $_dir); - $this->_include_dir = $_dir; - } - $this->_include_path_status = $this->smarty->use_include_path; - } $_dir = $this->smarty->getTemplateDir(); if ($this->_template_dir !== $_dir) { $this->_updateResourceDir($this->_template_dir, $_dir); diff --git a/src/Smarty.php b/src/Smarty.php index 763f695e..35494bd4 100644 --- a/src/Smarty.php +++ b/src/Smarty.php @@ -136,13 +136,6 @@ class Smarty extends \Smarty\TemplateBase */ public $error_unassigned = false; - /** - * look up relative file path in include_path - * - * @var boolean - */ - public $use_include_path = false; - /** * flag if template_dir is normalized * @@ -1819,162 +1812,6 @@ class Smarty extends \Smarty\TemplateBase return $content; } - /** - * include path cache - * - * @var string - */ - private $_include_path = ''; - - /** - * include path directory cache - * - * @var array - */ - private $_include_dirs = array(); - - /** - * include path directory cache - * - * @var array - */ - private $_user_dirs = array(); - - /** - * stream cache - * - * @var string[][] - */ - private $isFile = array(); - - /** - * stream cache - * - * @var string[] - */ - private $isPath = array(); - - /** - * stream cache - * - * @var int[] - */ - private $number = array(); - - /** - * status cache - * - * @var bool - */ - private $_has_stream_include = null; - - /** - * Number for array index - * - * @var int - */ - private $counter = 0; - - /** - * Check if include path was updated - * - * @return bool - */ - private function isNewIncludePath() - { - $_i_path = get_include_path(); - if ($this->_include_path !== $_i_path) { - $this->_include_dirs = array(); - $this->_include_path = $_i_path; - $_dirs = (array)explode(PATH_SEPARATOR, $_i_path); - foreach ($_dirs as $_path) { - if (is_dir($_path)) { - $this->_include_dirs[] = $this->_realpath($_path . DIRECTORY_SEPARATOR, true); - } - } - return true; - } - return false; - } - - /** - * return array with include path directories - * - * @return array - */ - public function getIncludePathDirs() - { - $this->isNewIncludePath(); - return $this->_include_dirs; - } - - /** - * Return full file path from PHP include_path - * - * @param string[] $dirs - * @param string $file - * - * @return bool|string full filepath or false - */ - public function getIncludePath($dirs, $file) - { - if (!($this->_has_stream_include ?? $this->_has_stream_include = function_exists('stream_resolve_include_path')) - ) { - $this->isNewIncludePath(); - } - // try PHP include_path - foreach ($dirs as $dir) { - $dir_n = $this->number[$dir] ?? $this->number[$dir] = $this->counter++; - if (isset($this->isFile[ $dir_n ][ $file ])) { - if ($this->isFile[ $dir_n ][ $file ]) { - return $this->isFile[ $dir_n ][ $file ]; - } else { - continue; - } - } - if (isset($this->_user_dirs[ $dir_n ])) { - if (false === $this->_user_dirs[ $dir_n ]) { - continue; - } else { - $dir = $this->_user_dirs[ $dir_n ]; - } - } else { - if ($dir[ 0 ] === '/' || $dir[ 1 ] === ':') { - $dir = str_ireplace(getcwd(), '.', $dir); - if ($dir[ 0 ] === '/' || $dir[ 1 ] === ':') { - $this->_user_dirs[ $dir_n ] = false; - continue; - } - } - $dir = substr($dir, 2); - $this->_user_dirs[ $dir_n ] = $dir; - } - if ($this->_has_stream_include) { - $path = stream_resolve_include_path($dir . ($file ?? '')); - if ($path) { - return $this->isFile[ $dir_n ][ $file ] = $path; - } - } else { - foreach ($this->_include_dirs as $key => $_i_path) { - $path = $this->isPath[$key][$dir_n] ?? $this->isPath[$key][$dir_n] = is_dir($_dir_path = $_i_path . $dir) ? $_dir_path : false; - if ($path === false) { - continue; - } - if (isset($file)) { - $_file = $this->isFile[ $dir_n ][ $file ] = (is_file($path . $file)) ? $path . $file : false; - if ($_file) { - return $_file; - } - } else { - // no file was given return directory path - return $path; - } - } - } - } - return false; - } - /** * Writes file in a safe way to disk * diff --git a/src/TestInstall.php b/src/TestInstall.php index dfcf3b47..401d633a 100644 --- a/src/TestInstall.php +++ b/src/TestInstall.php @@ -43,39 +43,14 @@ class TestInstall $template_dir = realpath($template_dir); // resolve include_path or fail existence if (!$template_dir) { - if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_template_dir)) { - // try PHP include_path - if ($_stream_resolve_include_path) { - $template_dir = stream_resolve_include_path($_template_dir); - } else { - $template_dir = $smarty->getIncludePath($_template_dir, null); - } - if ($template_dir !== false) { - if ($errors === null) { - echo "$template_dir is OK.\n"; - } - continue; - } else { - $status = false; - $message = - "FAILED: $_template_dir does not exist (and couldn't be found in include_path either)"; - if ($errors === null) { - echo $message . ".\n"; - } else { - $errors[ 'template_dir' ] = $message; - } - continue; - } + $status = false; + $message = "FAILED: $_template_dir does not exist"; + if ($errors === null) { + echo $message . ".\n"; } else { - $status = false; - $message = "FAILED: $_template_dir does not exist"; - if ($errors === null) { - echo $message . ".\n"; - } else { - $errors[ 'template_dir' ] = $message; - } - continue; + $errors[ 'template_dir' ] = $message; } + continue; } if (!is_dir($template_dir)) { $status = false; @@ -196,38 +171,14 @@ class TestInstall $_config_dir = $config_dir; // resolve include_path or fail existence if (!$config_dir) { - if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_config_dir)) { - // try PHP include_path - if ($_stream_resolve_include_path) { - $config_dir = stream_resolve_include_path($_config_dir); - } else { - $config_dir = $smarty->getIncludePath($_config_dir, null); - } - if ($config_dir !== false) { - if ($errors === null) { - echo "$config_dir is OK.\n"; - } - continue; - } else { - $status = false; - $message = "FAILED: $_config_dir does not exist (and couldn't be found in include_path either)"; - if ($errors === null) { - echo $message . ".\n"; - } else { - $errors[ 'config_dir' ] = $message; - } - continue; - } + $status = false; + $message = "FAILED: $_config_dir does not exist"; + if ($errors === null) { + echo $message . ".\n"; } else { - $status = false; - $message = "FAILED: $_config_dir does not exist"; - if ($errors === null) { - echo $message . ".\n"; - } else { - $errors[ 'config_dir' ] = $message; - } - continue; + $errors[ 'config_dir' ] = $message; } + continue; } if (!is_dir($config_dir)) { $status = false; diff --git a/tests/Include_Path/Plugins/include/function.plugin1.php b/tests/Include_Path/Plugins/include/function.plugin1.php deleted file mode 100644 index 50fc9d40..00000000 --- a/tests/Include_Path/Plugins/include/function.plugin1.php +++ /dev/null @@ -1,5 +0,0 @@ -setUpSmarty(__DIR__); - $this->smarty->use_include_path = true; - $this->smarty->setPluginsDir(array('./include','./include1')); - $this->smarty->enableSecurity(); - $ds = DIRECTORY_SEPARATOR; - set_include_path($this->smarty->_realpath(__DIR__ . "{$ds}..{$ds}..{$ds}..{$ds}Include_Path{$ds}Plugins{$ds}", true) . PATH_SEPARATOR . get_include_path()); - } - - /** - * Tears down the fixture - * This method is called after a test is executed. - * - */ - protected function tearDown(): void - { - ini_restore('include_path'); - $this->smarty->disableSecurity(); - parent::tearDown(); - } - public function testInit() - { - $this->cleanDirs(); - } - public function testInclude1() - { - $this->assertStringContainsString('plugin1', $this->smarty->fetch('test_include_path1.tpl')); - } - public function testInclude2() - { - $this->assertStringContainsString('plugin2', $this->smarty->fetch('test_include_path2.tpl')); - } - public function testInclude3() - { - $this->assertStringContainsString('plugin3', $this->smarty->fetch('test_include_path3.tpl')); - } - } diff --git a/tests/UnitTests/A_Core/LoadPlugin/LoadPluginTest.php b/tests/UnitTests/A_Core/LoadPlugin/LoadPluginTest.php deleted file mode 100644 index 5706d14c..00000000 --- a/tests/UnitTests/A_Core/LoadPlugin/LoadPluginTest.php +++ /dev/null @@ -1,54 +0,0 @@ -setUpSmarty(__DIR__); - } - - /** - * loadPlugin test unkown plugin - */ - public function testLoadPluginErrorReturn() - { - $this->assertFalse($this->smarty->loadPlugin('\\Smarty\\Not\\Known')); - } - - /** - * loadPlugin test \Smarty\Debug exists - */ - public function testLoadPluginSmartyInternalDebug() - { - $this->assertTrue($this->smarty->loadPlugin(\Smarty\Debug::class) == true); - } - - /** - * loadPlugin test \Smarty\Template exists - */ - public function testLoadPluginSmartyTemplateClass() - { - $this->assertTrue($this->smarty->loadPlugin(\Smarty\Template) == true); - } - - /** - * loadPlugin test loaging from plugins_dir - */ - public function testLoadPluginSmartyPluginCounter() - { - $this->assertTrue($this->smarty->loadPlugin('smarty_function_counter') == true); - } -} diff --git a/tests/UnitTests/A_Core/LoadPlugin/include/function.plugin3.php b/tests/UnitTests/A_Core/LoadPlugin/include/function.plugin3.php deleted file mode 100644 index c9c3a6ef..00000000 --- a/tests/UnitTests/A_Core/LoadPlugin/include/function.plugin3.php +++ /dev/null @@ -1,5 +0,0 @@ -smarty->loadPlugin('smarty_function_chain2'); - - return smarty_function_chain2($params, $tpl); -} diff --git a/tests/UnitTests/A_Core/PluginTests/PHPunitplugins/function.chain2.php b/tests/UnitTests/A_Core/PluginTests/PHPunitplugins/function.chain2.php deleted file mode 100644 index 480ba0e0..00000000 --- a/tests/UnitTests/A_Core/PluginTests/PHPunitplugins/function.chain2.php +++ /dev/null @@ -1,7 +0,0 @@ -smarty->loadPlugin('smarty_function_chain3'); - - return smarty_function_chain3($params, $tpl); -} diff --git a/tests/UnitTests/A_Core/PluginTests/PHPunitplugins/function.chain3.php b/tests/UnitTests/A_Core/PluginTests/PHPunitplugins/function.chain3.php deleted file mode 100644 index 6c0f9920..00000000 --- a/tests/UnitTests/A_Core/PluginTests/PHPunitplugins/function.chain3.php +++ /dev/null @@ -1,5 +0,0 @@ -setUpSmarty(__DIR__); - } - - public function testInit() - { - $this->cleanDirs(); - } - - public function testPluginChainedLoad() - { - $this->smarty->addPluginsDir(__DIR__ . "/PHPunitplugins/"); - $this->assertStringContainsString('from chain3', $this->smarty->fetch('test_plugin_chained_load.tpl')); - } -} diff --git a/tests/UnitTests/A_Core/PluginTests/Shared/SharedFunctionsTest.php b/tests/UnitTests/A_Core/PluginTests/Shared/SharedFunctionsTest.php deleted file mode 100644 index b959a547..00000000 --- a/tests/UnitTests/A_Core/PluginTests/Shared/SharedFunctionsTest.php +++ /dev/null @@ -1,27 +0,0 @@ -setUpSmarty(__DIR__); - } - - /** - * test smarty_function_escape_special_chars() - */ - public function testEscapeSpecialChars() - { - $this->assertEquals('hello<world ©', smarty_function_escape_special_chars('helloassertEquals('ö€', smarty_function_escape_special_chars('ö€')); - } -} diff --git a/tests/UnitTests/A_Core/PluginTests/Shared/cache/.gitignore b/tests/UnitTests/A_Core/PluginTests/Shared/cache/.gitignore deleted file mode 100644 index 1d34e205..00000000 --- a/tests/UnitTests/A_Core/PluginTests/Shared/cache/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore anything in here, but keep this directory -* \ No newline at end of file diff --git a/tests/UnitTests/A_Core/PluginTests/Shared/templates_c/.gitignore b/tests/UnitTests/A_Core/PluginTests/Shared/templates_c/.gitignore deleted file mode 100644 index 1d34e205..00000000 --- a/tests/UnitTests/A_Core/PluginTests/Shared/templates_c/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore anything in here, but keep this directory -* \ No newline at end of file diff --git a/tests/UnitTests/A_Core/PluginTests/cache/.gitignore b/tests/UnitTests/A_Core/PluginTests/cache/.gitignore deleted file mode 100644 index 1d34e205..00000000 --- a/tests/UnitTests/A_Core/PluginTests/cache/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore anything in here, but keep this directory -* \ No newline at end of file diff --git a/tests/UnitTests/A_Core/PluginTests/helpers/_object_tostring.php b/tests/UnitTests/A_Core/PluginTests/helpers/_object_tostring.php deleted file mode 100644 index 4cb55e7f..00000000 --- a/tests/UnitTests/A_Core/PluginTests/helpers/_object_tostring.php +++ /dev/null @@ -1,26 +0,0 @@ -string = (string) $string; - } - - public function __toString() - { - return $this->string; - } -} - -class _object_noString -{ - protected $string = null; - - public function __construct($string) - { - $this->string = (string) $string; - } -} diff --git a/tests/UnitTests/A_Core/PluginTests/templates/test_plugin_chained_load.tpl b/tests/UnitTests/A_Core/PluginTests/templates/test_plugin_chained_load.tpl deleted file mode 100644 index 3badb70f..00000000 --- a/tests/UnitTests/A_Core/PluginTests/templates/test_plugin_chained_load.tpl +++ /dev/null @@ -1 +0,0 @@ -{chain1} \ No newline at end of file diff --git a/tests/UnitTests/A_Core/PluginTests/templates_c/.gitignore b/tests/UnitTests/A_Core/PluginTests/templates_c/.gitignore deleted file mode 100644 index 1d34e205..00000000 --- a/tests/UnitTests/A_Core/PluginTests/templates_c/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore anything in here, but keep this directory -* \ No newline at end of file diff --git a/tests/UnitTests/CacheResourceTests/PDOgzip/CacheResourceCustomPDOGzipTest.php b/tests/UnitTests/CacheResourceTests/PDOgzip/CacheResourceCustomPDOGzipTest.php index 5d81638f..6921892b 100644 --- a/tests/UnitTests/CacheResourceTests/PDOgzip/CacheResourceCustomPDOGzipTest.php +++ b/tests/UnitTests/CacheResourceTests/PDOgzip/CacheResourceCustomPDOGzipTest.php @@ -29,8 +29,6 @@ class CacheResourceCustomPDOGzipTest extends CacheResourceTestCommon $this->setUpSmarty(__DIR__); parent::setUp(); $this->smarty->setCachingType('pdo'); - $this->assertTrue(false !== $this->smarty->loadPlugin('Smarty_CacheResource_Pdo_Gziptest'), - 'loadPlugin() could not load PDOGzip cache resource'); $this->smarty->registerCacheResource('pdo', new Smarty_CacheResource_Pdo_Gziptest($this->getPDO(), 'output_cache')); } diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/FileIncludePathTest.php b/tests/UnitTests/ResourceTests/FileIncludePath/FileIncludePathTest.php deleted file mode 100644 index 1447ef09..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/FileIncludePathTest.php +++ /dev/null @@ -1,67 +0,0 @@ -setUpSmarty(__DIR__); - $this->smarty->use_include_path = true; - $this->smarty->setTemplateDir(array('./templates', './templates_2', './include')); - $this->smarty->enableSecurity(); - $ds = DIRECTORY_SEPARATOR; - set_include_path($this->smarty->_realpath(__DIR__ . "{$ds}..{$ds}..{$ds}..{$ds}Include_Path{$ds}Tpl{$ds}", true) . PATH_SEPARATOR . get_include_path()); - } - - /** - * Tears down the fixture - * This method is called after a test is executed. - * - */ - protected function tearDown(): void - { - ini_restore('include_path'); - $this->smarty->disableSecurity(); - parent::tearDown(); - } - public function testInit() - { - $this->cleanDirs(); - } - public function testInclude1() - { - $this->assertStringContainsString('include_test1', $this->smarty->fetch('test1.tpl')); - } - public function testInclude2() - { - $this->assertStringContainsString('include_test2', $this->smarty->fetch('test2.tpl')); - } - public function testInclude3() - { - $this->assertStringContainsString('include_test3', $this->smarty->fetch('test3.tpl')); - } - public function testInclude31() - { - $this->smarty->use_include_path = false; - $this->smarty->security_policy->secure_dir = getcwd(); - $this->assertStringContainsString('include_test3', $this->smarty->fetch('test3.tpl')); - } - public function testInclude4() - { - $this->assertStringContainsString('include_test4', $this->smarty->fetch('test4.tpl')); - } - public function testInclude5() - { - $this->smarty->setTemplateDir(array('./')); - $this->assertStringContainsString('include path root', $this->smarty->fetch('test5.tpl')); - } - - } diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/cache/.gitignore b/tests/UnitTests/ResourceTests/FileIncludePath/cache/.gitignore deleted file mode 100644 index d88cc144..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/cache/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore anything in here, but keep this directory -* diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/include_test3.tpl b/tests/UnitTests/ResourceTests/FileIncludePath/include_test3.tpl deleted file mode 100644 index 61298afb..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/include_test3.tpl +++ /dev/null @@ -1 +0,0 @@ -include_test3 diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/templates/dirname.tpl b/tests/UnitTests/ResourceTests/FileIncludePath/templates/dirname.tpl deleted file mode 100644 index f10e14ab..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/templates/dirname.tpl +++ /dev/null @@ -1 +0,0 @@ -templates \ No newline at end of file diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/templates/test1.tpl b/tests/UnitTests/ResourceTests/FileIncludePath/templates/test1.tpl deleted file mode 100644 index dcc96887..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/templates/test1.tpl +++ /dev/null @@ -1 +0,0 @@ -{include 'include_test1.tpl'} \ No newline at end of file diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/templates/test2.tpl b/tests/UnitTests/ResourceTests/FileIncludePath/templates/test2.tpl deleted file mode 100644 index b5d41850..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/templates/test2.tpl +++ /dev/null @@ -1 +0,0 @@ -{include 'include_test2.tpl'} \ No newline at end of file diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/templates/test3.tpl b/tests/UnitTests/ResourceTests/FileIncludePath/templates/test3.tpl deleted file mode 100644 index 5d5690be..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/templates/test3.tpl +++ /dev/null @@ -1 +0,0 @@ -{include 'include_test3.tpl'} \ No newline at end of file diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/templates_2/dirname.tpl b/tests/UnitTests/ResourceTests/FileIncludePath/templates_2/dirname.tpl deleted file mode 100644 index b6e9ce55..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/templates_2/dirname.tpl +++ /dev/null @@ -1 +0,0 @@ -templates_2 \ No newline at end of file diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/templates_2/include_test1.tpl b/tests/UnitTests/ResourceTests/FileIncludePath/templates_2/include_test1.tpl deleted file mode 100644 index c8d49087..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/templates_2/include_test1.tpl +++ /dev/null @@ -1 +0,0 @@ -include_test1 diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/templates_3/dirname.tpl b/tests/UnitTests/ResourceTests/FileIncludePath/templates_3/dirname.tpl deleted file mode 100644 index 404b4397..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/templates_3/dirname.tpl +++ /dev/null @@ -1 +0,0 @@ -templates_3 \ No newline at end of file diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/templates_4/dirname.tpl b/tests/UnitTests/ResourceTests/FileIncludePath/templates_4/dirname.tpl deleted file mode 100644 index b744ef31..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/templates_4/dirname.tpl +++ /dev/null @@ -1 +0,0 @@ -templates_4 \ No newline at end of file diff --git a/tests/UnitTests/ResourceTests/FileIncludePath/templates_c/.gitignore b/tests/UnitTests/ResourceTests/FileIncludePath/templates_c/.gitignore deleted file mode 100644 index d88cc144..00000000 --- a/tests/UnitTests/ResourceTests/FileIncludePath/templates_c/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore anything in here, but keep this directory -* diff --git a/tests/UnitTests/ResourceTests/ResourcePlugins/ResourcePluginTest.php b/tests/UnitTests/ResourceTests/ResourcePlugins/ResourcePluginTest.php index 5e3ea53b..e3efba14 100644 --- a/tests/UnitTests/ResourceTests/ResourcePlugins/ResourcePluginTest.php +++ b/tests/UnitTests/ResourceTests/ResourcePlugins/ResourcePluginTest.php @@ -49,7 +49,6 @@ class ResourcePluginTest extends PHPUnit_Smarty public function testResourcePluginRegisteredInstance() { $this->smarty->addPluginsDir("./PHPunitplugins/"); - $this->smarty->loadPlugin('_Db2Plugin'); $this->smarty->registerResource('db2a', new _Db2Plugin('db2a')); $this->assertEquals('hello world', $this->smarty->fetch('db2a:test')); }