diff options
| author | hirosan <h-marumoto@cybozu.co.jp> | 2026-01-08 19:21:57 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-08 11:21:57 +0100 |
| commit | 6709d000cd08e4e1fdba4944c7d18275d2a0a2f1 (patch) | |
| tree | eb758fff6f4e7a73241de1fcfcc86e8e924a9d2b /tests | |
| parent | aa6edc3c0bf8fc77cda9a06320021328c924cd68 (diff) | |
| download | smarty-6709d000cd08e4e1fdba4944c7d18275d2a0a2f1.tar.gz smarty-6709d000cd08e4e1fdba4944c7d18275d2a0a2f1.tar.bz2 smarty-6709d000cd08e4e1fdba4944c7d18275d2a0a2f1.zip | |
Fix static analysis warnings for isDot() and remove deprecated APC support (#1164)
* Fix static analysis warnings for isDot()
* Remove deprecated APC support
* Remove redundant isDot() check and fix static analysis warnings
Diffstat (limited to 'tests')
4 files changed, 2 insertions, 141 deletions
diff --git a/tests/PHPUnit_Smarty.php b/tests/PHPUnit_Smarty.php index 029c8f90..39663c1f 100644 --- a/tests/PHPUnit_Smarty.php +++ b/tests/PHPUnit_Smarty.php @@ -291,10 +291,8 @@ KEY `name` (`name`) } // directory ? if ($file->isDir()) { - if (!$ri->isDot()) { - // delete folder if empty - @rmdir($file->getPathname()); - } + // delete folder if empty + @rmdir($file->getPathname()); } else { unlink($file->getPathname()); } diff --git a/tests/UnitTests/CacheResourceTests/Apc/CacheResourceCustomApcTest.php b/tests/UnitTests/CacheResourceTests/Apc/CacheResourceCustomApcTest.php deleted file mode 100644 index d75382d0..00000000 --- a/tests/UnitTests/CacheResourceTests/Apc/CacheResourceCustomApcTest.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/** - * Smarty PHPunit tests for cache resource Apc - * - - * @author Uwe Tews - */ -include_once __DIR__ . '/../Memcache/CacheResourceCustomMemcacheTest.php'; -include_once __DIR__ . '/../_shared/PHPunitplugins/cacheresource.apctest.php'; - -/** - * class for cache resource file tests - * - * - * @preserveGlobalState disabled - * - */ -class CacheResourceCustomApcTest extends CacheResourceCustomMemcacheTest -{ - public function setUp(): void - { - if (!function_exists('apc_cache_info') || ini_get('apc.enable_cli')) { - $this->markTestSkipped('APC cache not available'); - } - $this->setUpSmarty(__DIR__); - parent::setUp(); - $this->smarty->setCachingType('apc'); - $this->smarty->registerCacheResource('apc', new Smarty_CacheResource_Apctest()); - } -} - diff --git a/tests/UnitTests/CacheResourceTests/_shared/PHPunitplugins/cacheresource.apctest.php b/tests/UnitTests/CacheResourceTests/_shared/PHPunitplugins/cacheresource.apctest.php deleted file mode 100644 index 38b061dc..00000000 --- a/tests/UnitTests/CacheResourceTests/_shared/PHPunitplugins/cacheresource.apctest.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -use Smarty\Smarty; -use Smarty\Template; -use Smarty\Template\Cached; - -require_once __DIR__ . '/../../../__shared/cacheresources/cacheresource.apc.php'; - -class Smarty_CacheResource_Apctest extends Smarty_CacheResource_Apc -{ - public $lockTime = 0; - - public function hasLock(Smarty $smarty, Cached $cached) - { - if ($this->lockTime) { - $this->lockTime--; - if (!$this->lockTime) { - $this->releaseLock($smarty, $cached); - } - } - return parent::hasLock($smarty, $cached); - } - - public function get(Template $_template) - { - $this->contents = array(); - $this->timestamps = array(); - $t = $this->getContent($_template); - - return $t ? $t : null; - } - -} diff --git a/tests/UnitTests/__shared/cacheresources/cacheresource.apc.php b/tests/UnitTests/__shared/cacheresources/cacheresource.apc.php deleted file mode 100644 index 3f437888..00000000 --- a/tests/UnitTests/__shared/cacheresources/cacheresource.apc.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -/** - * APC CacheResource - * CacheResource Implementation based on the KeyValueStore API to use - * memcache as the storage resource for Smarty's output caching. - * * - * - - * @author Uwe Tews - */ -class Smarty_CacheResource_Apc extends \Smarty\Cacheresource\KeyValueStore -{ - - /** - * Read values for a set of keys from cache - * - * @param array $keys list of keys to fetch - * - * @return array list of values with the given keys used as indexes - * @return boolean true on success, false on failure - */ - protected function read(array $keys) - { - $_res = array(); - $res = apc_fetch($keys); - foreach ($res as $k => $v) { - $_res[ $k ] = $v; - } - return $_res; - } - - /** - * Save values for a set of keys to cache - * - * @param array $keys list of values to save - * @param int $expire expiration time - * - * @return boolean true on success, false on failure - */ - protected function write(array $keys, $expire = null) - { - foreach ($keys as $k => $v) { - apc_store($k, $v, $expire); - } - return true; - } - - /** - * Remove values from cache - * - * @param array $keys list of keys to delete - * - * @return boolean true on success, false on failure - */ - protected function delete(array $keys) - { - foreach ($keys as $k) { - apc_delete($k); - } - return true; - } - - /** - * Remove *all* values from cache - * - * @return boolean true on success, false on failure - */ - protected function purge() - { - return apc_clear_cache('user'); - } -} |
