From cee9d19fba77c3928a9a22a3cc8cc3fa26e3809c Mon Sep 17 00:00:00 2001 From: uwetews Date: Sat, 24 Oct 2015 04:12:28 +0200 Subject: [PATCH] Update test for 3.1.28 master --- tests/PHPUnit_Smarty.php | 44 +++++++++---------- tests/UnitTests/A_Core/Filter/FilterTest.php | 2 +- .../A_Core/LoadPlugin/IncludePathTest.php | 2 +- .../_shared/CacheResourceTestCommon.php | 2 +- .../Extends/ExtendsResourceTest.php | 2 +- .../BockExtend/CompileBlockExtendsTest.php | 3 +- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/tests/PHPUnit_Smarty.php b/tests/PHPUnit_Smarty.php index 26486a35..0685bd90 100644 --- a/tests/PHPUnit_Smarty.php +++ b/tests/PHPUnit_Smarty.php @@ -5,6 +5,7 @@ */ include_once __DIR__ . '/Config.php'; + /** * Smarty Test Case Fixture */ @@ -71,10 +72,7 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase * * @var array */ - protected $backupStaticAttributesBlacklist = array( - 'PHPUnit_Smarty' => array('config', 'pdo', 'init'), - ); - + protected $backupStaticAttributesBlacklist = array('PHPUnit_Smarty' => array('config', 'pdo', 'init'),); /** * This method is called before the first test of this test class is run. @@ -84,7 +82,7 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase { error_reporting(E_ALL | E_STRICT); self::$init = true; - } + } /** * This method is called after the last test of this test class is run. @@ -322,7 +320,7 @@ KEY `expire` (`expire`) case 'file': case 'filetest': case 'php': - return $this->normalizePath($dir . $name); + return $this->normalizePath($dir . $name); case 'mysqltest': case 'mysql': return sha1($type . ':' . $name); @@ -371,17 +369,20 @@ KEY `expire` (`expire`) * - remove /./ and /../ * - make it absolute * - * @param string $path file path + * @param string $path file path * * @return string */ - public function normalizePath($path) { + public function normalizePath($path) + { if ($path[0] == '.') { $path = getcwd() . DS . $path; } $path = preg_replace('#[\\\/]+([.][\\\/]+)*#', DS, $path); while (strrpos($path, '.' . DS) !== false) { - $path = preg_replace('#([\\\/]([^\\\/]+[\\\/]){2}([.][.][\\\/]){2})|([\\\/][^\\\/]+[\\\/][.][.][\\\/])#', DS, $path); + $path = + preg_replace('#([\\\/]([^\\\/]+[\\\/]){2}([.][.][\\\/]){2})|([\\\/][^\\\/]+[\\\/][.][.][\\\/])#', DS, + $path); } return $path; } @@ -430,7 +431,8 @@ KEY `expire` (`expire`) * @return string * @throws \Exception */ - public function buildCompiledPath(Smarty_Internal_Template $tpl, $sub = true, $caching = false, $compile_id = null, $name = null, $type = null, $dir = null) + public function buildCompiledPath(Smarty_Internal_Template $tpl, $sub = true, $caching = false, $compile_id = null, + $name = null, $type = null, $dir = null) { $sep = DS; $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null; @@ -438,18 +440,17 @@ KEY `expire` (`expire`) $uid = $this->buildUid($tpl, $sp, $name, $type); $_flag = ''; if (isset($tpl->source) && $tpl->source->isConfig) { - $_flag = '_' . ((int) $tpl->smarty->config_read_hidden + (int) $tpl->smarty->config_booleanize * 2 - + (int) $tpl->smarty->config_overwrite * 4); + $_flag = '_' . ((int) $tpl->smarty->config_read_hidden + (int) $tpl->smarty->config_booleanize * 2 + + (int) $tpl->smarty->config_overwrite * 4); } else { $_flag = '_' . ((int) $tpl->smarty->merge_compiled_includes + (int) $tpl->smarty->escape_html * 2); } $_filepath = $uid . $_flag; // if use_sub_dirs, break file into directories if ($sub) { - $_filepath = substr($_filepath, 0, 2) . $sep - . substr($_filepath, 2, 2) . $sep - . substr($_filepath, 4, 2) . $sep - . $_filepath; + $_filepath = + substr($_filepath, 0, 2) . $sep . substr($_filepath, 2, 2) . $sep . substr($_filepath, 4, 2) . $sep . + $_filepath; } $_compile_dir_sep = $sub ? $sep : '^'; if (isset($_compile_id)) { @@ -490,7 +491,8 @@ KEY `expire` (`expire`) * @return string * @throws \Exception */ - public function buildCachedPath($tpl, $sub = true, $cache_id = null, $compile_id = null, $name = null, $type = null, $dir = null, $cacheType = null) + public function buildCachedPath($tpl, $sub = true, $cache_id = null, $compile_id = null, $name = null, $type = null, + $dir = null, $cacheType = null) { $cacheType = isset($cacheType) ? $cacheType : $tpl->smarty->caching_type; switch ($cacheType) { @@ -504,10 +506,9 @@ KEY `expire` (`expire`) $_filepath = $uid; // if use_sub_dirs, break file into directories if ($sub) { - $_filepath = substr($_filepath, 0, 2) . $sep - . substr($_filepath, 2, 2) . $sep - . substr($_filepath, 4, 2) . $sep - . $_filepath; + $_filepath = + substr($_filepath, 0, 2) . $sep . substr($_filepath, 2, 2) . $sep . substr($_filepath, 4, 2) . + $sep . $_filepath; } $_compile_dir_sep = $sub ? $sep : '^'; if (isset($_cache_id)) { @@ -536,7 +537,6 @@ KEY `expire` (`expire`) } } - /** * Tears down the fixture * This method is called after a test is executed. diff --git a/tests/UnitTests/A_Core/Filter/FilterTest.php b/tests/UnitTests/A_Core/Filter/FilterTest.php index 41066d73..aa730d13 100644 --- a/tests/UnitTests/A_Core/Filter/FilterTest.php +++ b/tests/UnitTests/A_Core/Filter/FilterTest.php @@ -52,7 +52,7 @@ class FilterTest extends PHPUnit_Smarty public function testLoadedOutputFilter() { $this->smarty->loadFilter(Smarty::FILTER_OUTPUT, 'trimwhitespace'); - $tpl = $this->smarty->createTemplate('eval:{"
hello world"}'); + $tpl = $this->smarty->createTemplate('string:{"
hello world"}'); $this->assertEquals("
hello world", $this->smarty->fetch($tpl)); } diff --git a/tests/UnitTests/A_Core/LoadPlugin/IncludePathTest.php b/tests/UnitTests/A_Core/LoadPlugin/IncludePathTest.php index 5305dcf3..35ad3147 100644 --- a/tests/UnitTests/A_Core/LoadPlugin/IncludePathTest.php +++ b/tests/UnitTests/A_Core/LoadPlugin/IncludePathTest.php @@ -5,7 +5,7 @@ * * @package PHPunit * @author Rodney Rehm - * @runTestsInSeparateProcess + * @run TestsInSeparateProcess * @preserveGlobalState disabled * @backupStaticAttributes enabled */ diff --git a/tests/UnitTests/CacheResourceTests/_shared/CacheResourceTestCommon.php b/tests/UnitTests/CacheResourceTests/_shared/CacheResourceTestCommon.php index d075e266..a6ba2246 100644 --- a/tests/UnitTests/CacheResourceTests/_shared/CacheResourceTestCommon.php +++ b/tests/UnitTests/CacheResourceTests/_shared/CacheResourceTestCommon.php @@ -30,7 +30,7 @@ class CacheResourceTestCommon extends PHPUnit_Smarty public function compiledPrefilter($text, Smarty_Internal_Template $tpl) { - return str_replace('#', $tpl->_getVariable('test'), $text); + return str_replace('#', $tpl->getTemplateVars('test'), $text); } /** diff --git a/tests/UnitTests/ResourceTests/Extends/ExtendsResourceTest.php b/tests/UnitTests/ResourceTests/Extends/ExtendsResourceTest.php index 0c737d95..baa14af2 100644 --- a/tests/UnitTests/ResourceTests/Extends/ExtendsResourceTest.php +++ b/tests/UnitTests/ResourceTests/Extends/ExtendsResourceTest.php @@ -28,7 +28,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty public function compiledPrefilter($text, Smarty_Internal_Template $tpl) { - return str_replace('#', $tpl->_getVariable('test'), $text); + return str_replace('#', $tpl->getTemplateVars('test'), $text); } /** diff --git a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php index c4dc296a..8b53418f 100644 --- a/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php +++ b/tests/UnitTests/TemplateSource/TagTests/BockExtend/CompileBlockExtendsTest.php @@ -23,7 +23,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty public function compiledPrefilter($text, Smarty_Internal_Template $tpl) { - return str_replace('#', $tpl->_getVariable('test'), $text); + return str_replace('#', $tpl->getTemplateVars('test'), $text); } public function testInit() @@ -633,6 +633,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty /** * test child/parent template chain + * * @runInSeparateProcess * @preserveGlobalState disabled * @dataProvider data