diff --git a/composer.json b/composer.json index 6d30ba9..22729c0 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,14 @@ "autoload-dev": { "psr-4": { "Tests\\BBC\\BrandingClient\\": "tests/" } }, + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:bbc/programmes-caching-library.git" + } + ], "require": { + "bbc/programmes-caching-library": "^1.1.5", "php": ">=7.1.0", "guzzlehttp/guzzle": "^6.0", "mustache/mustache": "~2.5", @@ -17,8 +24,8 @@ }, "require-dev": { "phpstan/phpstan": "^0.8.0", - "phpunit/phpunit": "^6.1", - "squizlabs/php_codesniffer": "^2.9", + "phpunit/phpunit": "^8.4.3", + "squizlabs/php_codesniffer": "^3.5.2", "symfony/cache": "^3.2" }, "config": { diff --git a/composer.lock b/composer.lock index 865090e..c858161 100644 --- a/composer.lock +++ b/composer.lock @@ -1,11 +1,48 @@ { "_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#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4177d5bd3413feb62524ee2e65c06bdc", + "content-hash": "652143396ecff5e2b7449b7d0008f215", "packages": [ + { + "name": "bbc/programmes-caching-library", + "version": "v1.1.5", + "source": { + "type": "git", + "url": "https://github.com/bbc/programmes-caching-library.git", + "reference": "ff1497cbc5e0edf9eb5ab443138fbeae67bc02af" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bbc/programmes-caching-library/zipball/ff1497cbc5e0edf9eb5ab443138fbeae67bc02af", + "reference": "ff1497cbc5e0edf9eb5ab443138fbeae67bc02af", + "shasum": "" + }, + "require": { + "php": ">=7.1.0", + "psr/cache": "^1.0", + "symfony/cache": ">=2.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "BBC\\ProgrammesCachingLibrary\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\BBC\\ProgrammesCachingLibrary\\": "tests/" + } + }, + "description": "Caching for /programmes projects", + "support": { + "source": "https://github.com/bbc/programmes-caching-library/tree/v1.1.5", + "issues": "https://github.com/bbc/programmes-caching-library/issues" + }, + "time": "2019-11-05T11:33:33+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "6.2.3", @@ -325,37 +362,153 @@ "response" ], "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "symfony/cache", + "version": "v3.2.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/cache.git", + "reference": "ce81ce67baa387c556d03f389fb3c9efc11286aa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/cache/zipball/ce81ce67baa387c556d03f389fb3c9efc11286aa", + "reference": "ce81ce67baa387c556d03f389fb3c9efc11286aa", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/cache": "~1.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/cache-implementation": "1.0" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/cache": "~1.6", + "doctrine/dbal": "~2.4", + "predis/predis": "~1.0" + }, + "suggest": { + "symfony/polyfill-apcu": "For using ApcuAdapter on HHVM" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Cache\\": "" + }, + "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": "Symfony implementation of PSR-6", + "homepage": "https://symfony.com", + "keywords": [ + "caching", + "psr6" + ], + "time": "2017-04-12T14:14:23+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "a2c590166b2133a4633738648b6b064edae0814a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", + "reference": "a2c590166b2133a4633738648b6b064edae0814a", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -375,46 +528,52 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "time": "2019-03-17T17:37:11+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.6.1", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" + "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", - "homepage": "https://github.com/myclabs/DeepCopy", "keywords": [ "clone", "copy", @@ -422,7 +581,7 @@ "object", "object graph" ], - "time": "2017-04-12T18:52:22+00:00" + "time": "2019-08-09T12:45:53+00:00" }, { "name": "nette/bootstrap", @@ -908,22 +1067,22 @@ }, { "name": "phar-io/manifest", - "version": "1.0.1", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", - "phar-io/version": "^1.0.1", + "phar-io/version": "^2.0", "php": "^5.6 || ^7.0" }, "type": "library", @@ -959,20 +1118,20 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05T18:14:27+00:00" + "time": "2018-07-08T19:23:20+00:00" }, { "name": "phar-io/version", - "version": "1.0.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", "shasum": "" }, "require": { @@ -1006,39 +1165,37 @@ } ], "description": "Library for handling version information and constraints", - "time": "2017-03-05T17:38:23+00:00" + "time": "2018-07-08T19:19:57+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "1.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "~6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1060,33 +1217,39 @@ "reflection", "static analysis" ], - "time": "2015-12-27T11:43:31+00:00" + "time": "2018-08-07T13:53:10+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", + "version": "4.3.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", + "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", "shasum": "" }, "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", + "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": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "doctrine/instantiator": "^1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": [ @@ -1105,41 +1268,40 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" + "time": "2019-09-12T14:27:41+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2.1", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", "shasum": "" }, "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.1", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "ext-tokenizer": "^7.1", + "mockery/mockery": "~1", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1152,42 +1314,43 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25T06:54:22+00:00" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2019-08-22T18:11:29+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.7.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1|^2.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -1215,7 +1378,7 @@ "spy", "stub" ], - "time": "2017-03-02T20:05:34+00:00" + "time": "2019-10-03T11:07:50+00:00" }, { "name": "phpstan/phpstan", @@ -1272,41 +1435,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "5.2.1", + "version": "7.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "dc421f9ca5082a0c0cb04afb171c765f79add85b" + "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/dc421f9ca5082a0c0cb04afb171c765f79add85b", - "reference": "dc421f9ca5082a0c0cb04afb171c765f79add85b", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa0d179a13284c7420fc281fc32750e6cc7c9e2f", + "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.11 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^3.0", - "sebastian/version": "^2.0", - "theseer/tokenizer": "^1.1" + "php": "^7.2", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.1.1", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^4.2.2", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "ext-xdebug": "^2.5", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-xdebug": "^2.5.3" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2.x-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -1321,7 +1483,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1332,29 +1494,32 @@ "testing", "xunit" ], - "time": "2017-04-21T08:03:57+00:00" + "time": "2019-09-17T06:24:36+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1369,7 +1534,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1379,7 +1544,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -1424,28 +1589,28 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -1460,7 +1625,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1469,33 +1634,33 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2019-06-07T04:22:29+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.11", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.3" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1518,57 +1683,56 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-27T10:12:30+00:00" + "time": "2019-09-17T06:23:10+00:00" }, { "name": "phpunit/phpunit", - "version": "6.1.3", + "version": "8.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "824d02024916525a36b2db21847a5ef91db9e4a8" + "reference": "67f9e35bffc0dd52d55d565ddbe4230454fd6a4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/824d02024916525a36b2db21847a5ef91db9e4a8", - "reference": "824d02024916525a36b2db21847a5ef91db9e4a8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/67f9e35bffc0dd52d55d565ddbe4230454fd6a4e", + "reference": "67f9e35bffc0dd52d55d565ddbe4230454fd6a4e", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.2.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.3", - "phar-io/manifest": "^1.0.1", - "phar-io/version": "^1.0", - "php": "^7.0", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.2", - "phpunit/php-file-iterator": "^1.4", - "phpunit/php-text-template": "^1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^4.0", - "sebastian/comparator": "^2.0", - "sebastian/diff": "^1.2", - "sebastian/environment": "^3.0.1", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^1.1 || ^2.0", - "sebastian/object-enumerator": "^3.0.2", - "sebastian/resource-operations": "^1.0", - "sebastian/version": "^2.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2", - "phpunit/dbunit": "<3.0" + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.9.1", + "phar-io/manifest": "^1.0.3", + "phar-io/version": "^2.0.1", + "php": "^7.2", + "phpspec/prophecy": "^1.8.1", + "phpunit/php-code-coverage": "^7.0.7", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.2", + "sebastian/exporter": "^3.1.1", + "sebastian/global-state": "^3.0.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", + "sebastian/version": "^2.0.1" }, "require-dev": { "ext-pdo": "*" }, "suggest": { + "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^1.1" + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -1576,7 +1740,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1.x-dev" + "dev-master": "8.4-dev" } }, "autoload": { @@ -1602,113 +1766,7 @@ "testing", "xunit" ], - "time": "2017-04-29T10:40:17+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "4.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "eabce450df194817a7d7e27e19013569a903a2bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/eabce450df194817a7d7e27e19013569a903a2bf", - "reference": "eabce450df194817a7d7e27e19013569a903a2bf", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^3.0" - }, - "conflict": { - "phpunit/phpunit": "<6.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2017-03-03T06:30:20+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2019-11-06T09:42:23+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1757,30 +1815,30 @@ }, { "name": "sebastian/comparator", - "version": "2.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "20f84f468cb67efee293246e6a09619b891f55f0" + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/20f84f468cb67efee293246e6a09619b891f55f0", - "reference": "20f84f468cb67efee293246e6a09619b891f55f0", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/diff": "^1.2", - "sebastian/exporter": "^3.0" + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1811,38 +1869,39 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-03-03T06:26:08+00:00" + "time": "2018-07-12T15:12:46+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1867,34 +1926,40 @@ "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2015-12-08T07:14:41+00:00" + "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", - "version": "3.0.2", + "version": "4.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "11e7710b7724d42c62249b0e9d3030240398949d" + "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/11e7710b7724d42c62249b0e9d3030240398949d", - "reference": "11e7710b7724d42c62249b0e9d3030240398949d", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404", + "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.1" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -1919,20 +1984,20 @@ "environment", "hhvm" ], - "time": "2017-04-21T14:40:32+00:00" + "time": "2019-05-05T09:05:15+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.0", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", "shasum": "" }, "require": { @@ -1959,6 +2024,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1967,17 +2036,13 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -1986,27 +2051,30 @@ "export", "exporter" ], - "time": "2017-04-03T13:19:02+00:00" + "time": "2019-09-14T09:02:43+00:00" }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -2014,7 +2082,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2037,25 +2105,25 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "time": "2019-02-01T05:30:01+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "31dd3379d16446c5d86dec32ab1ad1f378581ad8" + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/31dd3379d16446c5d86dec32ab1ad1f378581ad8", - "reference": "31dd3379d16446c5d86dec32ab1ad1f378581ad8", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", "shasum": "" }, "require": { "php": "^7.0", - "sebastian/object-reflector": "^1.0", + "sebastian/object-reflector": "^1.1.1", "sebastian/recursion-context": "^3.0" }, "require-dev": { @@ -2084,7 +2152,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-03-12T15:17:29+00:00" + "time": "2017-08-03T12:35:26+00:00" }, { "name": "sebastian/object-reflector", @@ -2186,25 +2254,25 @@ }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2224,29 +2292,32 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2018-10-04T04:07:39+00:00" }, { - "name": "sebastian/version", - "version": "2.0.1", + "name": "sebastian/type", + "version": "1.1.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.1-dev" } }, "autoload": { @@ -2265,68 +2336,36 @@ "role": "lead" } ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "time": "2019-07-02T08:10:15+00:00" }, { - "name": "squizlabs/php_codesniffer", - "version": "2.9.0", + "name": "sebastian/version", + "version": "2.0.1", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "f7dfecbee89d68ab475a6c9e17d22bc9b69aed97" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f7dfecbee89d68ab475a6c9e17d22bc9b69aed97", - "reference": "f7dfecbee89d68ab475a6c9e17d22bc9b69aed97", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" + "php": ">=5.6" }, - "bin": [ - "scripts/phpcs", - "scripts/phpcbf" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2335,84 +2374,65 @@ ], "authors": [ { - "name": "Greg Sherwood", + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", "role": "lead" } ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2017-05-03T23:30:39+00:00" + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" }, { - "name": "symfony/cache", - "version": "v3.2.8", + "name": "squizlabs/php_codesniffer", + "version": "3.5.2", "source": { "type": "git", - "url": "https://github.com/symfony/cache.git", - "reference": "ce81ce67baa387c556d03f389fb3c9efc11286aa" + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "65b12cdeaaa6cd276d4c3033a95b9b88b12701e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/ce81ce67baa387c556d03f389fb3c9efc11286aa", - "reference": "ce81ce67baa387c556d03f389fb3c9efc11286aa", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/65b12cdeaaa6cd276d4c3033a95b9b88b12701e7", + "reference": "65b12cdeaaa6cd276d4c3033a95b9b88b12701e7", "shasum": "" }, "require": { - "php": ">=5.5.9", - "psr/cache": "~1.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/cache-implementation": "1.0" + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" }, "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/cache": "~1.6", - "doctrine/dbal": "~2.4", - "predis/predis": "~1.0" - }, - "suggest": { - "symfony/polyfill-apcu": "For using ApcuAdapter on HHVM" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.x-dev" } }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Cache\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Greg Sherwood", + "role": "lead" } ], - "description": "Symfony implementation of PSR-6", - "homepage": "https://symfony.com", + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ - "caching", - "psr6" + "phpcs", + "standards" ], - "time": "2017-04-12T14:14:23+00:00" + "time": "2019-10-28T04:36:32+00:00" }, { "name": "symfony/console", @@ -2588,6 +2608,64 @@ "homepage": "https://symfony.com", "time": "2017-06-01T21:01:25+00:00" }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "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" + ], + "time": "2019-08-06T08:03:45+00:00" + }, { "name": "symfony/polyfill-mbstring", "version": "v1.4.0", @@ -2649,16 +2727,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.1.0", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", "shasum": "" }, "require": { @@ -2685,28 +2763,28 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" + "time": "2019-06-13T22:48:21+00:00" }, { "name": "webmozart/assert", - "version": "1.2.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", + "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", "extra": { @@ -2735,7 +2813,7 @@ "check", "validate" ], - "time": "2016-11-23T20:04:58+00:00" + "time": "2019-08-24T08:43:50+00:00" } ], "aliases": [], @@ -2744,7 +2822,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.6.0" + "php": ">=7.1.0" }, "platform-dev": [] } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 14fb997..f42f5d3 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -4,6 +4,10 @@ ./build/ ./vendor/ + + + + diff --git a/phpstan.neon b/phpstan.neon index 5f7d6a3..b647b5d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,10 +3,11 @@ parameters: # Branding stub client - '#BBC\\BrandingClient\\BrandingStubClient::__construct\(\) does not call parent constructor from BBC\\BrandingClient\\BrandingClient#' - '#Constructor of class BBC\\BrandingClient\\BrandingStubClient has an unused parameter \$[a-zA-Z0-9\\_]#' + - '#Method BBC\\ProgrammesCachingLibrary\\CacheInterface::getItem\(\) invoked with 2 parameters, 1 required.#' # Orbit stub client - '#BBC\\BrandingClient\\OrbitStubClient::__construct\(\) does not call parent constructor from BBC\\BrandingClient\\OrbitClient#' - '#Constructor of class BBC\\BrandingClient\\OrbitStubClient has an unused parameter \$[a-zA-Z0-9\\_]#' # Mocks - - '#Parameter .* of class .* expects .*, PHPUnit_Framework_MockObject_MockObject given#' + - '#Parameter .* of class .* expects .*, PHPUnit\\Framework\\MockObject\\MockObject given#' diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c0161d7..100820d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -20,10 +20,4 @@ - - - - - diff --git a/src/BrandingClient.php b/src/BrandingClient.php index 8350870..c7e32c8 100644 --- a/src/BrandingClient.php +++ b/src/BrandingClient.php @@ -2,14 +2,15 @@ namespace BBC\BrandingClient; +use BBC\ProgrammesCachingLibrary\CacheInterface; use DateTime; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Promise\FulfilledPromise; use Psr\Http\Message\ResponseInterface; use Psr\Cache\CacheItemInterface; -use Psr\Cache\CacheItemPoolInterface; use Exception; +use Psr\Log\LoggerInterface; use function GuzzleHttp\Psr7\parse_header; class BrandingClient @@ -25,6 +26,8 @@ class BrandingClient const BRANDING_WEBSERVICE_PREVIEW_URL_DEV = 'https://branding.test.files.bbci.co.uk/branding/{env}/previews/{themeVersionId}.json'; // @codingStandardsIgnoreEnd + const REQUEST_TIMEOUT = 3; + const SUPPORTED_ENVIRONMENTS = ['int', 'test', 'live']; const FALLBACK_CACHE_DURATION = 1800; @@ -32,11 +35,11 @@ class BrandingClient /** @var Client */ private $client; - /** @var CacheItemPoolInterface */ + /** @var CacheInterface */ private $cache; - /** @var bool */ - private $flushCacheItems = false; + /** @var LoggerInterface */ + private $logger; /** * @var array @@ -54,14 +57,16 @@ class BrandingClient ]; public function __construct( + LoggerInterface $logger, Client $client, - CacheItemPoolInterface $cache, + CacheInterface $cache, array $options = [] ) { + $this->logger = $logger; $this->client = $client; $this->cache = $cache; - if (array_key_exists('env', $options) && !in_array($options['env'], self::SUPPORTED_ENVIRONMENTS)) { + if (\array_key_exists('env', $options) && !\in_array($options['env'], self::SUPPORTED_ENVIRONMENTS)) { throw new BrandingException(sprintf( 'Invalid environment supplied, expected one of "%s" but got "%s"', implode(', ', self::SUPPORTED_ENVIRONMENTS), @@ -69,7 +74,7 @@ public function __construct( )); } - if (array_key_exists('cacheTime', $options) && !(is_int($options['cacheTime']) && $options['cacheTime'] >= 0)) { + if (\array_key_exists('cacheTime', $options) && !(\is_int($options['cacheTime']) && $options['cacheTime'] >= 0)) { throw new BrandingException(sprintf( 'Invalid cacheTime supplied, expected a positive integer but got "%s"', $options['cacheTime'] @@ -82,18 +87,19 @@ public function __construct( public function getContent($projectId, $themeVersionId = null) { $url = $this->getUrl($projectId, $themeVersionId); - $cacheItem = $this->fetchCacheItem($url); + $cacheKey = $this->cache->keyHelper(__CLASS__, __FUNCTION__, $projectId, $themeVersionId); + $cacheItem = $this->cache->getItem($cacheKey); if ($cacheItem->isHit()) { return $this->mapResultToBrandingObject($cacheItem->get()); } try { $response = $this->client->get($url, [ - 'headers' => ['Accept-Encoding' => 'gzip'] + 'headers' => ['Accept-Encoding' => 'gzip'], 'timeout' => self::REQUEST_TIMEOUT ]); $result = $this->parseAndCacheResponse($response, $cacheItem); } catch (RequestException $e) { - throw $this->makeInvalidResponseException($e); + return $this->handleRequestException($e, $cacheKey); } return $this->mapResultToBrandingObject($result); } @@ -101,39 +107,60 @@ public function getContent($projectId, $themeVersionId = null) public function getContentAsync($projectId, $themeVersionId = null) { $url = $this->getUrl($projectId, $themeVersionId); - $cacheItem = $this->fetchCacheItem($url); + $cacheKey = $this->cache->keyHelper(__CLASS__, __FUNCTION__, $projectId, $themeVersionId); + $cacheItem = $this->cache->getItem($cacheKey); if ($cacheItem->isHit()) { $brandingObject = $this->mapResultToBrandingObject($cacheItem->get()); return new FulfilledPromise($brandingObject); } - try { - $requestPromise = $this->client->requestAsync('GET', $url, [ - 'headers' => ['Accept-Encoding' => 'gzip'] - ]); - $promise = $requestPromise->then( - // Success callback - function ($response) use ($cacheItem) { - $result = $this->parseAndCacheResponse($response, $cacheItem); - return $this->mapResultToBrandingObject($result); - }, - // Error callback - function ($reason) { - if ($reason instanceof RequestException) { - throw $this->makeInvalidResponseException($reason); - } - if ($reason instanceof Exception) { - throw $reason; - } - throw new BrandingException("Invalid Branding Response. Unknown error reason in callback"); + $requestPromise = $this->client->requestAsync('GET', $url, [ + 'headers' => ['Accept-Encoding' => 'gzip'], 'timeout' => self::REQUEST_TIMEOUT + ]); + $promise = $requestPromise->then( + // Success callback + function ($response) use ($cacheItem) { + $result = $this->parseAndCacheResponse($response, $cacheItem); + return $this->mapResultToBrandingObject($result); + }, + // Error callback + function ($reason) use ($cacheKey) { + if ($reason instanceof RequestException) { + $brandingObject = $this->handleRequestException($reason, $cacheKey); + return new FulfilledPromise($brandingObject); } - ); - } catch (RequestException $e) { - throw $this->makeInvalidResponseException($e); - } + if ($reason instanceof Exception) { + throw $reason; + } + throw new BrandingException("Invalid Branding Response. Unknown error reason in callback"); + } + ); + return $promise; } + /** + * @param RequestException $e + * @param string $cacheKey + * @return Branding + */ + private function handleRequestException($e, $cacheKey) + { + // if the error is not a 404, return the stale value when available + if ($e->getResponse() && $e->getResponse()->getStatusCode()) { + $responseCode = $e->getResponse()->getStatusCode(); + } + if (!isset($responseCode) || $responseCode !== 404) { + $cacheItem = $this->cache->getItem($cacheKey, true); + if ($cacheItem->isHit()) { + $this->logger->error($e->getMessage()); + return $this->mapResultToBrandingObject($cacheItem->get()); + } + } + + throw $this->makeInvalidResponseException($e); + } + /** * Retrieve the options that have been set * @@ -144,11 +171,6 @@ public function getOptions() return $this->options; } - public function setFlushCacheItems($flushCacheItems) - { - $this->flushCacheItems = (bool) $flushCacheItems; - } - private function mapResultToBrandingObject(array $branding) { return new Branding( @@ -203,18 +225,6 @@ private function getDateFromHeader($response, $headerName) return null; } - private function fetchCacheItem($url) - { - $cacheKey = $this->options['cacheKeyPrefix'] . '.' . md5($url); - - if ($this->flushCacheItems) { - $this->cache->deleteItem($cacheKey); - } - /** @var CacheItemInterface $cacheItem */ - $cacheItem = $this->cache->getItem($cacheKey); - return $cacheItem; - } - private function parseAndCacheResponse(ResponseInterface $response, CacheItemInterface $cacheItem) { $result = json_decode($response->getBody()->getContents(), true); @@ -244,9 +254,7 @@ private function parseAndCacheResponse(ResponseInterface $response, CacheItemInt } // cache the result - $cacheItem->set($result); - $cacheItem->expiresAfter($cacheTime); - $this->cache->save($cacheItem); + $this->cache->setItem($cacheItem, $result, $cacheTime); return $result; } diff --git a/src/BrandingStubClient.php b/src/BrandingStubClient.php index 0e9e203..99e5609 100644 --- a/src/BrandingStubClient.php +++ b/src/BrandingStubClient.php @@ -2,15 +2,17 @@ namespace BBC\BrandingClient; +use BBC\ProgrammesCachingLibrary\CacheInterface; use GuzzleHttp\Client; use GuzzleHttp\Promise\FulfilledPromise; -use Psr\Cache\CacheItemPoolInterface; +use Psr\Log\LoggerInterface; class BrandingStubClient extends BrandingClient { public function __construct( + LoggerInterface $logger = null, Client $client = null, - CacheItemPoolInterface $cache = null, + CacheInterface $cache = null, array $options = [] ) { } diff --git a/src/OrbitClient.php b/src/OrbitClient.php index 65a0c5f..b47e4b6 100644 --- a/src/OrbitClient.php +++ b/src/OrbitClient.php @@ -2,11 +2,11 @@ namespace BBC\BrandingClient; +use BBC\ProgrammesCachingLibrary\CacheInterface; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; +use Psr\Log\LoggerInterface; use function GuzzleHttp\Psr7\parse_header; -use Psr\Cache\CacheItemPoolInterface; -use Psr\Cache\CacheItemInterface; use DateTime; use Mustache_Engine; @@ -22,11 +22,11 @@ class OrbitClient /** @var Client */ private $client; - /** @var CacheItemPoolInterface */ + /** @var CacheInterface */ private $cache; - /** @var bool */ - private $flushCacheItems = false; + /** @var LoggerInterface */ + private $logger; /** * @var array @@ -46,10 +46,12 @@ class OrbitClient ]; public function __construct( + LoggerInterface $logger, Client $client, - CacheItemPoolInterface $cache, + CacheInterface $cache, array $options = [] ) { + $this->logger = $logger; $this->client = $client; $this->cache = $cache; @@ -84,12 +86,8 @@ public function getContent(array $requestParams = [], array $templateParams = [] { $url = $this->getUrl(); $headers = $this->getRequestHeaders($requestParams); - $cacheKey = $this->options['cacheKeyPrefix'] . '.' . md5($url . json_encode($requestParams)); + $cacheKey = $this->cache->keyHelper(__CLASS__, __FUNCTION__, md5(json_encode($requestParams))); - if ($this->flushCacheItems) { - $this->cache->deleteItem($cacheKey); - } - /** @var CacheItemInterface $cacheItem */ $cacheItem = $this->cache->getItem($cacheKey); if (!$cacheItem->isHit()) { try { @@ -98,6 +96,22 @@ public function getContent(array $requestParams = [], array $templateParams = [] ]); $result = json_decode($response->getBody()->getContents(), true); } catch (RequestException $e) { + // if the error is not a 404, return the stale value when available + if ($e->getResponse() && $e->getResponse()->getStatusCode()) { + $responseCode = $e->getResponse()->getStatusCode(); + } + if (!isset($responseCode) || $responseCode !== 404) { + $cacheItem = $this->cache->getItem($cacheKey, true); + if ($cacheItem->isHit()) { + $this->logger->error($e->getMessage()); + $output = $this->renderOrbResponse($cacheItem->get(), $templateParams); + return new Orbit( + $output['head'], + $output['bodyFirst'], + $output['bodyLast'] + ); + } + } throw new OrbitException('Invalid Orbit Response. Could not get data from webservice', 0, $e); } @@ -126,15 +140,10 @@ public function getContent(array $requestParams = [], array $templateParams = [] } } - // cache the result - $cacheItem->set($result); - $cacheItem->expiresAfter($cacheTime); - $this->cache->save($cacheItem); + $this->cache->setItem($cacheItem, $result, $cacheTime); } - $cachedResponse = $cacheItem->get(); - - $output = $this->renderOrbResponse($cachedResponse, $templateParams); + $output = $this->renderOrbResponse($cacheItem->get(), $templateParams); return new Orbit( $output['head'], @@ -153,11 +162,6 @@ public function getOptions() return $this->options; } - public function setFlushCacheItems(bool $flushCacheItems): void - { - $this->flushCacheItems = $flushCacheItems; - } - /** * Construct the hostname, from the environment and URL override if present * diff --git a/src/OrbitStubClient.php b/src/OrbitStubClient.php index 7e35b92..aa2d238 100644 --- a/src/OrbitStubClient.php +++ b/src/OrbitStubClient.php @@ -2,14 +2,16 @@ namespace BBC\BrandingClient; +use BBC\ProgrammesCachingLibrary\CacheInterface; use GuzzleHttp\Client; -use Psr\Cache\CacheItemPoolInterface; +use Psr\Log\LoggerInterface; class OrbitStubClient extends OrbitClient { public function __construct( + LoggerInterface $logger = null, Client $client = null, - CacheItemPoolInterface $cache = null, + CacheInterface $cache = null, array $options = [] ) { } diff --git a/tests/BrandingClientTest.php b/tests/BrandingClientTest.php index 51b1c19..30f78bc 100644 --- a/tests/BrandingClientTest.php +++ b/tests/BrandingClientTest.php @@ -4,18 +4,20 @@ use BBC\BrandingClient\Branding; use BBC\BrandingClient\BrandingClient; -use GuzzleHttp\Client; -use Psr\Cache\CacheItemInterface; -use Psr\Cache\CacheItemPoolInterface; -use Symfony\Component\Cache\Adapter\NullAdapter; +use BBC\BrandingClient\BrandingException; +use BBC\ProgrammesCachingLibrary\CacheInterface; +use BBC\ProgrammesCachingLibrary\CacheWithResilience; +use Psr\Log\LoggerInterface; class BrandingClientTest extends MultiGuzzleTestCase { public $cache; + public $logger; - public function setUp() + public function setUp(): void { - $this->cache = new NullAdapter(); + $this->cache = $this->createMock(CacheInterface::class); + $this->logger = $this->createMock(LoggerInterface::class); } public function testConstructor() @@ -27,6 +29,7 @@ public function testConstructor() ]; $brandingClient = new BrandingClient( + $this->logger, $this->getClient(), $this->cache ); @@ -43,6 +46,7 @@ public function testConstructorCustomOptions() ]; $brandingClient = new BrandingClient( + $this->logger, $this->getClient(), $this->cache, $options @@ -52,26 +56,24 @@ public function testConstructorCustomOptions() $this->assertEquals($options, $brandingClient->getOptions()); } - /** - * @expectedException BBC\BrandingClient\BrandingException - * @expectedExceptionMessage Invalid environment supplied, expected one of "int, test, live" but got "garbage" - */ public function testInvalidEnvThrowsException() { + $this->expectException(BrandingException::class); + $this->expectExceptionMessage('Invalid environment supplied, expected one of "int, test, live" but got "garbage"'); new BrandingClient( + $this->logger, $this->getClient(), $this->cache, ['env' => 'garbage'] ); } - /** - * @expectedException BBC\BrandingClient\BrandingException - * @expectedExceptionMessage Invalid cacheTime supplied, expected a positive integer but got "-10" - */ public function testInvalidCacheTimeThrowsException() { + $this->expectException(BrandingException::class); + $this->expectExceptionMessage('Invalid cacheTime supplied, expected a positive integer but got "-10"'); new BrandingClient( + $this->logger, $this->getClient(), $this->cache, ['cacheTime' => -10] @@ -90,7 +92,7 @@ public function testGetContentCallsCorrectUrl($options, $arguments, $expectedUrl $history ); - $brandingClient = new BrandingClient($client, $this->cache, $options); + $brandingClient = new BrandingClient($this->logger, $client, $this->cache, $options); $brandingClient->getContent(...$arguments); $this->assertEquals($expectedUrl, $this->getLastRequestUrl($history)); @@ -127,7 +129,7 @@ public function testGetContentReturnsBrandingObject() $client = $this->getClient([$this->mockSuccessfulJsonResponse()]); - $brandingClient = new BrandingClient($client, $this->cache); + $brandingClient = new BrandingClient($this->logger, $client, $this->cache); $this->assertEquals($expectedContent, $brandingClient->getContent('br-123')); } @@ -143,45 +145,43 @@ public function testGetContentPromiseReturnsBrandingObject() $client = $this->getClient([$this->mockSuccessfulJsonResponse()]); - $brandingClient = new BrandingClient($client, $this->cache); + $brandingClient = new BrandingClient($this->logger, $client, $this->cache); $promise = $brandingClient->getContentAsync('br-123'); $this->assertEquals($expectedContent, $promise->wait(true)); } - /** - * @expectedException BBC\BrandingClient\BrandingException - * @expectedExceptionMessage Invalid Branding Response. Could not get data from webservice - */ public function testInvalidContentThrowsException() { + $this->expectException(BrandingException::class); + $this->expectExceptionMessage('Invalid Branding Response. Could not get data from webservice'); + $client = $this->getClient([$this->mockInvalidJsonResponse()]); - $brandingClient = new BrandingClient($client, $this->cache); + $brandingClient = new BrandingClient($this->logger, $client, $this->cache); $brandingClient->getContent('br-123'); } - /** - * @expectedException BBC\BrandingClient\BrandingException - * @expectedExceptionMessage Invalid Branding Response. Could not get data from webservice - */ public function testInvalidContentThrowsExceptionWhenPromiseResolved() { + $this->expectException(BrandingException::class); + $this->expectExceptionMessage('Invalid Branding Response. Could not get data from webservice'); + $client = $this->getClient([$this->mockInvalidJsonResponse()]); - $brandingClient = new BrandingClient($client, $this->cache); + $brandingClient = new BrandingClient($this->logger, $client, $this->cache); $promise = $brandingClient->getContentAsync('br-123'); $promise->wait(true); } - /** - * @expectedException BBC\BrandingClient\BrandingException - * @expectedExceptionMessage Invalid Branding Response. Response JSON object was invalid or malformed - */ public function testMalformedContentThrowsException() { + $this->expectException(BrandingException::class); + $this->expectExceptionMessage('Invalid Branding Response. Response JSON object was invalid or malformed'); + + $client = $this->getClient([$this->mockMalformedJsonResponse()]); - $brandingClient = new BrandingClient($client, $this->cache); + $brandingClient = new BrandingClient($this->logger, $client, $this->cache); $brandingClient->getContent('br-123'); } @@ -190,27 +190,16 @@ public function testMalformedContentThrowsException() */ public function testCachingTimes($options, $headers, $expectedCacheDuration) { - $expectedKey = 'branding.b22b2e21ce267c3879b21fd96939bfd3'; - $client = $this->getClient([$this->mockSuccessfulJsonResponse($headers)]); - $cache = $this->getMockBuilder('Symfony\Component\Cache\Adapter\NullAdapter') - ->disableOriginalClone() - ->disableArgumentCloning() - ->disallowMockingUnknownTypes() - ->setMethods(['save']) - ->getMock(); - - $cache->expects($this->once())->method('save')->with($this->callback( - function ($cacheItemToSave) use ($expectedKey, $expectedCacheDuration) { - $current = time() + $expectedCacheDuration; - $this->assertEquals($expectedKey, $cacheItemToSave->getKey()); - $this->assertAttributeEquals($current, 'expiry', $cacheItemToSave); - return true; - } - )); - - $brandingClient = new BrandingClient($client, $cache, $options); - $brandingClient->getContent('br-123'); + $cache = $this->createMock(CacheWithResilience::class); + $cache->expects($this->once())->method('setItem')->with( + $this->anything(), + $this->anything(), + $expectedCacheDuration + ); + + $orbitClient = new BrandingClient($this->logger, $client, $cache, $options); + $orbitClient->getContent('br-123'); } public function cachingTimesDataProvider() @@ -261,33 +250,6 @@ public function cachingTimesDataProvider() ]; } - public function testFlushCacheRefreshItem() - { - $cacheItemInterface = $this->createMock(CacheItemInterface::class); - $cacheItemInterface->method('isHit')->willReturn(true); - $cacheItemInterface->method('get')->willReturn( - ['head' => '', 'bodyFirst' => '', 'bodyLast' => '', 'colours' => [], 'options' => []] - ); - - $cache = $this->createMock(CacheItemPoolInterface::class); - $cache->method('getItem')->willReturn($cacheItemInterface); - - $brandingClient = new BrandingClient( - $this->createMock(Client::class), - $cache - ); - - // test if deleteItem is call when setFlushCacheItems is set to true - $brandingClient->setFlushCacheItems(true); - $cache->expects($this->once())->method('deleteItem'); - $brandingClient->getContent(''); - - // test if deleteItem is not call when setFlushCacheItems is set to false - $brandingClient->setFlushCacheItems(false); - $cache->expects($this->never())->method('deleteItem'); - $brandingClient->getContent(''); - } - private function mockSuccessfulJsonResponse(array $headers = []) { return $this->mockResponse(200, $headers, json_encode([ diff --git a/tests/BrandingStubClientTest.php b/tests/BrandingStubClientTest.php index 5cee22b..8420317 100644 --- a/tests/BrandingStubClientTest.php +++ b/tests/BrandingStubClientTest.php @@ -4,7 +4,7 @@ use BBC\BrandingClient\Branding; use BBC\BrandingClient\BrandingStubClient; -use Symfony\Component\Cache\Adapter\NullAdapter; +use Psr\Log\NullLogger; class BrandingStubClientTest extends MultiGuzzleTestCase { @@ -31,8 +31,9 @@ public function testGetContent() public function testGetContentWithPresentButUnusedConstructor() { $brandingClient = new BrandingStubClient( + new NullLogger(), $this->getClient(), - new NullAdapter() + null ); $expectedBranding = new Branding( diff --git a/tests/OrbitClientTest.php b/tests/OrbitClientTest.php index 6b99e50..8108740 100644 --- a/tests/OrbitClientTest.php +++ b/tests/OrbitClientTest.php @@ -5,18 +5,19 @@ use BBC\BrandingClient\Orbit; use BBC\BrandingClient\OrbitClient; use BBC\BrandingClient\OrbitException; -use GuzzleHttp\Client; -use Psr\Cache\CacheItemInterface; -use Psr\Cache\CacheItemPoolInterface; +use BBC\ProgrammesCachingLibrary\CacheWithResilience; +use Psr\Log\LoggerInterface; use Symfony\Component\Cache\Adapter\NullAdapter; class OrbitClientTest extends MultiGuzzleTestCase { public $cache; + public $logger; - public function setUp() + public function setUp():void { - $this->cache = new NullAdapter(); + $this->logger = $this->createMock(LoggerInterface::class); + $this->cache = new CacheWithResilience($this->logger, new NullAdapter(), '', 1, []); } public function testConstructor() @@ -30,6 +31,7 @@ public function testConstructor() ]; $orbitClient = new OrbitClient( + $this->logger, $this->getClient(), $this->cache ); @@ -48,6 +50,7 @@ public function testConstructorCustomOptions() ]; $orbitClient = new OrbitClient( + $this->logger, $this->getClient(), $this->cache, $options @@ -63,19 +66,19 @@ public function testInvalidEnvThrowsException() 'Invalid environment supplied, expected one of "int, test, stage, live" but got "garbage"' ); new OrbitClient( + $this->logger, $this->getClient(), $this->cache, ['env' => 'garbage'] ); } - /** - * @expectedException BBC\BrandingClient\OrbitException - * @expectedExceptionMessage Invalid cacheTime supplied, expected a positive integer but got "-10" - */ public function testInvalidCacheTimeThrowsException() { + $this->expectException(OrbitException::class); + $this->expectExceptionMessage('Invalid cacheTime supplied, expected a positive integer but got "-10"'); new OrbitClient( + $this->logger, $this->getClient(), $this->cache, ['cacheTime' => -10] @@ -94,11 +97,14 @@ public function testGetContentCallsCorrectUrl($options, $arguments, $expectedUrl $history ); - $orbitClient = new OrbitClient($client, $this->cache, $options); + $orbitClient = new OrbitClient($this->logger, $client, $this->cache, $options); $orbitClient->getContent(...$arguments); $this->assertEquals($expectedUrl, $this->getLastRequestUrl($history)); - $this->assertArraySubset($expectedHeaders, $this->getLastRequest($history)->getHeaders()); + $lastRequestHeaders = $this->getLastRequest($history)->getHeaders(); + foreach ($expectedHeaders as $key => $expectedHeader) { + self::assertEquals($expectedHeader, $lastRequestHeaders[$key]); + } } public function orbitApiUrlsDataProvider() @@ -138,7 +144,7 @@ public function testGetContentReturnsOrbitObject() $client = $this->getClient([$this->mockSuccessfulJsonResponse()]); - $orbitClient = new OrbitClient($client, $this->cache); + $orbitClient = new OrbitClient($this->logger, $client, $this->cache); $this->assertEquals($expectedContent, $orbitClient->getContent()); } @@ -152,33 +158,30 @@ public function testGetContentReturnsOrbitObjectWithTemplateParams() $client = $this->getClient([$this->mockSuccessfulJsonResponse()]); - $orbitClient = new OrbitClient($client, $this->cache); + $orbitClient = new OrbitClient($this->logger, $client, $this->cache); $this->assertEquals($expectedContent, $orbitClient->getContent([], [ 'skipLinkTarget' => 'skip', ])); } - /** - * @expectedException BBC\BrandingClient\OrbitException - * @expectedExceptionMessage Invalid Orbit Response. Could not get data from webservice - */ public function testInvalidContentThrowsException() { + $this->expectException(OrbitException::class); + $this->expectExceptionMessage('Invalid Orbit Response. Could not get data from webservice'); + $client = $this->getClient([$this->mockInvalidJsonResponse()]); - $orbitClient = new OrbitClient($client, $this->cache); + $orbitClient = new OrbitClient($this->logger, $client, $this->cache); $orbitClient->getContent([]); } - /** - * @expectedException BBC\BrandingClient\OrbitException - * @expectedExceptionMessage Invalid Orbit Response. Response JSON object was invalid or malformed - */ public function testMalformedContentThrowsException() { + $this->expectException(OrbitException::class); + $this->expectExceptionMessage('Invalid Orbit Response. Response JSON object was invalid or malformed'); $client = $this->getClient([$this->mockMalformedJsonResponse()]); - $orbitClient = new OrbitClient($client, $this->cache); + $orbitClient = new OrbitClient($this->logger, $client, $this->cache); $orbitClient->getContent([]); } @@ -187,28 +190,16 @@ public function testMalformedContentThrowsException() */ public function testCachingTimes($options, $headers, $expectedCacheDuration) { - $expectedKey = 'orbit.5617e91c21636eb642dbeabcfb06342c'; - $client = $this->getClient([$this->mockSuccessfulJsonResponse($headers)]); + $cache = $this->createMock(CacheWithResilience::class); + $cache->expects($this->once())->method('setItem')->with( + $this->anything(), + $this->anything(), + $expectedCacheDuration + ); - $cache = $this->getMockBuilder('Symfony\Component\Cache\Adapter\NullAdapter') - ->disableOriginalClone() - ->disableArgumentCloning() - ->disallowMockingUnknownTypes() - ->setMethods(['save']) - ->getMock(); - - $cache->expects($this->once())->method('save')->with($this->callback( - function ($cacheItemToSave) use ($expectedKey, $expectedCacheDuration) { - $current = time() + $expectedCacheDuration; - $this->assertEquals($expectedKey, $cacheItemToSave->getKey()); - $this->assertAttributeEquals($current, 'expiry', $cacheItemToSave); - return true; - } - )); - - $orbitClient = new OrbitClient($client, $cache, $options); - + $this->expectException(\TypeError::class); + $orbitClient = new OrbitClient($this->logger, $client, $cache, $options); $orbitClient->getContent([]); } @@ -260,40 +251,6 @@ public function cachingTimesDataProvider() ]; } - public function testFlushCacheRefreshItem() - { - $cacheItemInterface = $this->createMock(CacheItemInterface::class); - $cacheItemInterface->method('isHit')->willReturn(true); - $cacheItemInterface->method('get')->willReturn( - [ - '@context' => [], - '@type' => '', - '@id' => '', - 'head' => ['template' => '', 'html' => ''], - 'bodyFirst' => ['template' => '', 'html' => ''], - 'bodyLast' => ['template' => '', 'html' => ''], - ] - ); - - $cache = $this->createMock(CacheItemPoolInterface::class); - $cache->method('getItem')->willReturn($cacheItemInterface); - - $orbitClient = new OrbitClient( - $this->createMock(Client::class), - $cache - ); - - // test if deleteItem is call when setFlushCacheItems is set to true - $orbitClient->setFlushCacheItems(true); - $cache->expects($this->once())->method('deleteItem'); - $orbitClient->getContent(); - - // test if deleteItem is not call when setFlushCacheItems is set to false - $orbitClient->setFlushCacheItems(false); - $cache->expects($this->never())->method('deleteItem'); - $orbitClient->getContent(); - } - private function mockSuccessfulJsonResponse(array $headers = []) { return $this->mockResponse(200, $headers, json_encode([ diff --git a/tests/OrbitStubClientTest.php b/tests/OrbitStubClientTest.php index 8fdd85a..eff3410 100644 --- a/tests/OrbitStubClientTest.php +++ b/tests/OrbitStubClientTest.php @@ -4,6 +4,7 @@ use BBC\BrandingClient\Orbit; use BBC\BrandingClient\OrbitStubClient; +use Psr\Log\NullLogger; use Symfony\Component\Cache\Adapter\NullAdapter; class OrbitStubClientTest extends MultiGuzzleTestCase @@ -25,8 +26,9 @@ public function testGetContent() public function testGetContentWithPresentButUnusedConstructor() { $orbitClient = new OrbitStubClient( + new NullLogger(), $this->getClient(), - new NullAdapter() + null ); $expectedOrbit = new Orbit(