diff options
author | Tristan Darricau <github@nicofuma.fr> | 2014-05-15 00:22:27 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2014-05-15 00:22:27 +0200 |
commit | b7f54e42b269374f018fe67ece11e63cf86b0c12 (patch) | |
tree | f043f34d9959acdcd429bb1171954a964950092e /tests/cache/cache_memory.php | |
parent | 9dd71fa32e13120c324a4cfb40a9c5c5534207e8 (diff) | |
download | forums-b7f54e42b269374f018fe67ece11e63cf86b0c12.tar forums-b7f54e42b269374f018fe67ece11e63cf86b0c12.tar.gz forums-b7f54e42b269374f018fe67ece11e63cf86b0c12.tar.bz2 forums-b7f54e42b269374f018fe67ece11e63cf86b0c12.tar.xz forums-b7f54e42b269374f018fe67ece11e63cf86b0c12.zip |
[ticket/11224] Add unit test
PHPBB3-11224
Diffstat (limited to 'tests/cache/cache_memory.php')
-rw-r--r-- | tests/cache/cache_memory.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/cache/cache_memory.php b/tests/cache/cache_memory.php new file mode 100644 index 0000000000..c468cb4658 --- /dev/null +++ b/tests/cache/cache_memory.php @@ -0,0 +1,62 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/acm/acm_memory.php'; + +class phpbb_cache_memory extends acm_memory +{ + protected $data = array(); + + /** + * Set cache path + */ + function phpbb_cache_memory() + { + } + + /** + * Fetch an item from the cache + * + * @access protected + * @param string $var Cache key + * @return mixed Cached data + */ + function _read($var) + { + return $this->data[$var]; + } + + /** + * Store data in the cache + * + * @access protected + * @param string $var Cache key + * @param mixed $data Data to store + * @param int $ttl Time-to-live of cached data + * @return bool True if the operation succeeded + */ + function _write($var, $data, $ttl = 2592000) + { + $this->data[$var] = $data; + return true; + } + + /** + * Remove an item from the cache + * + * @access protected + * @param string $var Cache key + * @return bool True if the operation succeeded + */ + function _delete($var) + { + unset($this->data[$var]); + return true; + } +} |