diff --git a/src/Pattern/AbstractPattern.php b/src/Pattern/AbstractPattern.php index 1b319858d..72e700235 100644 --- a/src/Pattern/AbstractPattern.php +++ b/src/Pattern/AbstractPattern.php @@ -48,18 +48,6 @@ abstract class AbstractPattern implements Pattern */ public function setOptions(PatternOptions $options) { - if (!is_array($options) - && !$options instanceof Traversable - && !$options instanceof PatternOptions - ) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects an array, a Traversable object, or an PatternOptions instance; ' - . 'received "%s"', - __METHOD__, - (is_object($options) ? get_class($options) : gettype($options)) - )); - } - if (!$options instanceof PatternOptions) { $options = new PatternOptions($options); } @@ -68,8 +56,6 @@ public function setOptions(PatternOptions $options) return $this; } - - /** * Get all pattern options * diff --git a/src/Pattern/CallbackCache.php b/src/Pattern/CallbackCache.php index 148555d9b..3001f5659 100644 --- a/src/Pattern/CallbackCache.php +++ b/src/Pattern/CallbackCache.php @@ -36,14 +36,15 @@ class CallbackCache extends AbstractPattern { /** * Set options - * - * @param PatternOptions $options + * + * @param PatternOptions $options * @return CallbackCache * @throws Exception\InvalidArgumentException if missing storage option */ public function setOptions(PatternOptions $options) { parent::setOptions($options); + if (!$options->getStorage()) { throw new Exception\InvalidArgumentException("Missing option 'storage'"); } @@ -72,7 +73,8 @@ public function call($callback, array $args = array(), array $options = array()) return $rs[0]; } - if ( ($cacheOutput = $classOptions->getCacheOutput()) ) { + $cacheOutput = $classOptions->getCacheOutput(); + if ($cacheOutput) { ob_start(); ob_implicit_flush(false); } diff --git a/src/Pattern/CaptureCache.php b/src/Pattern/CaptureCache.php index f0176417e..9f082deea 100644 --- a/src/Pattern/CaptureCache.php +++ b/src/Pattern/CaptureCache.php @@ -69,7 +69,7 @@ public function start($pageId = null, array $options = array()) } ob_start(array($this, 'flush')); - ob_implicitflush(false); + ob_implicit_flush(false); $this->pageId = $pageId; return false; diff --git a/src/Pattern/PatternOptions.php b/src/Pattern/PatternOptions.php index 1955c510b..53a99a281 100644 --- a/src/Pattern/PatternOptions.php +++ b/src/Pattern/PatternOptions.php @@ -189,7 +189,7 @@ public function setCacheByDefault($cacheByDefault) $this->cacheByDefault = $cacheByDefault; return $this; } - + /** * Do we cache by default? * @@ -220,7 +220,7 @@ public function setCacheOutput($cacheOutput) $this->cacheOutput = (bool) $cacheOutput; return $this; } - + /** * Will we cache output? * @@ -253,7 +253,7 @@ public function setClass($class) $this->class = $class; return $this; } - + /** * Get class name * @@ -281,7 +281,7 @@ public function setClassCacheMethods(array $classCacheMethods) $this->classCacheMethods = $this->recursiveStrtolower($classCacheMethods); return $this; } - + /** * Get list of methods from which to cache return values * @@ -309,7 +309,7 @@ public function setClassNonCacheMethods(array $classNonCacheMethods) $this->classNonCacheMethods = $this->recursiveStrtolower($classNonCacheMethods); return $this; } - + /** * Get list of methods from which NOT to cache return values * @@ -327,8 +327,8 @@ public function getClassNonCacheMethods() * Set directory permissions * * Sets {@link $dirUmask} property to inverse of provided value. - * - * @param string $dirPerm + * + * @param string $dirPerm * @return PatternOptions */ public function setDirPerm($dirPerm) @@ -347,7 +347,7 @@ public function setDirPerm($dirPerm) * Gets directory permissions * * Proxies to {@link $dirUmask} property, returning its inverse. - * + * * @return int */ public function getDirPerm() @@ -377,7 +377,7 @@ public function setDirUmask($dirUmask) $this->dirUmask = $dirUmask; return $this; } - + /** * Get directory umask * @@ -405,7 +405,7 @@ public function setFileLocking($fileLocking) $this->fileLocking = (bool) $fileLocking; return $this; } - + /** * Is file locking enabled? * @@ -423,8 +423,8 @@ public function getFileLocking() * Set file permissions * * Sets {@link $fileUmask} property to inverse of provided value. - * - * @param string $filePerm + * + * @param string $filePerm * @return PatternOptions */ public function setFilePerm($filePerm) @@ -443,7 +443,7 @@ public function setFilePerm($filePerm) * Gets file permissions * * Proxies to {@link $fileUmask} property, returning its inverse. - * + * * @return int */ public function getFilePerm() @@ -478,7 +478,7 @@ public function setFileUmask($fileUmask) $this->fileUmask = $fileUmask; return $this; } - + /** * Get file umask * @@ -503,7 +503,7 @@ public function setIndexFilename($indexFilename) $this->indexFilename = (string) $indexFilename; return $this; } - + /** * Get value for index filename * @@ -530,7 +530,7 @@ public function setObject($object) $this->object = $object; return $this; } - + /** * Get object to cache * @@ -555,7 +555,7 @@ public function setObjectCacheMagicProperties($objectCacheMagicProperties) $this->objectCacheMagicProperties = (bool) $objectCacheMagicProperties; return $this; } - + /** * Should we cache magic properties? * @@ -581,7 +581,7 @@ public function setObjectCacheMethods(array $objectCacheMethods) $this->objectCacheMethods = $this->normalizeObjectMethods($objectCacheMethods); return $this; } - + /** * Get list of object methods for which to cache return values * @@ -612,7 +612,7 @@ public function setObjectKey($objectKey) } return $this; } - + /** * Get object key * @@ -638,7 +638,7 @@ public function setObjectNonCacheMethods(array $objectNonCacheMethods) $this->objectNonCacheMethods = $this->normalizeObjectMethods($objectNonCacheMethods); return $this; } - + /** * Get list of object methods for which NOT to cache return values * @@ -663,7 +663,7 @@ public function setPublicDir($publicDir) $this->publicDir = (string) $publicDir; return $this; } - + /** * Get location of public directory * @@ -695,7 +695,7 @@ public function setStorage($storage) $this->storage = $storage; return $this; } - + /** * Get storage adapter * @@ -727,7 +727,7 @@ public function setTagKey($tagKey) $this->tagKey = $tagKey; return $this; } - + /** * Get tag key * @@ -752,7 +752,7 @@ public function setTags(array $tags) $this->tags = $tags; return $this; } - + /** * Get tags * @@ -781,7 +781,7 @@ public function setTagStorage($tagStorage) $this->tagStorage = $tagStorage; return $this; } - + /** * Get storage adapter for tags * @@ -798,8 +798,8 @@ public function getTagStorage() /** * Recursively apply strtolower on all values of an array, and return as a * list of unique values - * - * @param array $array + * + * @param array $array * @return array */ protected function recursiveStrtolower(array $array) @@ -811,11 +811,11 @@ protected function recursiveStrtolower(array $array) /** * Normalize object methods - * - * Recursively casts values to lowercase, then determines if any are in a + * + * Recursively casts values to lowercase, then determines if any are in a * list of methods not handled, raising an exception if so. * - * @param array $methods + * @param array $methods * @return array * @throws Exception\InvalidArgumentException */ @@ -836,13 +836,13 @@ protected function normalizeObjectMethods(array $methods) * * Allows specifying a umask as either an octal or integer. If the umask * fails required permissions, raises an exception. - * - * @param int|string $mask - * @param callable Callback used to verify the umask is acceptable for the given purpose + * + * @param int|string $umask + * @param callable $comparison Callback used to verify the umask is acceptable for the given purpose * @return int * @throws Exception\InvalidArgumentException */ - protected function normalizeUmask($mask, $comparison) + protected function normalizeUmask($umask, $comparison) { if (is_string($umask)) { $umask = octdec($umask); @@ -857,8 +857,8 @@ protected function normalizeUmask($mask, $comparison) /** * Create a storage object from a given specification - * - * @param array|string|StorageAdapter $storage + * + * @param array|string|StorageAdapter $storage * @return StorageAdapter */ protected function storageFactory($storage) diff --git a/src/Storage/Adapter/AbstractAdapter.php b/src/Storage/Adapter/AbstractAdapter.php index c75025e82..b0a046a3d 100644 --- a/src/Storage/Adapter/AbstractAdapter.php +++ b/src/Storage/Adapter/AbstractAdapter.php @@ -141,18 +141,6 @@ public function __destruct() */ public function setOptions($options) { - if (!is_array($options) - && !$options instanceof Traversable - && !$options instanceof AdapterOptions - ) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects an array, a Traversable object, or an AdapterOptions instance; ' - . 'received "%s"', - __METHOD__, - (is_object($options) ? get_class($options) : gettype($options)) - )); - } - if (!$options instanceof AdapterOptions) { $options = new AdapterOptions($options); } @@ -696,7 +684,7 @@ public function incrementItems(array $keyValuePairs, array $options = array()) $ret = true; foreach ($keyValuePairs as $key => $value) { - $ret = $this->incrementItems($key, $value, $options) && $ret; + $ret = $this->incrementItem($key, $value, $options) && $ret; } return $ret; } @@ -738,7 +726,7 @@ public function decrementItems(array $keyValuePairs, array $options = array()) $ret = true; foreach ($keyValuePairs as $key => $value) { - $ret = $this->decrementMulti($key, $value, $options) && $ret; + $ret = $this->decrementItem($key, $value, $options) && $ret; } return $ret; } diff --git a/src/Storage/Adapter/AbstractZendServer.php b/src/Storage/Adapter/AbstractZendServer.php index 121fe7424..97a392b54 100644 --- a/src/Storage/Adapter/AbstractZendServer.php +++ b/src/Storage/Adapter/AbstractZendServer.php @@ -287,7 +287,14 @@ public function getMetadata($key, array $options = array()) } $internalKey = $options['namespace'] . self::NAMESPACE_SEPARATOR . $key; - $result = ($this->zdcFetch($internalKey) !== false) ? array() : false; + if ($this->zdcFetch($internalKey) === false) { + if (!$options['ignore_missing_items']) { + throw new Exception\ItemNotFoundException("Key '{$internalKey}' not found"); + } + $result = false; + } else { + $result = array(); + } return $this->triggerPost(__FUNCTION__, $args, $result); } catch (\Exception $e) { @@ -427,7 +434,6 @@ public function removeItem($key, array $options = array()) $this->normalizeOptions($options); $args = new ArrayObject(array( 'key' => & $key, - 'value' => & $value, 'options' => & $options, )); diff --git a/src/Storage/Adapter/Apc.php b/src/Storage/Adapter/Apc.php index c9f4e0bd3..08110fb73 100644 --- a/src/Storage/Adapter/Apc.php +++ b/src/Storage/Adapter/Apc.php @@ -118,18 +118,6 @@ public function __construct($options = null) */ public function setOptions($options) { - if (!is_array($options) - && !$options instanceof Traversable - && !$options instanceof ApcOptions - ) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects an array, a Traversable object, or an ApcOptions instance; ' - . 'received "%s"', - __METHOD__, - (is_object($options) ? get_class($options) : gettype($options)) - )); - } - if (!$options instanceof ApcOptions) { $options = new ApcOptions($options); } @@ -834,7 +822,6 @@ public function removeItem($key, array $options = array()) $this->normalizeKey($key); $args = new ArrayObject(array( 'key' => & $key, - 'value' => & $value, 'options' => & $options, )); @@ -1076,7 +1063,7 @@ public function getDelayed(array $keys, array $options = array()) } $args = new ArrayObject(array( - 'key' => & $key, + 'keys' => & $keys, 'options' => & $options, )); diff --git a/src/Storage/Adapter/Filesystem.php b/src/Storage/Adapter/Filesystem.php index 351b6c512..789f3e549 100644 --- a/src/Storage/Adapter/Filesystem.php +++ b/src/Storage/Adapter/Filesystem.php @@ -79,18 +79,6 @@ class Filesystem extends AbstractAdapter */ public function setOptions($options) { - if (!is_array($options) - && !$options instanceof Traversable - && !$options instanceof FilesystemOptions - ) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects an array, a Traversable object, or an FilesystemOptions instance; ' - . 'received "%s"', - __METHOD__, - (is_object($options) ? get_class($options) : gettype($options)) - )); - } - if (!$options instanceof FilesystemOptions) { $options = new FilesystemOptions($options); } @@ -1035,7 +1023,7 @@ public function optimize(array $options = array()) return $eventRs->last(); } - if ( ($dirLevel = $baseOptions->getDirLevel()) ) { + if ($baseOptions->getDirLevel()) { // removes only empty directories $this->rmDir( $baseOptions->getCacheDir(), @@ -1162,7 +1150,7 @@ protected function internalSetItem($key, $value, array &$options) $error = ErrorHandler::stop(); if (!$mkdir) { throw new Exception\RuntimeException( - "Error creating directory '{$file}'", 0, $error + "Error creating directory '{$path}'", 0, $error ); } } @@ -1171,7 +1159,7 @@ protected function internalSetItem($key, $value, array &$options) $info = null; if ($baseOptions->getReadControl()) { - $info['hash'] = Utils::generateHash($this->getReadControlAlgo(), $data, true); + $info['hash'] = Utils::generateHash($this->getReadControlAlgo(), $value, true); $info['algo'] = $baseOptions->getReadControlAlgo(); } @@ -1335,7 +1323,8 @@ protected function internalGetMetadata($key, array &$options) $keyInfo['atime'] = fileatime($keyInfo['filespec'] . '.dat'); } - if ( ($info = $this->readInfoFile($keyInfo['filespec'] . '.ifo')) ) { + $info = $this->readInfoFile($keyInfo['filespec'] . '.ifo'); + if ($info) { return $keyInfo + $info; } @@ -1368,7 +1357,7 @@ protected function internalTouchItem($key, array &$options) $error = ErrorHandler::stop(); if (!$touch) { throw new Exception\RuntimeException( - "Error touching file '{$file}'", 0, $error + "Error touching file '{$keyInfo['filespec']}.dat'", 0, $error ); } } @@ -1443,19 +1432,19 @@ protected function fetchByGlob() // if MATCH_TAGS mode -> check if all given tags available in current cache if (($mode & self::MATCH_TAGS_AND) == self::MATCH_TAGS_AND ) { - if (!isset($meta['tags']) || count(array_diff($opts['tags'], $meta['tags'])) > 0) { + if (!isset($meta['tags']) || count(array_diff($options['tags'], $meta['tags'])) > 0) { continue; } // if MATCH_NO_TAGS mode -> check if no given tag available in current cache } elseif( ($mode & self::MATCH_TAGS_NEGATE) == self::MATCH_TAGS_NEGATE ) { - if (isset($meta['tags']) && count(array_diff($opts['tags'], $meta['tags'])) != count($opts['tags'])) { + if (isset($meta['tags']) && count(array_diff($options['tags'], $meta['tags'])) != count($options['tags'])) { continue; } // if MATCH_ANY_TAGS mode -> check if any given tag available in current cache } elseif ( ($mode & self::MATCH_TAGS_OR) == self::MATCH_TAGS_OR ) { - if (!isset($meta['tags']) || count(array_diff($opts['tags'], $meta['tags'])) == count($opts['tags'])) { + if (!isset($meta['tags']) || count(array_diff($options['tags'], $meta['tags'])) == count($options['tags'])) { continue; } @@ -1541,7 +1530,7 @@ protected function clearByPrefix($prefix, $mode, array &$opts) // check tags only if one of the tag matching mode is selected if (($mode & 070) > 0) { - $info = $this->readInfoFile($filespec . '.ifo'); + $info = $this->readInfoFile($pathnameSpec . '.ifo'); // if MATCH_TAGS mode -> check if all given tags available in current cache if (($mode & self::MATCH_TAGS) == self::MATCH_TAGS ) { diff --git a/src/Storage/Adapter/Memcached.php b/src/Storage/Adapter/Memcached.php index c46966c1d..c706025d8 100644 --- a/src/Storage/Adapter/Memcached.php +++ b/src/Storage/Adapter/Memcached.php @@ -93,18 +93,6 @@ public function __construct($options = null) */ public function setOptions($options) { - if (!is_array($options) - && !$options instanceof Traversable - && !$options instanceof MemcachedOptions - ) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects an array, a Traversable object, or a MemcachedOptions object; ' - . 'received "%s"', - __METHOD__, - (is_object($options) ? get_class($options) : gettype($options)) - )); - } - if (!$options instanceof MemcachedOptions) { $options = new MemcachedOptions($options); } diff --git a/src/Storage/Adapter/Memory.php b/src/Storage/Adapter/Memory.php index 00bbc26ea..9517dde6e 100644 --- a/src/Storage/Adapter/Memory.php +++ b/src/Storage/Adapter/Memory.php @@ -64,18 +64,6 @@ class Memory extends AbstractAdapter */ public function setOptions($options) { - if (!is_array($options) - && !$options instanceof Traversable - && !$options instanceof MemoryOptions - ) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects an array, a Traversable object, or an MemoryOptions instance; ' - . 'received "%s"', - __METHOD__, - (is_object($options) ? get_class($options) : gettype($options)) - )); - } - if (!$options instanceof MemoryOptions) { $options = new MemoryOptions($options); } @@ -657,7 +645,7 @@ public function replaceItems(array $keyValuePairs, array $options = array()) } $this->normalizeOptions($options); - $args = ArrayObject(array( + $args = new ArrayObject(array( 'keyValuePairs' => & $keyValuePairs, 'options' => & $options, )); diff --git a/src/Storage/Adapter/WinCache.php b/src/Storage/Adapter/WinCache.php index 3848634e8..fafbc8464 100644 --- a/src/Storage/Adapter/WinCache.php +++ b/src/Storage/Adapter/WinCache.php @@ -81,17 +81,10 @@ public function __construct($options = null) */ public function setOptions($options) { - if (!is_array($options) - && !$options instanceof Traversable - && !$options instanceof WinCacheOptions - ) { - throw new Exception\InvalidArgumentException(sprintf( - '%s expects an array, a Traversable object; ' - . 'received "%s"', - __METHOD__, - (is_object($options) ? get_class($options) : gettype($options)) - )); + if (!$options instanceof WinCacheOptions) { + $options = new WinCacheOptions($options); } + $this->options = $options; return $this; } @@ -380,7 +373,7 @@ public function getMetadata($key, array $options = array()) $internalKey = $options['namespace'] . $baseOptions->getNamespaceSeparator() . $key; - $info = wincache_ucache_info(true, $internalKey); + $info = wincache_ucache_info(true, $internalKey); if (isset($info['ucache_entries'][1])) { $metadata = $info['ucache_entries'][1]; } @@ -620,7 +613,7 @@ public function addItem($key, $value, array $options = array()) } $internalKey = $options['namespace'] . $baseOptions->getNamespaceSeparator() . $key; - if (!@wincache_ucache_add($internalKey, $value, $options['ttl'])) { + if (!wincache_ucache_add($internalKey, $value, $options['ttl'])) { if (wincache_ucache_exists($internalKey)) { throw new Exception\RuntimeException("Key '{$internalKey}' already exists"); } @@ -787,7 +780,6 @@ public function removeItem($key, array $options = array()) $this->normalizeKey($key); $args = new ArrayObject(array( 'key' => & $key, - 'value' => & $value, 'options' => & $options, )); @@ -977,8 +969,7 @@ public function clear($mode = self::MATCH_EXPIRED, array $options = array()) return $eventRs->last(); } - $result= wincache_ucache_clear(); - + $result = wincache_ucache_clear(); return $this->triggerPost(__FUNCTION__, $args, $result); } catch (\Exception $e) { return $this->triggerException(__FUNCTION__, $args, $e); diff --git a/src/Storage/Adapter/ZendServerDisk.php b/src/Storage/Adapter/ZendServerDisk.php index fac6cb907..85a930f54 100644 --- a/src/Storage/Adapter/ZendServerDisk.php +++ b/src/Storage/Adapter/ZendServerDisk.php @@ -21,7 +21,8 @@ namespace Zend\Cache\Storage\Adapter; -use Zend\Cache\Utils, +use ArrayObject, + Zend\Cache\Utils, Zend\Cache\Exception; /** @@ -90,12 +91,12 @@ public function getCapacity(array $options = array()) * @return void * @throws Exception\RuntimeException */ - protected function zdcStore($key, $value, $ttl) + protected function zdcStore($internalKey, $value, $ttl) { - if (!zend_disk_cache_store($key, $value, $ttl)) { + if (!zend_disk_cache_store($internalKey, $value, $ttl)) { $valueType = gettype($value); throw new Exception\RuntimeException( - "zend_disk_cache_store($internalKey, <{$valueType}>, {$options['ttl']}) failed" + "zend_disk_cache_store($internalKey, <{$valueType}>, {$ttl}) failed" ); } } @@ -107,9 +108,9 @@ protected function zdcStore($key, $value, $ttl) * @return mixed The stored value or FALSE if item wasn't found * @throws Exception\RuntimeException */ - protected function zdcFetch($key) + protected function zdcFetch($internalKey) { - return zend_disk_cache_fetch((string)$key); + return zend_disk_cache_fetch((string)$internalKey); } /** @@ -135,9 +136,9 @@ protected function zdcFetchMulti(array $internalKeys) * @return boolean * @throws Exception\RuntimeException */ - protected function zdcDelete($key) + protected function zdcDelete($internalKey) { - return zend_disk_cache_delete($key); + return zend_disk_cache_delete($internalKey); } /** diff --git a/src/Storage/Adapter/ZendServerShm.php b/src/Storage/Adapter/ZendServerShm.php index 4d71ead47..f04b64bf1 100644 --- a/src/Storage/Adapter/ZendServerShm.php +++ b/src/Storage/Adapter/ZendServerShm.php @@ -21,7 +21,8 @@ namespace Zend\Cache\Storage\Adapter; -use Zend\Cache\Exception; +use ArrayObject, + Zend\Cache\Exception; /** * @category Zend @@ -95,12 +96,12 @@ public function getCapacity(array $options = array()) * @return void * @throws Exception\RuntimeException */ - protected function zdcStore($key, $value, $ttl) + protected function zdcStore($internalKey, $value, $ttl) { - if (!zend_shm_cache_store($key, $value, $ttl)) { + if (!zend_shm_cache_store($internalKey, $value, $ttl)) { $valueType = gettype($value); throw new Exception\RuntimeException( - "zend_disk_cache_store($internalKey, <{$valueType}>, {$options['ttl']}) failed" + "zend_disk_cache_store($internalKey, <{$valueType}>, {$ttl}) failed" ); } } @@ -112,9 +113,9 @@ protected function zdcStore($key, $value, $ttl) * @return mixed The stored value or FALSE if item wasn't found * @throws Exception\RuntimeException */ - protected function zdcFetch($key) + protected function zdcFetch($internalKey) { - return zend_shm_cache_fetch((string)$key); + return zend_shm_cache_fetch((string)$internalKey); } /** @@ -140,9 +141,9 @@ protected function zdcFetchMulti(array $internalKeys) * @return boolean * @throws Exception\RuntimeException */ - protected function zdcDelete($key) + protected function zdcDelete($internalKey) { - return zend_shm_cache_delete($key); + return zend_shm_cache_delete($internalKey); } /** diff --git a/src/Storage/Plugin/ExceptionHandler.php b/src/Storage/Plugin/ExceptionHandler.php index 6aea248e7..1844afe7b 100644 --- a/src/Storage/Plugin/ExceptionHandler.php +++ b/src/Storage/Plugin/ExceptionHandler.php @@ -145,8 +145,9 @@ public function detach(EventCollection $eventCollection) */ public function onException(ExceptionEvent $event) { - $options = $this->getOptions(); - if (($callback = $options->getExceptionCallback())) { + $options = $this->getOptions(); + $callback = $options->getExceptionCallback(); + if ($callback) { call_user_func($callback, $event->getException()); } diff --git a/src/Storage/Plugin/IgnoreUserAbort.php b/src/Storage/Plugin/IgnoreUserAbort.php index 0fe2f8402..d8607156f 100644 --- a/src/Storage/Plugin/IgnoreUserAbort.php +++ b/src/Storage/Plugin/IgnoreUserAbort.php @@ -21,7 +21,8 @@ namespace Zend\Cache\Storage\Plugin; -use Zend\Cache\Storage\Adapter, +use Zend\Cache\Exception, + Zend\Cache\Storage\Adapter, Zend\Cache\Storage\Event, Zend\EventManager\EventCollection; diff --git a/test/Storage/Adapter/CommonAdapterTest.php b/test/Storage/Adapter/CommonAdapterTest.php index 55596271f..1d1b04e60 100644 --- a/test/Storage/Adapter/CommonAdapterTest.php +++ b/test/Storage/Adapter/CommonAdapterTest.php @@ -980,7 +980,7 @@ public function testTouchItem() $this->assertTrue($this->_storage->setItem('key', 'value')); // sleep 1 times before expire to touch the item - usleep($capabilities->getTtlPrecision() * 2000000); + usleep($capabilities->getTtlPrecision() * 1000000); $this->assertTrue($this->_storage->touchItem('key')); usleep($capabilities->getTtlPrecision() * 1000000); diff --git a/test/Storage/Adapter/ZendServerDiskTest.php b/test/Storage/Adapter/ZendServerDiskTest.php index c0002748b..e061a1b89 100644 --- a/test/Storage/Adapter/ZendServerDiskTest.php +++ b/test/Storage/Adapter/ZendServerDiskTest.php @@ -46,7 +46,8 @@ public function setUp() } } - $this->_storage = new Cache\Storage\Adapter\ZendServerDisk(); + $this->_options = new Cache\Storage\Adapter\AdapterOptions(); + $this->_storage = new Cache\Storage\Adapter\ZendServerDisk($this->_options); parent::setUp(); } diff --git a/test/Storage/Adapter/ZendServerShmTest.php b/test/Storage/Adapter/ZendServerShmTest.php index f23b8e041..4deb29640 100644 --- a/test/Storage/Adapter/ZendServerShmTest.php +++ b/test/Storage/Adapter/ZendServerShmTest.php @@ -51,7 +51,8 @@ public function setUp() } } - $this->_storage = new Cache\Storage\Adapter\ZendServerShm(); + $this->_options = new Cache\Storage\Adapter\AdapterOptions(); + $this->_storage = new Cache\Storage\Adapter\ZendServerShm($this->_options); parent::setUp(); }