diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 82b42f3..68ca9dc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,6 +5,17 @@ on: [push, pull_request] jobs: run-tests: name: PHP ${{ matrix.php-versions }} + + services: + redis: + image: redis:5-alpine + ports: + - 6379 + memcached: + image: memcached:1.5-alpine + ports: + - 11211 + runs-on: ubuntu-latest env: extensions: mbstring, intl, json, phalcon4, redis, mongodb, xdebug @@ -53,8 +64,15 @@ jobs: run: composer install --prefer-dist --no-suggest - name: Run test suites + env: + DATA_REDIS_HOST: '127.0.0.1' + DATA_REDIS_PORT: ${{ job.services.redis.ports['6379'] }} + DATA_MEMCACHED_HOST: '127.0.0.1' + DATA_MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }} if: success() - run: vendor/bin/codecept run --coverage-xml=coverage-${{ matrix.php-versions }}.xml + run: | + cp tests/.env.example tests/.env + vendor/bin/codecept run --coverage-xml=coverage-${{ matrix.php-versions }}.xml - name: Upload coverage to Codecov if: success() diff --git a/.gitignore b/.gitignore index a67d42b..2a25e3e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ composer.phar /vendor/ +.env # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file diff --git a/README.md b/README.md index b71706d..7c3e19a 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ Usage examples of the adapters available here: ## Memcached Stores the parsed annotations to Memcached. -This adapter uses a `Phalcon\Cache\Backend\Libmemcached` backend to store the cached content: +This adapter uses a `Phalcon\Cache\Adapter\Libmemcached` backend to store the cached content: ```php -use Phalcon\Annotations\Adapter\Memcached; +use Phalcon\Incubator\Annotations\Adapter\Memcached; $di->set( 'annotations', @@ -29,10 +29,10 @@ $di->set( ## Redis Stores the parsed annotations to Redis. -This adapter uses a `Phalcon\Cache\Backend\Redis` backend to store the cached content: +This adapter uses a `Phalcon\Cache\Adapter\Redis` backend to store the cached content: ```php -use Phalcon\Annotations\Adapter\Redis; +use Phalcon\Incubator\Annotations\Adapter\Redis; $di->set( 'annotations', @@ -48,4 +48,3 @@ $di->set( } ); ``` - diff --git a/codeception.yml b/codeception.yml index ad4391f..b6d4296 100644 --- a/codeception.yml +++ b/codeception.yml @@ -17,4 +17,4 @@ coverage: params: # get params from environment vars - - env + - tests/.env diff --git a/composer.json b/composer.json index 1b225b6..2f8514c 100644 --- a/composer.json +++ b/composer.json @@ -36,8 +36,7 @@ "codeception/codeception": "^4.1", "codeception/module-asserts": "^1.0.0", "phpstan/phpstan": "^0.12.18", - "vlucas/phpdotenv": "^2.5", - "ocramius/package-versions": "1.4.0", + "vlucas/phpdotenv": "^4.1", "phpunit/php-token-stream": "3.1.2", "webmozart/glob": "4.1.0" }, diff --git a/composer.lock b/composer.lock index 38f0082..686caa7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5952b57cf821b4518998b44c7845112f", + "content-hash": "6a6425921c0e102dffc1c117f06ff8eb", "packages": [], "packages-dev": [ { @@ -521,24 +521,24 @@ }, { "name": "composer/package-versions-deprecated", - "version": "1.8.0", + "version": "1.11.99.1", "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "98df7f1b293c0550bd5b1ce6b60b59bdda23aa47" + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/98df7f1b293c0550bd5b1ce6b60b59bdda23aa47", - "reference": "98df7f1b293c0550bd5b1ce6b60b59bdda23aa47", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/7413f0b55a051e89485c5cb9f765fe24bb02a7b6", + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6", "shasum": "" }, "require": { "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7" + "php": "^7 || ^8" }, "replace": { - "ocramius/package-versions": "1.2 - 1.8.99" + "ocramius/package-versions": "1.11.99" }, "require-dev": { "composer/composer": "^1.9.3 || ^2.0@dev", @@ -573,19 +573,24 @@ ], "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "support": { - "source": "https://github.com/composer/package-versions-deprecated/tree/1.8.0" + "issues": "https://github.com/composer/package-versions-deprecated/issues", + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.1" }, "funding": [ { "url": "https://packagist.com", "type": "custom" }, + { + "url": "https://github.com/composer", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/composer/composer", "type": "tidelift" } ], - "time": "2020-04-23T11:49:37+00:00" + "time": "2020-11-11T10:22:58+00:00" }, { "name": "composer/semver", @@ -670,16 +675,16 @@ }, { "name": "composer/xdebug-handler", - "version": "1.4.5", + "version": "1.4.6", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "f28d44c286812c714741478d968104c5e604a1d4" + "reference": "f27e06cd9675801df441b3656569b328e04aa37c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f28d44c286812c714741478d968104c5e604a1d4", - "reference": "f28d44c286812c714741478d968104c5e604a1d4", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f27e06cd9675801df441b3656569b328e04aa37c", + "reference": "f27e06cd9675801df441b3656569b328e04aa37c", "shasum": "" }, "require": { @@ -687,7 +692,8 @@ "psr/log": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + "phpstan/phpstan": "^0.12.55", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "autoload": { @@ -713,7 +719,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/1.4.5" + "source": "https://github.com/composer/xdebug-handler/tree/1.4.6" }, "funding": [ { @@ -729,7 +735,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T08:04:11+00:00" + "time": "2021-03-25T17:01:18+00:00" }, { "name": "dnoegel/php-xdg-base-dir", @@ -1073,16 +1079,16 @@ }, { "name": "netresearch/jsonmapper", - "version": "v1.6.0", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "0d4d1b48d682a93b6bfedf60b88c7750e9cb0b06" + "reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/0d4d1b48d682a93b6bfedf60b88c7750e9cb0b06", - "reference": "0d4d1b48d682a93b6bfedf60b88c7750e9cb0b06", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/e0f1e33a71587aca81be5cffbb9746510e1fe04e", + "reference": "e0f1e33a71587aca81be5cffbb9746510e1fe04e", "shasum": "" }, "require": { @@ -1093,8 +1099,8 @@ "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4", - "squizlabs/php_codesniffer": "~1.5" + "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4 || ~7.0", + "squizlabs/php_codesniffer": "~3.5" }, "type": "library", "autoload": { @@ -1120,7 +1126,7 @@ "issues": "https://github.com/cweiske/jsonmapper/issues", "source": "https://github.com/cweiske/jsonmapper/tree/master" }, - "time": "2019-08-15T19:41:25+00:00" + "time": "2020-04-16T18:48:43+00:00" }, { "name": "nikic/php-parser", @@ -1464,28 +1470,27 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.1.0", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { - "ext-filter": "^7.1", - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0", - "phpdocumentor/type-resolver": "^1.0", - "webmozart/assert": "^1" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "doctrine/instantiator": "^1", - "mockery/mockery": "^1" + "mockery/mockery": "~1.3.2" }, "type": "library", "extra": { @@ -1515,9 +1520,9 @@ "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/5.1.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" }, - "time": "2020-02-22T12:28:44+00:00" + "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -1568,30 +1573,99 @@ }, "time": "2020-09-17T18:55:26+00:00" }, + { + "name": "phpoption/phpoption", + "version": "1.7.5", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/994ecccd8f3283ecf5ac33254543eb0ac946d525", + "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525", + "shasum": "" + }, + "require": { + "php": "^5.5.9 || ^7.0 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.7.5" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2020-07-20T17:29:33+00:00" + }, { "name": "phpspec/prophecy", - "version": "1.11.1", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160" + "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b20034be5efcdab4fb60ca3a29cba2949aead160", - "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", + "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2", - "phpdocumentor/reflection-docblock": "^5.0", + "php": "^7.2 || ~8.0, <8.1", + "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { @@ -1631,9 +1705,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/master" + "source": "https://github.com/phpspec/prophecy/tree/1.13.0" }, - "time": "2020-07-08T12:44:21+00:00" + "time": "2021-03-17T13:42:18+00:00" }, { "name": "phpstan/phpstan", @@ -2137,6 +2211,56 @@ }, "time": "2021-03-05T17:36:06+00:00" }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -3071,42 +3195,44 @@ }, { "name": "symfony/console", - "version": "v4.4.20", + "version": "v5.2.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c98349bda966c70d6c08b4cd8658377c94166492" + "reference": "938ebbadae1b0a9c9d1ec313f87f9708609f1b79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c98349bda966c70d6c08b4cd8658377c94166492", - "reference": "c98349bda966c70d6c08b4cd8658377c94166492", + "url": "https://api.github.com/repos/symfony/console/zipball/938ebbadae1b0a9c9d1ec313f87f9708609f1b79", + "reference": "938ebbadae1b0a9c9d1ec313f87f9708609f1b79", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php73": "^1.8", "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2" + "symfony/service-contracts": "^1.1|^2", + "symfony/string": "^5.1" }, "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3|>=5", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", "symfony/lock": "<4.4", - "symfony/process": "<3.3" + "symfony/process": "<4.4" }, "provide": { "psr/log-implementation": "1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/event-dispatcher": "^4.3", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", "symfony/lock": "^4.4|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/var-dumper": "^4.3|^5.0" + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" }, "suggest": { "psr/log": "For using the console logger", @@ -3139,8 +3265,14 @@ ], "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], "support": { - "source": "https://github.com/symfony/console/tree/v4.4.20" + "source": "https://github.com/symfony/console/tree/v5.2.5" }, "funding": [ { @@ -3156,7 +3288,7 @@ "type": "tidelift" } ], - "time": "2021-02-22T18:44:15+00:00" + "time": "2021-03-06T13:42:15+00:00" }, { "name": "symfony/css-selector", @@ -3292,38 +3424,40 @@ }, { "name": "symfony/event-dispatcher", - "version": "v4.4.20", + "version": "v5.2.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "c352647244bd376bf7d31efbd5401f13f50dad0c" + "reference": "d08d6ec121a425897951900ab692b612a61d6240" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c352647244bd376bf7d31efbd5401f13f50dad0c", - "reference": "c352647244bd376bf7d31efbd5401f13f50dad0c", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d08d6ec121a425897951900ab692b612a61d6240", + "reference": "d08d6ec121a425897951900ab692b612a61d6240", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/event-dispatcher-contracts": "^1.1" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/event-dispatcher-contracts": "^2", + "symfony/polyfill-php80": "^1.15" }, "conflict": { - "symfony/dependency-injection": "<3.4" + "symfony/dependency-injection": "<4.4" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" + "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/error-handler": "~3.4|~4.4", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/error-handler": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^3.4|^4.0|^5.0" + "symfony/stopwatch": "^4.4|^5.0" }, "suggest": { "symfony/dependency-injection": "", @@ -3355,7 +3489,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.20" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.2.4" }, "funding": [ { @@ -3371,33 +3505,33 @@ "type": "tidelift" } ], - "time": "2021-01-27T09:09:26+00:00" + "time": "2021-02-18T17:12:37+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.9", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7" + "reference": "0ba7d54483095a198fa51781bc608d17e84dffa2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/84e23fdcd2517bf37aecbd16967e83f0caee25a7", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ba7d54483095a198fa51781bc608d17e84dffa2", + "reference": "0ba7d54483095a198fa51781bc608d17e84dffa2", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=7.2.5", + "psr/event-dispatcher": "^1" }, "suggest": { - "psr/event-dispatcher": "", "symfony/event-dispatcher-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.2-dev" }, "thanks": { "name": "symfony/contracts", @@ -3434,7 +3568,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.9" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.2.0" }, "funding": [ { @@ -3450,7 +3584,7 @@ "type": "tidelift" } ], - "time": "2020-07-06T13:19:58+00:00" + "time": "2020-09-07T11:33:47+00:00" }, { "name": "symfony/finder", @@ -3592,6 +3726,171 @@ ], "time": "2021-01-07T16:49:33+00:00" }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.22.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5601e09b69f26c1828b13b6bb87cb07cddba3170", + "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.22-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.1" + }, + "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": "2021-01-22T09:19:47+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.22.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/43a0283138253ed1d48d352ab6d0bdb3f809f248", + "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.22-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.1" + }, + "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": "2021-01-22T09:19:47+00:00" + }, { "name": "symfony/polyfill-mbstring", "version": "v1.22.1", @@ -3913,6 +4212,89 @@ ], "time": "2020-09-07T11:33:47+00:00" }, + { + "name": "symfony/string", + "version": "v5.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "4e78d7d47061fa183639927ec40d607973699609" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/4e78d7d47061fa183639927ec40d607973699609", + "reference": "4e78d7d47061fa183639927ec40d607973699609", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0", + "symfony/http-client": "^4.4|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "files": [ + "Resources/functions.php" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.2.4" + }, + "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": "2021-02-16T10:20:28+00:00" + }, { "name": "symfony/yaml", "version": "v5.2.5", @@ -4144,23 +4526,25 @@ }, { "name": "vlucas/phpdotenv", - "version": "v2.6.7", + "version": "v4.2.0", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "b786088918a884258c9e3e27405c6a4cf2ee246e" + "reference": "da64796370fc4eb03cc277088f6fede9fde88482" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/b786088918a884258c9e3e27405c6a4cf2ee246e", - "reference": "b786088918a884258c9e3e27405c6a4cf2ee246e", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/da64796370fc4eb03cc277088f6fede9fde88482", + "reference": "da64796370fc4eb03cc277088f6fede9fde88482", "shasum": "" }, "require": { - "php": "^5.3.9 || ^7.0 || ^8.0", + "php": "^5.5.9 || ^7.0 || ^8.0", + "phpoption/phpoption": "^1.7.3", "symfony/polyfill-ctype": "^1.17" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", "ext-filter": "*", "ext-pcre": "*", "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20" @@ -4172,7 +4556,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -4204,7 +4588,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v2.6.7" + "source": "https://github.com/vlucas/phpdotenv/tree/v4.2.0" }, "funding": [ { @@ -4216,28 +4600,29 @@ "type": "tidelift" } ], - "time": "2021-01-20T14:39:13+00:00" + "time": "2021-01-20T15:11:48+00:00" }, { "name": "webmozart/assert", - "version": "1.7.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "vimeo/psalm": "<3.6.0" + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^7.5.13" @@ -4266,9 +4651,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.7.0" + "source": "https://github.com/webmozarts/assert/tree/1.9.1" }, - "time": "2020-02-14T12:15:55+00:00" + "time": "2020-07-08T17:02:28+00:00" }, { "name": "webmozart/glob", diff --git a/psalm.xml.dist b/psalm.xml.dist index cef0546..182c996 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -1,23 +1,23 @@ - + - - + + - + - - - + + + diff --git a/src/Adapter/Cache.php b/src/Adapter/AbstractCache.php similarity index 72% rename from src/Adapter/Cache.php rename to src/Adapter/AbstractCache.php index 24cb400..ae2e86f 100644 --- a/src/Adapter/Cache.php +++ b/src/Adapter/AbstractCache.php @@ -14,7 +14,6 @@ namespace Phalcon\Incubator\Annotations\Adapter; use Phalcon\Annotations\Adapter\AbstractAdapter; -use Phalcon\Annotations\Exception; use Phalcon\Annotations\Reflection; use Phalcon\Cache\Adapter\AdapterInterface; use Phalcon\Helper\Arr; @@ -24,7 +23,7 @@ * This adapter is suitable for production. * */ -class Cache extends AbstractAdapter +abstract class AbstractCache extends AbstractAdapter { /** * @var AdapterInterface @@ -37,21 +36,12 @@ class Cache extends AbstractAdapter protected $lifetime = 8600; /** - * {@inheritdoc} - * + * @param AdapterInterface $cache * @param array $options options array - * - * @throws Exception */ - public function __construct(array $options) + public function __construct(AdapterInterface $cache, array $options = []) { - if (!Arr::has($options, 'cache') || !Arr::get($options, 'cache') instanceof AdapterInterface) { - throw new Exception( - 'Parameter "cache" is required and it must be an instance of Phalcon\Cache\Adapter\AdapterInterface' - ); - } - - $this->cache = Arr::get($options, 'cache'); + $this->cache = $cache; if (Arr::has($options, 'lifetime')) { $this->lifetime = Arr::get($options, 'lifetime'); diff --git a/src/Adapter/Memcached.php b/src/Adapter/Memcached.php index 0e37aff..baac28a 100644 --- a/src/Adapter/Memcached.php +++ b/src/Adapter/Memcached.php @@ -13,8 +13,8 @@ namespace Phalcon\Incubator\Annotations\Adapter; -use Phalcon\Cache\Adapter\Libmemcached; use Phalcon\Annotations\Exception; +use Phalcon\Cache\Adapter\Libmemcached; use Phalcon\Helper\Arr; use Phalcon\Storage\SerializerFactory; @@ -34,11 +34,9 @@ * ]); * */ -class Memcached extends Cache +class Memcached extends AbstractCache { /** - * {@inheritdoc} - * * @param array $options options array * * @throws Exception @@ -49,14 +47,14 @@ public function __construct(array $options) throw new Exception('No host given in options'); } - $options['cache'] = new Libmemcached( + $cache = new Libmemcached( new SerializerFactory(), [ 'defaultSerializer' => 'php', 'lifetime' => Arr::get($options, 'lifetime', 8600), 'servers' => [ [ - 'host' => Arr::get($options, 'host'), + 'host' => Arr::get($options, 'host', '127.0.0.1'), 'port' => Arr::get($options, 'port', 11211), 'weight' => Arr::get($options, 'weight', 1), ], @@ -65,6 +63,6 @@ public function __construct(array $options) ] ); - parent::__construct($options); + parent::__construct($cache, $options); } } diff --git a/src/Adapter/Redis.php b/src/Adapter/Redis.php index 371616b..9146689 100644 --- a/src/Adapter/Redis.php +++ b/src/Adapter/Redis.php @@ -14,8 +14,8 @@ namespace Phalcon\Incubator\Annotations\Adapter; use Phalcon\Cache\Adapter\Redis as CacheRedis; -use Phalcon\Storage\SerializerFactory; use Phalcon\Helper\Arr; +use Phalcon\Storage\SerializerFactory; /** * Stores the parsed annotations to the Redis database. @@ -32,14 +32,14 @@ * ]); * */ -class Redis extends Cache +class Redis extends AbstractCache { /** * @param array $options Options array */ public function __construct(array $options = []) { - $options['cache'] = new CacheRedis( + $cache = new CacheRedis( new SerializerFactory(), [ 'defaultSerializer' => 'php', @@ -50,6 +50,6 @@ public function __construct(array $options = []) ] ); - parent::__construct($options); + parent::__construct($cache, $options); } } diff --git a/tests/.env.default b/tests/.env.default deleted file mode 100644 index 25ab102..0000000 --- a/tests/.env.default +++ /dev/null @@ -1,5 +0,0 @@ -# General -PATH_DATA="${PROJECT_PATH}tests/_data/" -PATH_CACHE="${PROJECT_PATH}tests/_cache/" -PATH_OUTPUT="${PROJECT_PATH}tests/_output/" -PATH_FIXTURES="${PROJECT_PATH}tests/_data/fixtures/" diff --git a/tests/.env.example b/tests/.env.example new file mode 100644 index 0000000..69a4d2f --- /dev/null +++ b/tests/.env.example @@ -0,0 +1,5 @@ +DATA_REDIS_HOST=phalcon-redis +DATA_REDIS_PORT=6379 + +DATA_MEMCACHED_HOST=phalcon-memcached +DATA_MEMCACHED_PORT=11211 diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php index eabcef9..73ad629 100644 --- a/tests/_bootstrap.php +++ b/tests/_bootstrap.php @@ -1,47 +1,7 @@ load(); diff --git a/tests/functional/Adapter/Memcached/ReadWriteCest.php b/tests/functional/Adapter/Memcached/ReadWriteCest.php new file mode 100644 index 0000000..0140749 --- /dev/null +++ b/tests/functional/Adapter/Memcached/ReadWriteCest.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Phalcon\Incubator\Annotations\Tests\Functional\Adapter\Memcached; + +use FunctionalTester; +use Phalcon\Annotations\Exception; +use Phalcon\Incubator\Annotations\Adapter\Memcached; +use TestClass; + +final class ReadWriteCest +{ + /** + * Tests Phalcon\Incubator\Annotations\Adapter\Cache :: read() / write() + * + * @param FunctionalTester $I + * @throws Exception + */ + public function annotationsAdapterMemcachedReadAndWrite(FunctionalTester $I) + { + $I->wantToTest('Annotations\Adapter\Cache - read() / write()'); + + require_once codecept_data_dir('fixtures/Annotations/TestClass.php'); + + $adapter = new Memcached([ + 'host' => getenv('DATA_MEMCACHED_HOST'), + 'port' => getenv('DATA_MEMCACHED_PORT'), + ]); + $reflection = $adapter->get(TestClass::class); + + $I->assertTrue($adapter->write("test", $reflection)); + $I->assertEquals($reflection, $adapter->read("test")); + } +} diff --git a/tests/functional/Adapter/Redis/ReadWriteCest.php b/tests/functional/Adapter/Redis/ReadWriteCest.php new file mode 100644 index 0000000..45dfcc8 --- /dev/null +++ b/tests/functional/Adapter/Redis/ReadWriteCest.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Phalcon\Incubator\Annotations\Tests\Functional\Adapter\Redis; + +use FunctionalTester; +use Phalcon\Annotations\Exception; +use Phalcon\Incubator\Annotations\Adapter\Redis; +use TestClass; + +final class ReadWriteCest +{ + /** + * Tests Phalcon\Incubator\Annotations\Adapter\Cache :: read() / write() + * + * @param FunctionalTester $I + * @throws Exception + */ + public function annotationsAdapterMemcachedReadAndWrite(FunctionalTester $I) + { + $I->wantToTest('Annotations\Adapter\Cache - read() / write()'); + + require_once codecept_data_dir('fixtures/Annotations/TestClass.php'); + + $adapter = new Redis([ + 'host' => getenv('DATA_REDIS_HOST'), + 'port' => getenv('DATA_REDIS_PORT'), + ]); + $reflection = $adapter->get(TestClass::class); + + $I->assertTrue($adapter->write("test", $reflection)); + $I->assertEquals($reflection, $adapter->read("test")); + } +} diff --git a/tests/functional/_bootstrap.php b/tests/functional/_bootstrap.php deleted file mode 100644 index 3c793a3..0000000 --- a/tests/functional/_bootstrap.php +++ /dev/null @@ -1,10 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ diff --git a/tests/shim.php b/tests/shim.php deleted file mode 100644 index d3063c2..0000000 --- a/tests/shim.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -use Dotenv\Dotenv; - -if (!function_exists('env')) { - function env(string $key, $default = null) - { - if (defined($key)) { - return constant($key); - } - - return getenv($key) ?: $default; - } -} - -/** - * Calls .env and merges the global and local configurations - */ -if (!function_exists('loadEnvironment')) { - function loadEnvironment(string $root) - { - /** - * Load local environment if it exists - */ - (new Dotenv(realpath(__DIR__), ".env.default"))->load(); - - defineFromEnv('PATH_CACHE'); - defineFromEnv('PATH_DATA'); - defineFromEnv('PATH_OUTPUT'); - defineFromEnv('DATA_SQLITE_CACHE_NAME'); - } -} - -if (!function_exists('defineFromEnv')) { - function defineFromEnv(string $name) - { - if (defined($name)) { - return; - } - - define( - $name, - env($name) - ); - } -} - -/** - * Ensures that certain folders are always ready for us. - */ -if (!function_exists('loadFolders')) { - function loadFolders() - { - $folders = [ - 'annotations', - 'assets', - 'cache', - 'cache/models', - 'logs', - 'session', - 'stream', - ]; - - foreach ($folders as $folder) { - $item = outputDir('tests/' . $folder); - - if (true !== file_exists($item)) { - mkdir($item, 0777, true); - } - } - } -} - -/** - * Returns the cache folder - */ -if (!function_exists('cacheDir')) { - function cacheDir(string $fileName = ''): string - { - return codecept_output_dir() . 'tests/cache/' . $fileName; - } -} - -/** - * Returns the output folder - */ -if (!function_exists('dataDir')) { - function dataDir(string $fileName = ''): string - { - return codecept_data_dir() . $fileName; - } -} - -/** - * Returns the output folder - */ -if (!function_exists('logsDir')) { - function logsDir(string $fileName = ''): string - { - return codecept_output_dir() . 'tests/logs/' . $fileName; - } -} - -/** - * Returns the output folder - */ -if (!function_exists('outputDir')) { - function outputDir(string $fileName = ''): string - { - return codecept_output_dir() . $fileName; - } -} diff --git a/tests/unit/Adapter/Cache/ConstructCest.php b/tests/unit/Adapter/Cache/ConstructCest.php deleted file mode 100644 index 786a4be..0000000 --- a/tests/unit/Adapter/Cache/ConstructCest.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Phalcon\Incubator\Annotations\Tests\Unit\Adapter\Cache; - -use Phalcon\Annotations\Adapter\AdapterInterface; -use Phalcon\Annotations\Exception; -use Phalcon\Cache\Adapter\Memory; -use Phalcon\Incubator\Annotations\Adapter\Cache; -use Phalcon\Storage\SerializerFactory; -use UnitTester; - -class ConstructCest -{ - /** - * Tests Phalcon\Incubator\Annotations\Adapter\Cache :: __construct() - * - */ - public function annotationsAdapterMemcachedConstruct(UnitTester $I) - { - $I->wantToTest('Annotations\Adapter\Cache - __construct()'); - - $adapter = new Cache([ - 'cache' => new Memory(new SerializerFactory(), []) - ]); - - $class = AdapterInterface::class; - $I->assertInstanceOf( - $class, - $adapter - ); - } - /** - * Tests Phalcon\Incubator\Annotations\Adapter\Cache :: __construct() - * - */ - public function annotationsAdapterMemcachedConstructWithoutCache(UnitTester $I) - { - $I->wantToTest('Annotations\Adapter\Cache - __construct() without cache'); - - - - $I->expectThrowable( - Exception::class, - function () { - $adapter = new Cache([]); - } - ); - } -} diff --git a/tests/unit/Adapter/Cache/ReadCest.php b/tests/unit/Adapter/Cache/ReadCest.php deleted file mode 100644 index e9174a5..0000000 --- a/tests/unit/Adapter/Cache/ReadCest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Phalcon\Incubator\Annotations\Tests\Unit\Adapter\Cache; - -use Phalcon\Cache\Adapter\Memory; -use Phalcon\Incubator\Annotations\Adapter\Cache; -use Phalcon\Storage\SerializerFactory; -use TestClass; -use UnitTester; - -class ReadCest -{ - /** - * Tests Phalcon\Incubator\Annotations\Adapter\Cache :: read() - * - */ - public function annotationsAdapterMemcachedRead(UnitTester $I) - { - $I->wantToTest('Annotations\Adapter\Cache - read()'); - - require_once dataDir('fixtures/Annotations/TestClass.php'); - - $cache = new Memory(new SerializerFactory(), []); - - $adapter = new Cache([ - 'cache' => $cache - ]); - - $reflection = $adapter->get(TestClass::class); - - $I->assertTrue($cache->set("test", $reflection)); - - $I->assertEquals( - $reflection, - $adapter->read("test") - ); - } -} diff --git a/tests/unit/Adapter/Cache/WriteCest.php b/tests/unit/Adapter/Cache/WriteCest.php deleted file mode 100644 index bbed30e..0000000 --- a/tests/unit/Adapter/Cache/WriteCest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace Phalcon\Incubator\Annotations\Tests\Unit\Adapter\Cache; - -use Phalcon\Cache\Adapter\Memory; -use Phalcon\Incubator\Annotations\Adapter\Cache; -use Phalcon\Storage\SerializerFactory; -use TestClass; -use UnitTester; - -class WriteCest -{ - /** - * Tests Phalcon\Incubator\Annotations\Adapter\Cache :: write() - * - */ - public function annotationsAdapterMemcachedRead(UnitTester $I) - { - $I->wantToTest('Annotations\Adapter\Cache - write()'); - - require_once dataDir('fixtures/Annotations/TestClass.php'); - - $cache = new Memory(new SerializerFactory(), []); - - $adapter = new Cache([ - 'cache' => $cache - ]); - - $reflection = $adapter->get(TestClass::class); - - $I->assertTrue($adapter->write("test", $reflection)); - - $I->assertEquals( - $reflection, - $cache->get("test") - ); - } -} diff --git a/tests/unit/Adapter/Memcached/ConstructCest.php b/tests/unit/Adapter/Memcached/ConstructCest.php index c3553d1..cf85119 100644 --- a/tests/unit/Adapter/Memcached/ConstructCest.php +++ b/tests/unit/Adapter/Memcached/ConstructCest.php @@ -18,7 +18,7 @@ use Phalcon\Incubator\Annotations\Adapter\Memcached; use UnitTester; -class ConstructCest +final class ConstructCest { /** * Tests Phalcon\Incubator\Annotations\Adapter\Memcached :: __construct() @@ -37,16 +37,13 @@ public function annotationsAdapterMemcachedConstruct(UnitTester $I) 'host' => '127.0.0.1', ]); - $class = AdapterInterface::class; - $I->assertInstanceOf( - $class, - $adapter - ); + $I->assertInstanceOf(AdapterInterface::class, $adapter); } /** * Tests Phalcon\Incubator\Annotations\Adapter\Memcached :: __construct() * + * @param UnitTester $I */ public function annotationsAdapterMemcachedConstructWithoutHost(UnitTester $I) { diff --git a/tests/unit/Adapter/Redis/ConstructCest.php b/tests/unit/Adapter/Redis/ConstructCest.php index c3ca689..8db02cf 100644 --- a/tests/unit/Adapter/Redis/ConstructCest.php +++ b/tests/unit/Adapter/Redis/ConstructCest.php @@ -17,11 +17,12 @@ use Phalcon\Incubator\Annotations\Adapter\Redis; use UnitTester; -class ConstructCest +final class ConstructCest { /** * Tests Phalcon\Incubator\Annotations\Adapter\Redis :: __construct() * + * @param UnitTester $I */ public function annotationsAdapterMemcachedConstruct(UnitTester $I) { @@ -29,10 +30,6 @@ public function annotationsAdapterMemcachedConstruct(UnitTester $I) $adapter = new Redis([]); - $class = AdapterInterface::class; - $I->assertInstanceOf( - $class, - $adapter - ); + $I->assertInstanceOf(AdapterInterface::class, $adapter); } } diff --git a/tests/unit/_bootstrap.php b/tests/unit/_bootstrap.php deleted file mode 100644 index 3c793a3..0000000 --- a/tests/unit/_bootstrap.php +++ /dev/null @@ -1,10 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */