pax_global_header00006660000000000000000000000064143617756730014535gustar00rootroot0000000000000052 comment=8dd6852b26bc0060a85678602e3b7d624e0ad0ea component-cache-2.0.6/000077500000000000000000000000001436177567300146055ustar00rootroot00000000000000component-cache-2.0.6/LICENSE000066400000000000000000000167441436177567300156260ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. component-cache-2.0.6/README.md000066400000000000000000000163371436177567300160760ustar00rootroot00000000000000# Matomo/Cache This is a PHP caching library based on [Doctrine cache](https://github.com/doctrine/cache) that supports different backends. At [Matomo](https://matomo.org) we developed this library with the focus on speed as we make heavy use of caching and sometimes fetch hundreds of entries from the cache in one request. [![Build Status](https://travis-ci.com/matomo-org/component-cache.svg?branch=master)](https://travis-ci.com/matomo-org/component-cache) ## Installation With Composer: ```json { "require": { "matomo/cache": "*" } } ``` ## Supported backends * Array (holds cache entries only during one request but is very fast) * Null (useful for development, won't cache anything) * File (stores the cache entry on the file system) * Redis (stores the cache entry on a Redis server, requires [phpredis](https://github.com/nicolasff/phpredis)) * Chained (allows to chain multiple backends to make sure it will read from a fast cache if possible) * DefaultTimeout and KeyPrefix can be used to wrap other backend with default parameters. Doctrine cache provides support for many more backends and adding one of those is easy. For example: * APC * Couchbase * Memcache * MongoDB * Riak * WinCache * Xcache * ZendData Please send a pull request in case you have added one. ## Different caches This library comes with three different types of caches. The naming is not optimal right now. ### Lazy This can be considered as the default cache to use in case you don't know which one to pick. The lazy cache works with any backend so you can decide whether you want to persist cache entries between requests or not. It does not support the caching of any objects. Only boolean, numbers, strings and arrays are supported. Whenever you request an entry from the cache it will fetch the entry from the defined backend again which can cause many reads depending on your application. ### Eager This cache stores all its cache entries under one "cache" entry in a configurable backend. This comes handy for things that you need very often, nearly in every request. Instead of having to read eg. a hundred cache entries from files it only loads one cache entry which contains the hundred keys. Should be used only for things that you need very often and only for cache entries that are not too large to keep loading and parsing the single cache entry fast. This cache is even more useful in case you are using a slow backend such as a file or a database. Instead of having a hundred stat calls there will be only one. All cache entries it contains have the same life time. For fast performance it won't validate any cache ids. It is not possible to cache any objects using this cache. ### Transient This class is used to cache any data during one request. It won't be persisted. All cache entries will be cached in a simple array meaning it is very fast to save and fetch cache entries. You can basically achieve the same by using a lazy cache and a backend that does not persist any data such as the array cache but this one will be a bit faster as it won't validate any cache ids and it allows you to cache any kind of objects. Compared to the lazy cache it does not support setting any life time as it will be only valid during one request anyway. Use this one if you read hundreds or thousands of cache entries and if performance really matters to you. ## Usage ### Creating a file backend ```php $options = array('directory' => '/path/to/cache'); $factory = new \Matomo\Cache\Backend\Factory(); $backend = $factory->buildBackend('file', $options); ``` ### Creating a Redis backend ```php $options = array( 'host' => '127.0.0.1', 'port' => '6379', 'timeout' => 0.0, 'database' => 15, // optional 'password' => 'secret', // optional ); $factory = new \Matomo\Cache\Backend\Factory(); $backend = $factory->buildBackend('redis', $options); ``` ### Creating a chained backend ```php $options = array( 'backends' => array('array', 'file'), 'file' => array('directory' => '/path/to/cache') ); $factory = new \Matomo\Cache\Backend\Factory(); $backend = $factory->buildBackend('redis', $options); ``` Whenever you set a cache entry it will save it in the array and in the file cache. Whenever you are trying to read a cache entry it will first try to get it from the fast array cache. In case it is not available there it will try to fetch the cache entry from the file system. If the cache entry exists on the file system it will cache the entry automatically using the array cache so the next read within this request will be fast and won't cause a stat call again. If you delete a cache entry it will be removed from all configured backends. You can chain any backends. It is recommended to list faster backends first. ### Creating a decorated backend with `DefaultTimeout` or `KeyPrefix` ```php $options = array( 'backend' => 'array', 'array' => array(), 'keyPrefix' => 'someKeyPrefixStr' ); $factory = new \Matomo\Cache\Backend\Factory(); $backend = $factory->buildBackend('keyPrefix', $options); ``` Sometimes its useful to set default a default parameter for the timeout to force prevent infinite lifetimes, or to specify a key prefix to prevent different versions of the app from reading and writing the same cache entry. `DefaultTimeout` and `KeyPrefix` are "decorators" that wrap another backend. Currently each takes a single configuration argument with the same name as the backend. |backend | argument | description | | --- | --- | --- | |DefaultTimeout|`defaultTimeout`| Uses the `integer` value as the default timeout for defining cache entry lifetime. Only comes to effect when no lifetime is specified; Prevents infinite lifetimes.| |KeyPrefix|`keyPrefix`| Prefixes the given value to the keys for any operation. For example `'Key123'` would become `'SomePrefixKey123'` | ### Creating a lazy cache [Description lazy cache.](#lazy) ```php $factory = new \Matomo\Cache\Backend\Factory(); $backend = $factory->buildBackend('file', array('directory' => '/path/to/cache')); $cache = new \Matomo\Cache\Lazy($backend); $cache->fetch('myid'); $cache->contains('myid'); $cache->delete('myid'); $cache->save('myid', 'myvalue', $lifeTimeInSeconds = 300); $cache->flushAll(); ``` ### Creating an eager cache [Description eager cache.](#eager) ```php $cache = new \Matomo\Cache\Eager($backend, $storageId = 'eagercache'); $cache->fetch('myid'); $cache->contains('myid'); $cache->delete('myid'); $cache->save('myid', new \stdClass()); $cache->persistCacheIfNeeded($lifeTimeInSeconds = 300); $cache->flushAll(); ``` It will cache all set cache entries under the cache entry `eagercache`. ### Creating a transient cache [Description transient cache.](#transient) ```php $cache = new \Matomo\Cache\Transient(); $cache->fetch('myid'); $cache->contains('myid'); $cache->delete('myid'); $cache->save('myid', new \stdClass()); $cache->flushAll(); ``` ## License The Cache component is released under the [LGPL v3.0](http://choosealicense.com/licenses/lgpl-3.0/). ## Changelog * 0.2.5: updating to doctrine/cache 1.4 which contains our fix * 0.2.4: do not throw exception when clearing a file cache if the cache dir doesn't exist * 0.2.3: fixed another race condition in file cache * 0.2.2: fixed a race condition in file cache * 0.2.0: Initial release component-cache-2.0.6/composer.json000066400000000000000000000016731436177567300173360ustar00rootroot00000000000000{ "name": "matomo/cache", "type": "library", "license": "LGPL-3.0", "description": "PHP caching library based on Doctrine cache", "keywords": ["cache","array","file","redis"], "authors": [ { "name": "The Matomo Team", "email": "hello@matomo.org", "homepage": "https://matomo.org/the-matomo-team/" } ], "autoload": { "psr-4": { "Matomo\\Cache\\": "src/" } }, "autoload-dev": { "psr-4": { "Tests\\Matomo\\Cache\\": "tests/" } }, "require": { "php": ">=7.1", "matomo/doctrine-cache-fork": "1.10.4" }, "require-dev": { "phpunit/phpunit": "~7.0" }, "config":{ "platform": { "php": "7.1.0" } }, "repositories": [ { "type": "vcs", "url": "https://github.com/matomo-org/cache.git" } ] } component-cache-2.0.6/composer.lock000066400000000000000000001734201436177567300173150ustar00rootroot00000000000000{ "_readme": [ "This file locks the dependencies of your project to a known state", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], "content-hash": "54ddd3232468f11ff58df3b4974f8837", "packages": [ { "name": "matomo/doctrine-cache-fork", "version": "1.10.4", "source": { "type": "git", "url": "https://github.com/matomo-org/cache.git", "reference": "a3f6b7e86061a2f3c68122ee58e9d8aa815baff6" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/matomo-org/cache/zipball/a3f6b7e86061a2f3c68122ee58e9d8aa815baff6", "reference": "a3f6b7e86061a2f3c68122ee58e9d8aa815baff6", "shasum": "" }, "require": { "php": "~7.1 || ^8.0" }, "conflict": { "doctrine/common": ">2.2,<2.4" }, "require-dev": { "alcaeus/mongo-php-adapter": "^1.1", "doctrine/coding-standard": "^6.0", "mongodb/mongodb": "^1.1", "phpunit/phpunit": "^7.0", "predis/predis": "~1.0" }, "suggest": { "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.9.x-dev" } }, "autoload": { "psr-4": { "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" } }, "autoload-dev": { "psr-4": { "Doctrine\\Tests\\": "tests/Doctrine/Tests" } }, "license": [ "MIT" ], "authors": [ { "name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com" }, { "name": "Roman Borschel", "email": "roman@code-factory.org" }, { "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" }, { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com" } ], "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", "homepage": "https://www.doctrine-project.org/projects/cache.html", "keywords": [ "abstraction", "apcu", "cache", "caching", "couchdb", "memcached", "php", "redis", "xcache" ], "support": { "source": "https://github.com/matomo-org/cache/tree/1.10.4" }, "funding": [ { "type": "patreon", "url": "https://www.patreon.com/phpdoctrine" }, { "type": "tidelift", "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache" }, { "type": "custom", "url": "https://www.doctrine-project.org/sponsorship.html" } ], "time": "2021-09-13T22:06:08+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^8.0", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", "phpstan/phpstan": "^0.12", "phpstan/phpstan-phpunit": "^0.12", "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", "source": "https://github.com/doctrine/instantiator/tree/1.4.0" }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", "type": "custom" }, { "url": "https://www.patreon.com/phpdoctrine", "type": "patreon" }, { "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", "type": "tidelift" } ], "time": "2020-11-10T18:47:58+00:00" }, { "name": "myclabs/deep-copy", "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "replace": { "myclabs/deep-copy": "self.version" }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { "psr-4": { "DeepCopy\\": "src/DeepCopy/" }, "files": [ "src/DeepCopy/deep_copy.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Create deep copies (clones) of your objects", "keywords": [ "clone", "copy", "duplicate", "object", "object graph" ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" }, "funding": [ { "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", "type": "tidelift" } ], "time": "2020-11-13T09:40:50+00:00" }, { "name": "phar-io/manifest", "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", "phar-io/version": "^2.0", "php": "^5.6 || ^7.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Arne Blankerts", "email": "arne@blankerts.de", "role": "Developer" }, { "name": "Sebastian Heuer", "email": "sebastian@phpeople.de", "role": "Developer" }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "Developer" } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", "source": "https://github.com/phar-io/manifest/tree/master" }, "time": "2018-07-08T19:23:20+00:00" }, { "name": "phar-io/version", "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", "shasum": "" }, "require": { "php": "^5.6 || ^7.0" }, "type": "library", "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Arne Blankerts", "email": "arne@blankerts.de", "role": "Developer" }, { "name": "Sebastian Heuer", "email": "sebastian@phpeople.de", "role": "Developer" }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "Developer" } ], "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", "source": "https://github.com/phar-io/version/tree/master" }, "time": "2018-07-08T19:19:57+00:00" }, { "name": "phpdocumentor/reflection-common", "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", "shasum": "" }, "require": { "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.x-dev" } }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Jaap van Otterdijk", "email": "opensource@ijaap.nl" } ], "description": "Common reflection classes used by phpdocumentor to reflect the code structure", "homepage": "http://www.phpdoc.org", "keywords": [ "FQSEN", "phpDocumentor", "phpdoc", "reflection", "static analysis" ], "support": { "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/master" }, "time": "2020-04-27T09:25:28+00:00" }, { "name": "phpdocumentor/reflection-docblock", "version": "4.3.4", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c", "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c", "shasum": "" }, "require": { "php": "^7.0", "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", "webmozart/assert": "^1.0" }, "require-dev": { "doctrine/instantiator": "^1.0.5", "mockery/mockery": "^1.0", "phpdocumentor/type-resolver": "0.4.*", "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { "branch-alias": { "dev-master": "4.x-dev" } }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": [ "src/" ] } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Mike van Riel", "email": "me@mikevanriel.com" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/4.x" }, "time": "2019-12-28T18:55:12+00:00" }, { "name": "phpdocumentor/type-resolver", "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", "shasum": "" }, "require": { "php": "^7.1", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { "ext-tokenizer": "^7.1", "mockery/mockery": "~1", "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.x-dev" } }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Mike van Riel", "email": "me@mikevanriel.com" } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", "source": "https://github.com/phpDocumentor/TypeResolver/tree/0.7.2" }, "time": "2019-08-22T18:11:29+00:00" }, { "name": "phpspec/prophecy", "version": "v1.10.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", "reference": "451c3cd1418cf640de218914901e51b064abb093" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", "reference": "451c3cd1418cf640de218914901e51b064abb093", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" }, "require-dev": { "phpspec/phpspec": "^2.5 || ^3.2", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.10.x-dev" } }, "autoload": { "psr-4": { "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Konstantin Kudryashov", "email": "ever.zet@gmail.com", "homepage": "http://everzet.com" }, { "name": "Marcello Duarte", "email": "marcello.duarte@gmail.com" } ], "description": "Highly opinionated mocking framework for PHP 5.3+", "homepage": "https://github.com/phpspec/prophecy", "keywords": [ "Double", "Dummy", "fake", "mock", "spy", "stub" ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", "source": "https://github.com/phpspec/prophecy/tree/v1.10.3" }, "time": "2020-03-05T15:02:03+00:00" }, { "name": "phpunit/php-code-coverage", "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", "php": "^7.1", "phpunit/php-file-iterator": "^2.0", "phpunit/php-text-template": "^1.2.1", "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", "sebastian/environment": "^3.1 || ^4.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, "require-dev": { "phpunit/phpunit": "^7.0" }, "suggest": { "ext-xdebug": "^2.6.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "6.1-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", "homepage": "https://github.com/sebastianbergmann/php-code-coverage", "keywords": [ "coverage", "testing", "xunit" ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" }, "time": "2018-10-31T16:06:48+00:00" }, { "name": "phpunit/php-file-iterator", "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "FilterIterator implementation that filters files based on a list of suffixes.", "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", "keywords": [ "filesystem", "iterator" ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.2" }, "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "Simple template engine.", "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ "template" ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" }, "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.1-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "Utility class for timing", "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ "timer" ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", "source": "https://github.com/sebastianbergmann/php-timer/tree/master" }, "time": "2019-06-07T04:22:29+00:00" }, { "name": "phpunit/php-token-stream", "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", "shasum": "" }, "require": { "ext-tokenizer": "*", "php": "^7.1" }, "require-dev": { "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.1-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Wrapper around PHP's tokenizer extension.", "homepage": "https://github.com/sebastianbergmann/php-token-stream/", "keywords": [ "tokenizer" ], "support": { "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.1" }, "abandoned": true, "time": "2019-09-17T06:23:10+00:00" }, { "name": "phpunit/phpunit", "version": "7.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", "shasum": "" }, "require": { "doctrine/instantiator": "^1.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "myclabs/deep-copy": "^1.7", "phar-io/manifest": "^1.0.2", "phar-io/version": "^2.0", "php": "^7.1", "phpspec/prophecy": "^1.7", "phpunit/php-code-coverage": "^6.0.7", "phpunit/php-file-iterator": "^2.0.1", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^2.1", "sebastian/comparator": "^3.0", "sebastian/diff": "^3.0", "sebastian/environment": "^4.0", "sebastian/exporter": "^3.1", "sebastian/global-state": "^2.0", "sebastian/object-enumerator": "^3.0.3", "sebastian/resource-operations": "^2.0", "sebastian/version": "^2.0.1" }, "conflict": { "phpunit/phpunit-mock-objects": "*" }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-soap": "*", "ext-xdebug": "*", "phpunit/php-invoker": "^2.0" }, "bin": [ "phpunit" ], "type": "library", "extra": { "branch-alias": { "dev-master": "7.5-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "The PHP Unit Testing framework.", "homepage": "https://phpunit.de/", "keywords": [ "phpunit", "testing", "xunit" ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "source": "https://github.com/sebastianbergmann/phpunit/tree/7.5.20" }, "time": "2020-01-08T08:45:45+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "shasum": "" }, "require": { "php": "^5.6 || ^7.0" }, "require-dev": { "phpunit/phpunit": "^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/master" }, "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", "shasum": "" }, "require": { "php": "^7.1", "sebastian/diff": "^3.0", "sebastian/exporter": "^3.1" }, "require-dev": { "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.0-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" }, { "name": "Volker Dusch", "email": "github@wallbash.com" }, { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "source": "https://github.com/sebastianbergmann/comparator/tree/master" }, "time": "2018-07-12T15:12:46+00:00" }, { "name": "sebastian/diff", "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { "phpunit/phpunit": "^7.5 || ^8.0", "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.0-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Kore Nordmann", "email": "mail@kore-nordmann.de" }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ "diff", "udiff", "unidiff", "unified diff" ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "source": "https://github.com/sebastianbergmann/diff/tree/master" }, "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { "phpunit/phpunit": "^7.5" }, "suggest": { "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { "dev-master": "4.2-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Provides functionality to handle HHVM/PHP environments", "homepage": "http://www.github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", "hhvm" ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "source": "https://github.com/sebastianbergmann/environment/tree/4.2.3" }, "time": "2019-11-20T08:46:58+00:00" }, { "name": "sebastian/exporter", "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", "shasum": "" }, "require": { "php": "^7.0", "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.1.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" }, { "name": "Volker Dusch", "email": "github@wallbash.com" }, { "name": "Adam Harvey", "email": "aharvey@php.net" }, { "name": "Bernhard Schussek", "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", "homepage": "http://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "source": "https://github.com/sebastianbergmann/exporter/tree/master" }, "time": "2019-09-14T09:02:43+00:00" }, { "name": "sebastian/global-state", "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { "php": "^7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" }, "suggest": { "ext-uopz": "*" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.0-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Snapshotting of global state", "homepage": "http://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", "source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0" }, "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", "shasum": "" }, "require": { "php": "^7.0", "sebastian/object-reflector": "^1.1.1", "sebastian/recursion-context": "^3.0" }, "require-dev": { "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", "source": "https://github.com/sebastianbergmann/object-enumerator/tree/master" }, "time": "2017-08-03T12:35:26+00:00" }, { "name": "sebastian/object-reflector", "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", "reference": "773f97c67f28de00d397be301821b06708fca0be" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", "reference": "773f97c67f28de00d397be301821b06708fca0be", "shasum": "" }, "require": { "php": "^7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.1-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", "source": "https://github.com/sebastianbergmann/object-reflector/tree/master" }, "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { "php": "^7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, { "name": "Adam Harvey", "email": "aharvey@php.net" } ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", "source": "https://github.com/sebastianbergmann/recursion-context/tree/master" }, "time": "2017-03-03T06:23:57+00:00" }, { "name": "sebastian/resource-operations", "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.0-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { "issues": "https://github.com/sebastianbergmann/resource-operations/issues", "source": "https://github.com/sebastianbergmann/resource-operations/tree/master" }, "time": "2018-10-04T04:07:39+00:00" }, { "name": "sebastian/version", "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { "php": ">=5.6" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", "source": "https://github.com/sebastianbergmann/version/tree/master" }, "time": "2016-10-03T07:35:21+00:00" }, { "name": "symfony/polyfill-ctype", "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41", "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41", "shasum": "" }, "require": { "php": ">=7.1" }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { "dev-main": "1.20-dev" }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" } }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" }, "files": [ "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Gert de Pagter", "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", "ctype", "polyfill", "portable" ], "support": { "source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0" }, "funding": [ { "url": "https://symfony.com/sponsor", "type": "custom" }, { "url": "https://github.com/fabpot", "type": "github" }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], "time": "2020-10-23T14:02:19+00:00" }, { "name": "theseer/tokenizer", "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", "php": "^7.0" }, "type": "library", "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Arne Blankerts", "email": "arne@blankerts.de", "role": "Developer" } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", "source": "https://github.com/theseer/tokenizer/tree/master" }, "time": "2019-06-13T22:48:21+00:00" }, { "name": "webmozart/assert", "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", "vimeo/psalm": "<3.9.1" }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Bernhard Schussek", "email": "bschussek@gmail.com" } ], "description": "Assertions to validate method input/output with nice error messages.", "keywords": [ "assert", "check", "validate" ], "support": { "issues": "https://github.com/webmozart/assert/issues", "source": "https://github.com/webmozart/assert/tree/master" }, "time": "2020-07-08T17:02:28+00:00" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=7.1" }, "platform-dev": [], "platform-overrides": { "php": "7.1.0" }, "plugin-api-version": "2.0.0" } component-cache-2.0.6/src/000077500000000000000000000000001436177567300153745ustar00rootroot00000000000000component-cache-2.0.6/src/Backend.php000066400000000000000000000031121436177567300174310ustar00rootroot00000000000000 infinite lifeTime). * * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. */ public function doSave($id, $data, $lifeTime = 0); /** * Deletes a cache entry. * * @param string $id The cache id. * * @return boolean TRUE if the cache entry was successfully deleted or did not exist, FALSE otherwise. */ public function doDelete($id); /** * Flushes all cache entries from the cache. * * @return boolean */ public function doFlush(); } component-cache-2.0.6/src/Backend/000077500000000000000000000000001436177567300167235ustar00rootroot00000000000000component-cache-2.0.6/src/Backend/ArrayCache.php000066400000000000000000000021361436177567300214400ustar00rootroot00000000000000doContains($id) ? $this->data[$id] : false; } /** * {@inheritdoc} */ public function doContains($id) { // isset() is required for performance optimizations, to avoid unnecessary function calls to array_key_exists. return isset($this->data[$id]) || array_key_exists($id, $this->data); } /** * {@inheritdoc} */ public function doSave($id, $data, $lifeTime = 0) { $this->data[$id] = $data; return true; } /** * {@inheritdoc} */ public function doDelete($id) { unset($this->data[$id]); return true; } public function doFlush() { $this->data = array(); return true; } } component-cache-2.0.6/src/Backend/BaseDecorator.php000066400000000000000000000023171436177567300221540ustar00rootroot00000000000000decorated = $decorated; } public function doFetch($id) { return $this->decorated->doFetch($id); } public function doContains($id) { return $this->decorated->doContains($id); } public function doSave($id, $data, $lifeTime = 0) { return $this->decorated->doSave( $id, $data, $lifeTime); } public function doDelete($id) { return $this->decorated->doDelete($id); } public function doFlush() { return $this->decorated->doFlush(); } public function getBackend() { return $this->decorated; } }component-cache-2.0.6/src/Backend/Chained.php000066400000000000000000000043661436177567300210000ustar00rootroot00000000000000backends = array_values($backends); } public function getBackends() { return $this->backends; } public function doFetch($id) { foreach ($this->backends as $key => $backend) { $value = $backend->doFetch($id); if ($value !== false) { // EG If chain is ARRAY => REDIS => DB and we find result in DB we will update REDIS and ARRAY for ($subKey = $key - 1 ; $subKey >= 0 ; $subKey--) { $this->backends[$subKey]->doSave($id, $value, 300); // TODO we should use the actual TTL here } return $value; } } return false; } public function doContains($id) { foreach ($this->backends as $backend) { if ($backend->doContains($id)) { return true; } } return false; } public function doSave($id, $data, $lifeTime = 0) { $stored = true; foreach ($this->backends as $backend) { $stored = $backend->doSave($id, $data, $lifeTime) && $stored; } return $stored; } // returns true even when file does not exist public function doDelete($id) { foreach ($this->backends as $backend) { if ($backend->doContains($id)) { $backend->doDelete($id); } } return true; } public function doFlush() { $flushed = true; foreach ($this->backends as $backend) { $flushed = $backend->doFlush() && $flushed; } return $flushed; } } component-cache-2.0.6/src/Backend/DefaultTimeoutDecorated.php000066400000000000000000000021061436177567300242010ustar00rootroot00000000000000defaultTTL = $options['defaultTimeout']; parent::__construct($decorated); } public function doSave($id, $data, $lifeTime = 0) { return $this->decorated->doSave( $id, $data, $lifeTime ?: $this->defaultTTL); } } component-cache-2.0.6/src/Backend/Factory.php000066400000000000000000000072751436177567300210560ustar00rootroot00000000000000buildBackend($backendToBuild, $backendOptions); } return new Chained($backends); } public function buildRedisCache($options) { if (empty($options['unix_socket']) && (empty($options['host']) || empty($options['port']))) { throw new \InvalidArgumentException('RedisCache is not configured. Please provide at least a host and a port'); } $timeout = 0.0; if (array_key_exists('timeout', $options)) { $timeout = $options['timeout']; } $redis = new \Redis(); if (empty($options['unix_socket'])) { $redis->connect($options['host'], $options['port'], $timeout); } else { $redis->connect($options['unix_socket'], 0, $timeout); } if (!empty($options['password'])) { $redis->auth($options['password']); } if (array_key_exists('database', $options)) { $redis->select((int) $options['database']); } $redisCache = new Redis(); $redisCache->setRedis($redis); return $redisCache; } /** * @param string $class * @param array $options * * @return Backend * * @throws Factory\BackendNotFoundException */ public function buildDecorated( $class, $options ) { $backendToBuild = $options["backend"]; $backendOptions = array(); if (array_key_exists($backendToBuild, $options)) { $backendOptions = $options[$backendToBuild]; } $backend = $this->buildBackend($backendToBuild, $backendOptions); return new $class($backend, $options); } /** * Build a specific backend instance. * * @param string $type The type of backend you want to create. Eg 'array', 'file', 'chained', 'null', 'redis'. * @param array $options An array of options for the backend you want to create. * @return Backend * @throws Factory\BackendNotFoundException In case the given type was not found. */ public function buildBackend($type, array $options) { switch ($type) { case 'array': return $this->buildArrayCache(); case 'file': return $this->buildFileCache($options); case 'chained': return $this->buildChainedCache($options); case 'null': return $this->buildNullCache(); case 'redis': return $this->buildRedisCache($options); case 'defaultTimeout': return $this->buildDecorated(DefaultTimeoutDecorated::class, $options); case 'keyPrefix': return $this->buildDecorated(KeyPrefixDecorated::class, $options); default: throw new Factory\BackendNotFoundException("Cache backend $type not valid"); } } } component-cache-2.0.6/src/Backend/Factory/000077500000000000000000000000001436177567300203325ustar00rootroot00000000000000component-cache-2.0.6/src/Backend/Factory/BackendNotFoundException.php000066400000000000000000000004201436177567300257220ustar00rootroot00000000000000createDirectory($directory); } $this->supportsParseError = defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION >= 7 && class_exists('\ParseError'); parent::__construct($directory, $extension); } public function doFetch($id) { if (self::$invalidateOpCacheBeforeRead) { $this->invalidateCacheFile($id); } if ($this->supportsParseError) { try { return parent::doFetch($id); } catch (\ParseError $e) { return false; } } return parent::doFetch($id); } public function doContains($id) { return parent::doContains($id); } public function doSave($id, $data, $lifeTime = 0) { if (!is_dir($this->directory)) { $this->createDirectory($this->directory); } $success = parent::doSave($id, $data, $lifeTime); if ($success) { $this->invalidateCacheFile($id); } return $success; } public function doDelete($id) { $this->invalidateCacheFile($id); $success = parent::doDelete($id); $this->invalidateCacheFile($id); // in case file was cached by another request between invalidate and doDelete() return $success; } public function doFlush() { // if the directory does not exist, do not bother to continue clearing if (!is_dir($this->directory)) { return false; } foreach ($this->getFileIterator() as $name => $file) { $this->opCacheInvalidate($name); } return parent::doFlush(); } private function invalidateCacheFile($id) { $filename = $this->getFilename($id); $this->opCacheInvalidate($filename); } /** * @param string $id * * @return string */ public function getFilename($id) { $path = $this->directory . DIRECTORY_SEPARATOR; $id = preg_replace('@[\\\/:"*?<>|]+@', '', $id); return $path . $id . $this->getExtension(); } private function opCacheInvalidate($filepath) { if (is_file($filepath)) { if (function_exists('opcache_invalidate')) { @opcache_invalidate($filepath, $force = true); } if (function_exists('apc_delete_file')) { @apc_delete_file($filepath); } } } /** * @return \Iterator */ private function getFileIterator() { $pattern = '/^.+\\' . $this->getExtension() . '$/i'; $iterator = new \RecursiveDirectoryIterator($this->directory); $iterator = new \RecursiveIteratorIterator($iterator); return new \RegexIterator($iterator, $pattern); } private function createDirectory($path) { if (!is_dir($path)) { // the mode in mkdir is modified by the current umask @mkdir($path, 0750, $recursive = true); } // try to overcome restrictive umask (mis-)configuration if (!is_writable($path)) { @chmod($path, 0755); if (!is_writable($path)) { @chmod($path, 0775); // enough! we're not going to make the directory world-writeable } } } } component-cache-2.0.6/src/Backend/KeyPrefixDecorated.php000066400000000000000000000026121436177567300231560ustar00rootroot00000000000000keyPrefix = $options['keyPrefix']; parent::__construct($decorated); } public function doFetch($id) { return $this->decorated->doFetch($this->keyPrefix . $id); } public function doContains($id) { return $this->decorated->doContains($this->keyPrefix . $id); } public function doSave($id, $data, $lifeTime = 0) { return $this->decorated->doSave($this->keyPrefix . $id, $data, $lifeTime); } public function doDelete($id) { return $this->decorated->doDelete($this->keyPrefix . $id); } } component-cache-2.0.6/src/Backend/NullCache.php000066400000000000000000000012771436177567300213010ustar00rootroot00000000000000 infinite lifeTime). * * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. */ public function save($id, $data, $lifeTime = 0); /** * Deletes a cache entry. * * @param string $id The cache id. * @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise. */ public function delete($id); /** * Flushes all cache entries. * * @return boolean TRUE if the cache entries were successfully flushed, FALSE otherwise. */ public function flushAll(); } component-cache-2.0.6/src/Eager.php000066400000000000000000000072151436177567300171350ustar00rootroot00000000000000fetch('my'id') * // $cache->save('myid', 'test'); * * // ... at some point or at the end of the request * $cache->persistCacheIfNeeded($lifeTime = 43200); */ class Eager implements Cache { /** * @var Backend */ private $storage; private $storageId; private $content = array(); private $isDirty = false; /** * Loads the cache entries from the given backend using the given storageId. * * @param Backend $storage * @param $storageId */ public function __construct(Backend $storage, $storageId) { $this->storage = $storage; $this->storageId = $storageId; $content = $storage->doFetch($storageId); if (is_array($content)) { $this->content = $content; } } /** * Fetches an entry from the cache. * * Make sure to call the method {@link contains()} to verify whether there is actually any content saved under * this cache id. * * @param string $id The cache id. * @return int|float|string|boolean|array */ public function fetch($id) { return $this->content[$id]; } /** * {@inheritdoc} */ public function contains($id) { return array_key_exists($id, $this->content); } /** * Puts data into the cache. * * @param string $id The cache id. * @param int|float|string|boolean|array $content * @param int $lifeTime Setting a lifetime is not supported by this cache and the parameter will be ignored. * @return boolean */ public function save($id, $content, $lifeTime = 0) { if (is_object($content)) { throw new \InvalidArgumentException('You cannot use this cache to cache an object, only arrays, strings and numbers. Have a look at Transient cache.'); // for performance reasons we do currently not recursively search whether any array contains an object. } $this->content[$id] = $content; $this->isDirty = true; return true; } /** * {@inheritdoc} */ public function delete($id) { if ($this->contains($id)) { $this->isDirty = true; unset($this->content[$id]); return true; } return false; } /** * {@inheritdoc} */ public function flushAll() { $this->storage->doDelete($this->storageId); $this->content = array(); $this->isDirty = false; return true; } /** * Will persist all previously made changes if there were any. * * @param int $lifeTime The cache lifetime in seconds. * If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime). */ public function persistCacheIfNeeded($lifeTime) { if ($this->isDirty) { $this->storage->doSave($this->storageId, $this->content, $lifeTime); } } } component-cache-2.0.6/src/Lazy.php000066400000000000000000000063301436177567300170260ustar00rootroot00000000000000backend = $backend; } /** * Fetches an entry from the cache. * * @param string $id The cache id. * @return mixed The cached data or FALSE, if no cache entry exists for the given id. */ public function fetch($id) { $id = $this->getCompletedCacheIdIfValid($id); return $this->backend->doFetch($id); } /** * {@inheritdoc} */ public function contains($id) { $id = $this->getCompletedCacheIdIfValid($id); return $this->backend->doContains($id); } /** * Puts data into the cache. * * @param string $id The cache id. * @param mixed $data The cache entry/data. * @param int $lifeTime The cache lifetime in seconds. * If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime). * * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. */ public function save($id, $data, $lifeTime = 0) { $id = $this->getCompletedCacheIdIfValid($id); if (is_object($data)) { throw new \InvalidArgumentException('You cannot use this cache to cache an object, only arrays, strings and numbers. Have a look at Transient cache.'); // for performance reasons we do currently not recursively search whether any array contains an object. } return $this->backend->doSave($id, $data, $lifeTime); } /** * {@inheritdoc} */ public function delete($id) { $id = $this->getCompletedCacheIdIfValid($id); return $this->backend->doDelete($id); } /** * {@inheritdoc} */ public function flushAll() { return $this->backend->doFlush(); } private function getCompletedCacheIdIfValid($id) { $this->checkId($id); return 'matomocache_' . $id; } private function checkId($id) { if (empty($id)) { throw new \InvalidArgumentException('Empty cache id given'); } if (!$this->isValidId($id)) { throw new \InvalidArgumentException("Invalid cache id request $id"); } } /** * Returns true if the string is a valid id. * * Id that start with a-Z or 0-9 and contain a-Z, 0-9, underscore(_), dash(-), and dot(.) will be accepted. * Id beginning with anything but a-Z or 0-9 will be rejected (including .htaccess for example). * Id containing anything other than above mentioned will also be rejected (file names with spaces won't be accepted). * * @param string $id * @return bool */ private function isValidId($id) { return (0 !== preg_match('/(^[a-zA-Z0-9]+([a-zA-Z_0-9.-]*))$/D', $id)); } } component-cache-2.0.6/src/Transient.php000066400000000000000000000034361436177567300200620ustar00rootroot00000000000000contains($id)) { return $this->data[$id]; } return false; } /** * {@inheritdoc} */ public function contains($id) { return isset($this->data[$id]) || array_key_exists($id, $this->data); } /** * Puts data into the cache. * * @param string $id The cache id. * @param mixed $content * @param int $lifeTime Setting a lifetime is not supported by this cache and the parameter will be ignored. * @return boolean */ public function save($id, $content, $lifeTime = 0) { $this->data[$id] = $content; return true; } /** * {@inheritdoc} */ public function delete($id) { if (!$this->contains($id)) { return false; } unset($this->data[$id]); return true; } /** * {@inheritdoc} */ public function flushAll() { $this->data = array(); return true; } } component-cache-2.0.6/tests/000077500000000000000000000000001436177567300157475ustar00rootroot00000000000000component-cache-2.0.6/tests/Backend/000077500000000000000000000000001436177567300172765ustar00rootroot00000000000000component-cache-2.0.6/tests/Backend/ChainedTest.php000066400000000000000000000032141436177567300222020ustar00rootroot00000000000000 $arrayCache, 2 => $nullCache); $cache = $this->createChainedCache($backends); $result = $cache->getBackends(); $this->assertEquals(array($arrayCache, $nullCache), $result); } public function test_doFetch_shouldPopulateOtherCaches() { $cacheId = 'myid'; $cacheValue = 'mytest'; $arrayCache1 = new ArrayCache(); $arrayCache2 = new ArrayCache(); $arrayCache2->doSave($cacheId, $cacheValue); $arrayCache3 = new ArrayCache(); $cache = $this->createChainedCache(array($arrayCache1, $arrayCache2, $arrayCache3)); $this->assertEquals($cacheValue, $cache->doFetch($cacheId)); // should find the value from second cache // should populate previous cache $this->assertEquals($cacheValue, $arrayCache1->doFetch($cacheId)); // should not populate slower cache $this->assertFalse($arrayCache3->doContains('myid')); } private function createChainedCache($backends) { return new Chained($backends); } } component-cache-2.0.6/tests/Backend/DefaultTimeoutTest.php000066400000000000000000000022541436177567300236050ustar00rootroot00000000000000backendMock = $this->getMockBuilder(NullCache::class)->getMock(); $opts = ['defaultTimeout'=>$this->defaultTTl]; $this->cache = new DefaultTimeoutDecorated($this->backendMock, $opts); } public function test_doSave_shouldCallDecoratedWithDefaultTTL() { $this->backendMock ->expects($this->once()) ->method('doSave') ->with( $this->anything(), $this->anything(), $this->defaultTTl); $this->cache->doSave('randomid', 'anyvalue'); } }component-cache-2.0.6/tests/Backend/FactoryTest.php000066400000000000000000000144151436177567300222630ustar00rootroot00000000000000factory = new Factory(); } public function test_buildArrayCache_ShouldReturnInstanceOfArray() { $cache = $this->factory->buildArrayCache(); $this->assertInstanceOf(ArrayCache::class, $cache); } public function test_buildNullCache_ShouldReturnInstanceOfNull() { $cache = $this->factory->buildNullCache(); $this->assertInstanceOf(NullCache::class, $cache); } public function test_buildFileCache_ShouldReturnInstanceOfFile() { $cache = $this->factory->buildFileCache(array('directory' => __DIR__)); $this->assertInstanceOf(File::class, $cache); } public function test_buildChainedCache_ShouldReturnInstanceOfChained() { $cache = $this->factory->buildChainedCache(array('backends' => array())); $this->assertInstanceOf(Chained::class, $cache); } public function test_buildBackend_Chained_ShouldActuallyCreateInstancesOfNestedBackends() { $options = array( 'backends' => array('array', 'file'), 'file' => array('directory' => __DIR__), 'array' => array() ); /** @var Chained $cache */ $cache = $this->factory->buildBackend('chained', $options); $backends = $cache->getBackends(); $this->assertInstanceOf(ArrayCache::class, $backends[0]); $this->assertInstanceOf(File::class, $backends[1]); } public function test_buildRedisCache_ShouldReturnInstanceOfRedis() { $this->skipTestIfRedisIsNotInstalled(); $cache = $this->factory->buildRedisCache(array('host' => '127.0.0.1', 'port' => '6379', 'timeout' => 0.0)); $this->assertInstanceOf(Redis::class, $cache); } public function test_buildBackend_Redis_ShouldReturnInstanceOfRedis() { $this->skipTestIfRedisIsNotInstalled(); $options = array('host' => '127.0.0.1', 'port' => '6379', 'timeout' => 0.0); $cache = $this->factory->buildBackend('redis', $options); $this->assertInstanceOf(Redis::class, $cache); } public function test_buildBackend_Redis_ShouldForwardOptionsToRedisInstance() { $this->skipTestIfRedisIsNotInstalled(); $options = array('host' => '127.0.0.1', 'port' => '6379', 'timeout' => 4.2, 'database' => 5); /** @var Redis $cache */ $cache = $this->factory->buildBackend('redis', $options); $redis = $cache->getRedis(); $this->assertEquals('127.0.0.1', $redis->getHost()); $this->assertEquals(6379, $redis->getPort()); $this->assertEquals(4.2, $redis->getTimeout()); $this->assertEquals(5, $redis->getDBNum()); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage RedisCache is not configured */ public function test_buildRedisCache_ShouldFail_IfPortIsMissing() { $this->factory->buildRedisCache(array('host' => '127.0.0.1')); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage RedisCache is not configured */ public function test_buildRedisCache_ShouldFail_IfHostIsMissing() { $this->factory->buildRedisCache(array('port' => '6379')); } public function test_buildBackend_ArrayCache_ShouldReturnInstanceOfArray() { $cache = $this->factory->buildBackend('array', array()); $this->assertInstanceOf(ArrayCache::class, $cache); } public function test_buildBackend_NullCache_ShouldReturnInstanceOfNull() { $cache = $this->factory->buildBackend('null', array()); $this->assertInstanceOf(NullCache::class, $cache); } public function test_buildBackend_FileCache_ShouldReturnInstanceOfFile() { $cache = $this->factory->buildBackend('file', array('directory' => __DIR__)); $this->assertInstanceOf(File::class, $cache); } public function test_buildBackend_Chained_ShouldReturnInstanceOfChained() { $cache = $this->factory->buildBackend('chained', array('backends' => array())); $this->assertInstanceOf(Chained::class, $cache); } /** * @expectedException \Matomo\Cache\Backend\Factory\BackendNotFoundException */ public function test_buildBackend_ShouldThrowException_IfInvalidTypeGiven() { $this->factory->buildBackend('noTValId', array()); } private function skipTestIfRedisIsNotInstalled() { if (!extension_loaded('redis')) { $this->markTestSkipped('The test ' . __METHOD__ . ' requires the use of redis'); } } public function test_buildBackend_Chained_ShouldCreateInstancesOfNestedDecorators() {} public function test_buildBackend_Decorated_DefaultTimeoutDecorated_ShouldActuallyCreateInstanceOfNestedBackend() { $options = array( 'backend' => 'array', 'array' => array(), 'defaultTimeout' => 555 ); /** @var DefaultTimeoutDecorated $cache */ $cache = $this->factory->buildBackend('defaultTimeout', $options); $backend = $cache->getBackend(); $this->assertInstanceOf(ArrayCache::class, $backend); } public function test_buildBackend_Decorated_KeyPrefixDecorated_ShouldActuallyCreateInstanceOfNestedBackend() { $options = array( 'backend' => 'array', 'array' => array(), 'keyPrefix' => '555' ); /** @var KeyPrefixDecorated $cache */ $cache = $this->factory->buildBackend('keyPrefix', $options); $backend = $cache->getBackend(); $this->assertInstanceOf(ArrayCache::class, $backend); } } component-cache-2.0.6/tests/Backend/FileTest.php000066400000000000000000000055061436177567300215340ustar00rootroot00000000000000cache = $this->createFileCache(); $this->cache->doSave($this->cacheId, 'anyvalue', 100); } protected function tearDown() { $this->cache->flushAll(); } private function createFileCache($namespace = '') { $path = $this->getPath($namespace); return new File($path); } private function getPath($namespace = '', $id = '') { $path = __DIR__ . '/../tmp'; if (!empty($namespace)) { $path .= '/' . $namespace; } if (!empty($id)) { $path .= '/' . $id . '.php'; } return $path; } public function test_doSave_shouldCreateDirectoryWith750Permission_IfWritingIntoNewDirectory() { $namespace = 'test'; $file = $this->createFileCache($namespace); $file->doSave('myidtest', 'myvalue'); $this->assertDirectoryExists($this->getPath($namespace)); $file->flushAll(); } public function test_doSave_shouldCreateFile() { $this->cache->doSave('myidtest', 'myvalue'); $this->assertFileExists($this->getPath('', 'myidtest')); } public function test_doSave_shouldSetLifeTime() { $this->cache->doSave('myidtest', 'myvalue', 500); $path = $this->getPath('', 'myidtest'); $contents = include $path; $this->assertGreaterThan(time() + 450, $contents['lifetime']); $this->assertLessThan(time() + 550, $contents['lifetime']); } public function test_doFetch_ParseError() { $test = $this->cache->getFilename('foo'); file_put_contents($test, 'assertFalse($this->cache->doFetch('foo')); } /** * @dataProvider getTestDataForGetFilename */ public function test_getFilename_shouldConstructFilenameFromId($id, $expectedFilename) { $this->assertEquals($expectedFilename, $this->cache->getFilename($id)); } public function getTestDataForGetFilename() { $dir = realpath($this->getPath()); return [ ['genericid', $dir . '/genericid.php'], ['id with space', $dir . '/id with space.php'], ['id \/ with :"?_ spe<>cial cha|rs', $dir . '/id with _ special chars.php'], ['with % allowed & special chars', $dir . '/with % allowed & special chars.php'], ]; } } component-cache-2.0.6/tests/Backend/KeyPrefixTest.php000066400000000000000000000040221436177567300225530ustar00rootroot00000000000000backendMock = $this->getMockBuilder(NullCache::class)->getMock(); $opts = ['keyPrefix'=>$this->keyPrefix]; $this->cache = new KeyPrefixDecorated($this->backendMock, $opts); } public function test_doFetch_shouldCallDecoratedWithKeyPrefix() { $this->backendMock ->expects($this->once()) ->method('doFetch') ->with($this->stringStartsWith($this->keyPrefix)); $this->cache->doFetch('randomid'); } public function test_doContains_shouldCallDecoratedWithKeyPrefix() { $this->backendMock ->expects($this->once()) ->method('doContains') ->with($this->stringStartsWith($this->keyPrefix)); $this->cache->doContains('randomid'); } public function test_doSave_shouldCallDecoratedWithKeyPrefix() { $this->backendMock ->expects($this->once()) ->method('doSave') ->with($this->stringStartsWith($this->keyPrefix), $this->anything(), $this->anything()); $this->cache->doSave('randomid', 'anyvalue'); } public function test_doDelete_shouldCallDecoratedWithKeyPrefix() { $this->backendMock ->expects($this->once()) ->method('doDelete') ->with($this->stringStartsWith($this->keyPrefix)); $this->cache->doDelete('randomid'); } }component-cache-2.0.6/tests/Backend/NullCacheTest.php000066400000000000000000000025271436177567300225130ustar00rootroot00000000000000cache = new NullCache(); $this->cache->doSave($this->cacheId, 'anyvalue', 100); } public function test_doSave_shouldAlwaysReturnTrue() { $this->assertTrue($this->cache->doSave('randomid', 'anyvalue', 100)); } public function test_doFetch_shouldAlwaysReturnFalse_EvenIfSomethingWasSet() { $this->assertFalse($this->cache->doFetch($this->cacheId)); } public function test_doContains_shouldAlwaysReturnFalse_EvenIfSomethingWasSet() { $this->assertFalse($this->cache->doContains($this->cacheId)); } public function test_doDelete_shouldAlwaysPretendItWorked_EvenIfNoSuchKeyExists() { $this->assertTrue($this->cache->doDelete('loremipsum')); } public function test_doFlush_shouldAlwaysPretendItWorked() { $this->assertTrue($this->cache->doFlush()); } } component-cache-2.0.6/tests/BackendTest.php000066400000000000000000000137211436177567300206530ustar00rootroot00000000000000doFlush(); $success = $backend[0]->doSave($this->cacheId, $this->cacheValue); $this->assertTrue($success); } } public static function tearDownAfterClass() { foreach (self::$backends as $backend) { /** @var Backend[] $backend */ $backend[0]->doFlush(); } self::$backends = array(); } /** * @dataProvider getBackends */ public function test_doFetch_shouldReturnFalse_IfNoSuchCacheIdExists(Backend $backend) { $this->assertFalse($backend->doFetch('randomid')); } /** * @dataProvider getBackends */ public function test_doFetch_shouldReturnTheCachedValue_IfCacheIdExists(Backend $backend) { $this->assertEquals($this->cacheValue, $backend->doFetch($this->cacheId)); } /** * @dataProvider getBackends */ public function test_doContains_shouldReturnFalse_IfNoSuchCacheIdExists(Backend $backend) { $this->assertFalse($backend->doContains('randomid')); } /** * @dataProvider getBackends */ public function test_doContains_shouldReturnTrue_IfCacheIdExists(Backend $backend) { $this->assertTrue($backend->doContains($this->cacheId)); } /** * @dataProvider getBackends */ public function test_doDelete_shouldReturnTrue_OnSuccess(Backend $backend) { $this->assertTrue($backend->doDelete($this->cacheId)); } /** * @dataProvider getBackends */ public function test_doDelete_shouldActuallyDeleteCacheId(Backend $backend) { $this->assertHasCacheEntry($backend, $this->cacheId); $backend->doDelete($this->cacheId); $this->assertHasNotCacheEntry($backend, $this->cacheId); } /** * @dataProvider getBackends */ public function test_doDelete_shouldNotDeleteAnyOtherCacheIds(Backend $backend) { $backend->doSave('anyother', 'myvalue'); $this->assertHasCacheEntry($backend, $this->cacheId); $backend->doDelete($this->cacheId); $this->assertHasCacheEntry($backend, 'anyother'); } /** * @dataProvider getBackends */ public function test_doDelete_shouldNotFail_IfCacheEntryDoesNotExist(Backend $backend) { $success = $backend->doDelete('anYRandoOmId'); $this->assertTrue($success); } /** * @dataProvider getBackends */ public function test_doSave_shouldOverwriteAnyValue_IfCacheIdAlreadyExists(Backend $backend) { $this->assertHasCacheEntry($backend, $this->cacheId); $value = 'anyotherValuE'; $backend->doSave($this->cacheId, $value); $this->assertSame($value, $backend->doFetch($this->cacheId)); } /** * @dataProvider getBackends */ public function test_doSave_shouldBeAbleToSetArrays(Backend $backend) { $value = array('anyotherE' => 'anyOtherValUE', 1 => array(2)); $backend->doSave($this->cacheId, $value); $this->assertSame($value, $backend->doFetch($this->cacheId)); } /** * @dataProvider getBackends */ public function test_doSave_shouldBeAbleToSetNumbers(Backend $backend) { $value = 5.4; $backend->doSave($this->cacheId, $value); $this->assertSame($value, $backend->doFetch($this->cacheId)); } /** * @dataProvider getBackends */ public function test_doFlush_shouldRemoveAllCacheIds(Backend $backend) { $this->assertHasCacheEntry($backend, $this->cacheId); $backend->doSave('mykey', 'myvalue'); $this->assertHasCacheEntry($backend, 'mykey'); $backend->doFlush(); $this->assertHasNotCacheEntry($backend, $this->cacheId); $this->assertHasNotCacheEntry($backend, 'mykey'); } public function getBackends() { if (!empty(self::$backends)) { return self::$backends; } /** @var Backend[] $backends */ $backends = array(); $arrayCache = new ArrayCache(); $fileCache = new File($this->getPathToCacheDir()); $chainedFileCache = new File( $this->getPathToCacheDir() . '/chain' ); $chainCache = new Chained( array(new ArrayCache(), $chainedFileCache) ); $timeoutDecorated = new Backend\DefaultTimeoutDecorated( new ArrayCache(), ['defaultTimeout' => 8866] ); $prefixDecorated = new Backend\KeyPrefixDecorated( new ArrayCache(), ['keyPrefix' => 'prefix123'] ); $backends[] = $arrayCache; $backends[] = $fileCache; $backends[] = $chainCache; $backends[] = $timeoutDecorated; $backends[] = $prefixDecorated; if (extension_loaded('redis')) { $factory = new Factory(); $backends[] = $factory->buildRedisCache(array('host' => '127.0.0.1', 'port' => '6379')); } foreach ($backends as $backend) { self::$backends[] = array($backend); } return self::$backends; } private function getPathToCacheDir() { return __DIR__ . '/tmp'; } private function assertHasCacheEntry(Backend $backend, $cacheId) { $this->assertTrue($backend->doContains($cacheId)); } private function assertHasNotCacheEntry(Backend $backend, $cacheId) { $this->assertFalse($backend->doContains($cacheId)); } } component-cache-2.0.6/tests/EagerTest.php000066400000000000000000000126611436177567300203510ustar00rootroot00000000000000backend = new ArrayCache(); $this->backend->doSave($this->storageId, array($this->cacheId => $this->cacheValue)); $this->cache = new Eager($this->backend, $this->storageId); } public function test_contains_shouldReturnFalse_IfNoSuchCacheIdExists() { $this->assertFalse($this->cache->contains('randomid')); } public function test_contains_shouldReturnTrue_IfSuchCacheIdExists() { $this->assertTrue($this->cache->contains($this->cacheId)); } public function test_fetch_shouldReturnTheCachedValue_IfCacheIdExists() { $this->assertEquals($this->cacheValue, $this->cache->fetch($this->cacheId)); } public function test_save_shouldOverwriteAnyValue_IfCacheIdAlreadyExists() { $this->assertHasCacheEntry($this->cacheId); $value = 'anyotherValuE'; $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } public function test_save_shouldBeAbleToSetArrays() { $value = array('anyotherE' => 'anyOtherValUE', 1 => array(2)); $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage cannot use this cache to cache an object */ public function test_save_shouldFail_IfTryingToSetAnObject() { $value = (object) array('anyotherE' => 'anyOtherValUE', 1 => array(2)); $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } public function test_save_shouldBeAbleToSetNumbers() { $value = 5.4; $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } public function test_delete_shouldReturnTrue_OnSuccess() { $this->assertTrue($this->cache->delete($this->cacheId)); } public function test_delete_shouldReturnFalse_IfCacheIdDoesNotExist() { $this->assertFalse($this->cache->delete('IdoNotExisT')); } public function test_delete_shouldActuallyDeleteCacheId() { $this->assertHasCacheEntry($this->cacheId); $this->cache->delete($this->cacheId); $this->assertHasNotCacheEntry($this->cacheId); } public function test_delete_shouldNotDeleteAnyOtherCacheIds() { $this->cache->save('anyother', 'myvalue'); $this->assertHasCacheEntry($this->cacheId); $this->cache->delete($this->cacheId); $this->assertHasCacheEntry('anyother'); } public function test_flush_shouldRemoveAllCacheIds() { $this->assertHasCacheEntry($this->cacheId); $this->cache->save('mykey', 'myvalue'); $this->assertHasCacheEntry('mykey'); $this->assertTrue($this->backend->doContains($this->storageId)); $this->cache->flushAll(); $this->assertHasNotCacheEntry($this->cacheId); $this->assertHasNotCacheEntry('mykey'); $this->assertFalse($this->backend->doContains($this->storageId)); // should also remove the storage entry } public function test_persistCacheIfNeeded_shouldActuallySaveValuesInBackend_IfThereWasSomethingSet() { $this->cache->save('mykey', 'myvalue'); $expected = array($this->cacheId => $this->cacheValue); $this->assertEquals($expected, $this->getContentOfStorage()); $this->cache->persistCacheIfNeeded(400); $expected['mykey'] = 'myvalue'; $this->assertEquals($expected, $this->getContentOfStorage()); } public function test_persistCacheIfNeeded_shouldActuallySaveValuesInBackend_IfThereWasSomethingDelete() { $this->cache->delete($this->cacheId); $expected = array($this->cacheId => $this->cacheValue); $this->assertEquals($expected, $this->getContentOfStorage()); $this->cache->persistCacheIfNeeded(400); $this->assertEquals(array(), $this->getContentOfStorage()); } public function test_persistCacheIfNeeded_shouldNotSaveAnyValuesInBackend_IfThereWasNoChange() { $this->backend->doDelete($this->storageId); $this->assertFalse($this->getContentOfStorage()); $this->cache->persistCacheIfNeeded(400); $this->assertFalse($this->getContentOfStorage()); // should not have set the content of cache ($cacheId => $cacheValue) } private function getContentOfStorage() { return $this->backend->doFetch($this->storageId); } private function assertHasCacheEntry($cacheId) { $this->assertTrue($this->cache->contains($cacheId)); } private function assertHasNotCacheEntry($cacheId) { $this->assertFalse($this->cache->contains($cacheId)); } } component-cache-2.0.6/tests/LazyTest.php000066400000000000000000000134031436177567300202400ustar00rootroot00000000000000cache = new Lazy($backend); $this->cache->save($this->cacheId, $this->cacheValue); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Empty cache id */ public function test_fetch_shouldFail_IfCacheIdIsEmpty() { $this->cache->fetch(''); } /** * @dataProvider getInvalidCacheIds * @expectedException \InvalidArgumentException * @expectedExceptionMessage Invalid cache id */ public function test_shouldFail_IfCacheIdIsInvalid($method, $id) { $this->executeMethodOnCache($method, $id); } /** * @dataProvider getValidCacheIds */ public function test_shouldNotFail_IfCacheIdIsValid($method, $id) { $this->executeMethodOnCache($method, $id); $this->assertTrue(true); } private function executeMethodOnCache($method, $id) { if ('save' === $method) { $this->cache->$method($id, 'val'); } else { $this->cache->$method($id); } } public function test_fetch_shouldReturnFalse_IfNoSuchCacheIdExists() { $this->assertFalse($this->cache->fetch('randomid')); } public function test_fetch_shouldReturnTheCachedValue_IfCacheIdExists() { $this->assertEquals($this->cacheValue, $this->cache->fetch($this->cacheId)); } public function test_contains_shouldReturnFalse_IfNoSuchCacheIdExists() { $this->assertFalse($this->cache->contains('randomid')); } public function test_contains_shouldReturnTrue_IfCacheIdExists() { $this->assertTrue($this->cache->contains($this->cacheId)); } public function test_delete_shouldReturnTrue_OnSuccess() { $this->assertTrue($this->cache->delete($this->cacheId)); } public function test_delete_shouldActuallyDeleteCacheId() { $this->assertHasCacheEntry($this->cacheId); $this->cache->delete($this->cacheId); $this->assertHasNotCacheEntry($this->cacheId); } public function test_delete_shouldNotDeleteAnyOtherCacheIds() { $this->cache->save('anyother', 'myvalue'); $this->assertHasCacheEntry($this->cacheId); $this->cache->delete($this->cacheId); $this->assertHasCacheEntry('anyother'); } public function test_save_shouldOverwriteAnyValue_IfCacheIdAlreadyExists() { $this->assertHasCacheEntry($this->cacheId); $value = 'anyotherValuE'; $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } public function test_save_shouldBeAbleToSetArrays() { $value = array('anyotherE' => 'anyOtherValUE', 1 => array(2)); $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage cannot use this cache to cache an object */ public function test_save_shouldFail_IfTryingToSetAnObject() { $value = (object) array('anyotherE' => 'anyOtherValUE', 1 => array(2)); $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } public function test_save_shouldBeAbleToSetNumbers() { $value = 5.4; $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } public function test_flush_shouldRemoveAllCacheIds() { $this->assertHasCacheEntry($this->cacheId); $this->cache->save('mykey', 'myvalue'); $this->assertHasCacheEntry('mykey'); $this->cache->flushAll(); $this->assertHasNotCacheEntry($this->cacheId); $this->assertHasNotCacheEntry('mykey'); } private function assertHasCacheEntry($cacheId) { $this->assertTrue($this->cache->contains($cacheId)); } private function assertHasNotCacheEntry($cacheId) { $this->assertFalse($this->cache->contains($cacheId)); } public function getInvalidCacheIds() { $ids = array(); $methods = array('fetch', 'save', 'contains', 'delete'); foreach ($methods as $method) { $ids[] = array($method, 'eteer#'); $ids[] = array($method, '-test'); $ids[] = array($method, '_test'); $ids[] = array($method, '.test'); $ids[] = array($method, 'test/test'); $ids[] = array($method, '../test/'); $ids[] = array($method, 'test0*'); $ids[] = array($method, 'test\\test'); } return $ids; } public function getValidCacheIds() { $ids = array(); $methods = array('fetch', 'save', 'contains', 'delete'); foreach ($methods as $method) { $ids[] = array($method, '012test'); $ids[] = array($method, 'test012test'); $ids[] = array($method, 't.est.012test'); $ids[] = array($method, 't-est-test'); $ids[] = array($method, 't_est_tes4t'); $ids[] = array($method, 't_est.te-s2t'); $ids[] = array($method, 't_est...te-s2t'); } return $ids; } } component-cache-2.0.6/tests/TransientTest.php000066400000000000000000000067441436177567300213020ustar00rootroot00000000000000cache = new Transient(); $this->cache->save($this->cacheId, $this->cacheValue); } public function test_fetch_shouldReturnFalse_IfNoSuchCacheIdExists() { $this->assertFalse($this->cache->fetch('randomid')); } public function test_fetch_shouldReturnTheCachedValue_IfCacheIdExists() { $this->assertEquals($this->cacheValue, $this->cache->fetch($this->cacheId)); } public function test_contains_shouldReturnFalse_IfNoSuchCacheIdExists() { $this->assertFalse($this->cache->contains('randomid')); } public function test_contains_shouldReturnTrue_IfCacheIdExists() { $this->assertTrue($this->cache->contains($this->cacheId)); } public function test_delete_shouldReturnTrue_OnSuccess() { $this->assertTrue($this->cache->delete($this->cacheId)); } public function test_delete_shouldActuallyDeleteCacheId() { $this->assertHasCacheEntry($this->cacheId); $this->cache->delete($this->cacheId); $this->assertHasNotCacheEntry($this->cacheId); } public function test_delete_shouldNotDeleteAnyOtherCacheIds() { $this->cache->save('anyother', 'myvalue'); $this->assertHasCacheEntry($this->cacheId); $this->cache->delete($this->cacheId); $this->assertHasCacheEntry('anyother'); } public function test_save_shouldOverwriteAnyValue_IfCacheIdAlreadyExists() { $this->assertHasCacheEntry($this->cacheId); $value = 'anyotherValuE'; $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } public function test_save_shouldBeAbleToSetArrays() { $value = array('anyotherE' => 'anyOtherValUE', 1 => array(2)); $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } public function test_save_shouldBeAbleToSetObjects() { $value = (object) array('anyotherE' => 'anyOtherValUE', 1 => array(2)); $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } public function test_save_shouldBeAbleToSetNumbers() { $value = 5.4; $this->cache->save($this->cacheId, $value); $this->assertSame($value, $this->cache->fetch($this->cacheId)); } public function test_flush_shouldRemoveAllCacheIds() { $this->assertHasCacheEntry($this->cacheId); $this->cache->save('mykey', 'myvalue'); $this->assertHasCacheEntry('mykey'); $this->cache->flushAll(); $this->assertHasNotCacheEntry($this->cacheId); $this->assertHasNotCacheEntry('mykey'); } private function assertHasCacheEntry($cacheId) { $this->assertTrue($this->cache->contains($cacheId)); } private function assertHasNotCacheEntry($cacheId) { $this->assertFalse($this->cache->contains($cacheId)); } } component-cache-2.0.6/tests/tmp/000077500000000000000000000000001436177567300165475ustar00rootroot00000000000000component-cache-2.0.6/tests/tmp/.gitkeep000077500000000000000000000000001436177567300201710ustar00rootroot00000000000000component-cache-2.0.6/tests/travis/000077500000000000000000000000001436177567300172575ustar00rootroot00000000000000component-cache-2.0.6/tests/travis/php.ini000066400000000000000000000000241436177567300205430ustar00rootroot00000000000000extension="redis.so"