From: nodiscc Date: Sun, 4 Oct 2020 11:45:24 +0000 (+0000) Subject: Merge pull request #1579 from sprak3000/issue-1437-tag-sort-buttons-ui X-Git-Tag: v0.12.0-beta-2~5 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=df25b28dcd3cde54d42c18a55a810daa82bf5727;hp=f4ea7cd5633773a0f6438a1d50dbb70eeacf2f04;p=github%2Fshaarli%2FShaarli.git Merge pull request #1579 from sprak3000/issue-1437-tag-sort-buttons-ui Fix #1437 - Make tag cloud/list views buttons more obvious --- diff --git a/.htaccess b/.htaccess index af2dc5a7..25fcfb03 100644 --- a/.htaccess +++ b/.htaccess @@ -10,8 +10,12 @@ RewriteRule ^(.git|doxygen|vendor) - [F] # fixes JWT token not correctly forwarded on some Apache/FastCGI setups RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] +# Alternative (if the 2 lines above don't work) +# SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 # REST API +# Ionos Hosting needs RewriteBase / +# RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [QSA,L] diff --git a/.travis.yml b/.travis.yml index af04a022..d7460947 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,14 @@ dist: bionic matrix: include: # jobs for each supported php version + - language: php + php: nightly # PHP 8.0 + install: + - composer self-update --2 + - composer update --ignore-platform-req=php + - composer remove --dev --ignore-platform-req=php phpunit/phpunit + - composer require --dev --ignore-platform-req=php phpunit/php-text-template ^2.0 + - composer require --dev --ignore-platform-req=php phpunit/phpunit ^9.0 - language: php php: 7.4 - language: php diff --git a/application/api/ApiMiddleware.php b/application/api/ApiMiddleware.php index 09ce6445..f5b53b01 100644 --- a/application/api/ApiMiddleware.php +++ b/application/api/ApiMiddleware.php @@ -107,7 +107,9 @@ class ApiMiddleware */ protected function checkToken($request) { - if (! $request->hasHeader('Authorization')) { + if (!$request->hasHeader('Authorization') + && !isset($this->container->environment['REDIRECT_HTTP_AUTHORIZATION']) + ) { throw new ApiAuthorizationException('JWT token not provided'); } @@ -115,7 +117,11 @@ class ApiMiddleware throw new ApiAuthorizationException('Token secret must be set in Shaarli\'s administration'); } - $authorization = $request->getHeaderLine('Authorization'); + if (isset($this->container->environment['REDIRECT_HTTP_AUTHORIZATION'])) { + $authorization = $this->container->environment['REDIRECT_HTTP_AUTHORIZATION']; + } else { + $authorization = $request->getHeaderLine('Authorization'); + } if (! preg_match('/^Bearer (.*)/i', $authorization, $matches)) { throw new ApiAuthorizationException('Invalid JWT header'); diff --git a/application/config/ConfigJson.php b/application/config/ConfigJson.php index 4509357c..c0c0dab9 100644 --- a/application/config/ConfigJson.php +++ b/application/config/ConfigJson.php @@ -46,7 +46,7 @@ class ConfigJson implements ConfigIO // JSON_PRETTY_PRINT is available from PHP 5.4. $print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0; $data = self::getPhpHeaders() . json_encode($conf, $print) . self::getPhpSuffix(); - if (!file_put_contents($filepath, $data)) { + if (empty($filepath) || !file_put_contents($filepath, $data)) { throw new \Shaarli\Exceptions\IOException( $filepath, t('Shaarli could not create the config file. '. diff --git a/composer.json b/composer.json index de7b1732..cd9fcf5b 100644 --- a/composer.json +++ b/composer.json @@ -27,9 +27,8 @@ }, "require-dev": { "roave/security-advisories": "dev-master", - "phpunit/phpcov": "*", - "phpunit/phpunit": "^7.5 || ^8.0", - "squizlabs/php_codesniffer": "3.*" + "squizlabs/php_codesniffer": "3.*", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "suggest": { "ext-curl": "Allows fetching web pages and thumbnails in a more robust way", diff --git a/composer.lock b/composer.lock index ae7a9269..2c8b0ea7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,29 +4,31 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "37e420b4b6e9fa74b27e127dd422d9a6", + "content-hash": "98520a05a7185503ee13d05ffaa535f6", "packages": [ { "name": "arthurhoaro/web-thumbnailer", - "version": "v2.0.1", + "version": "v2.0.3", "source": { "type": "git", "url": "https://github.com/ArthurHoaro/web-thumbnailer.git", - "reference": "4aa27a1b54b9823341fedd7ca2dcfb11a6b3186a" + "reference": "39bfd4f3136d9e6096496b9720e877326cfe4775" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ArthurHoaro/web-thumbnailer/zipball/4aa27a1b54b9823341fedd7ca2dcfb11a6b3186a", - "reference": "4aa27a1b54b9823341fedd7ca2dcfb11a6b3186a", + "url": "https://api.github.com/repos/ArthurHoaro/web-thumbnailer/zipball/39bfd4f3136d9e6096496b9720e877326cfe4775", + "reference": "39bfd4f3136d9e6096496b9720e877326cfe4775", "shasum": "" }, "require": { "php": ">=7.1", - "phpunit/php-text-template": "^1.2" + "phpunit/php-text-template": "^1.2 || ^2.0" }, "require-dev": { + "gskema/phpcs-type-sniff": "^0.13.1", "php-coveralls/php-coveralls": "^2.0", - "phpunit/phpunit": "^7.0 || ^8.0", + "phpstan/phpstan": "^0.12.9", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", "squizlabs/php_codesniffer": "^3.0" }, "type": "library", @@ -49,7 +51,11 @@ } ], "description": "PHP library which will retrieve a thumbnail for any given URL", - "time": "2020-01-17T19:42:49+00:00" + "support": { + "issues": "https://github.com/ArthurHoaro/web-thumbnailer/issues", + "source": "https://github.com/ArthurHoaro/web-thumbnailer/tree/v2.0.3" + }, + "time": "2020-09-29T15:51:03+00:00" }, { "name": "erusev/parsedown", @@ -95,6 +101,10 @@ "markdown", "parser" ], + "support": { + "issues": "https://github.com/erusev/parsedown/issues", + "source": "https://github.com/erusev/parsedown/tree/1.7.x" + }, "time": "2019-12-30T22:54:17+00:00" }, { @@ -157,6 +167,11 @@ "po", "translation" ], + "support": { + "email": "oom@oscarotero.com", + "issues": "https://github.com/oscarotero/Gettext/issues", + "source": "https://github.com/php-gettext/Gettext/tree/v4.8.2" + }, "time": "2019-12-02T10:21:14+00:00" }, { @@ -218,6 +233,10 @@ "translations", "unicode" ], + "support": { + "issues": "https://github.com/php-gettext/Languages/issues", + "source": "https://github.com/php-gettext/Languages/tree/2.6.0" + }, "time": "2019-11-13T10:30:21+00:00" }, { @@ -268,6 +287,10 @@ "keywords": [ "logging" ], + "support": { + "issues": "https://github.com/katzgrau/KLogger/issues", + "source": "https://github.com/katzgrau/KLogger/tree/master" + }, "time": "2016-11-07T19:29:14+00:00" }, { @@ -314,6 +337,10 @@ "router", "routing" ], + "support": { + "issues": "https://github.com/nikic/FastRoute/issues", + "source": "https://github.com/nikic/FastRoute/tree/master" + }, "time": "2018-02-13T20:26:39+00:00" }, { @@ -355,6 +382,10 @@ "keywords": [ "template" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + }, "time": "2015-06-21T13:50:34+00:00" }, { @@ -405,6 +436,10 @@ "container", "dependency injection" ], + "support": { + "issues": "https://github.com/silexphp/Pimple/issues", + "source": "https://github.com/silexphp/Pimple/tree/master" + }, "time": "2018-01-21T07:42:36+00:00" }, { @@ -454,6 +489,10 @@ "container-interop", "psr" ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/master" + }, "time": "2017-02-14T16:28:37+00:00" }, { @@ -504,6 +543,9 @@ "request", "response" ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, "time": "2016-08-06T14:39:51+00:00" }, { @@ -551,6 +593,9 @@ "psr", "psr-3" ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.3" + }, "time": "2020-03-23T09:12:05+00:00" }, { @@ -571,6 +616,7 @@ "ext-curl": "*", "php": "~5.4 || ~7.0" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -596,20 +642,24 @@ "pubsubhubbub", "websub" ], + "support": { + "issues": "https://github.com/pubsubhubbub/php-publisher/issues", + "source": "https://github.com/pubsubhubbub/php-publisher/tree/master" + }, "time": "2018-10-09T05:20:28+00:00" }, { "name": "shaarli/netscape-bookmark-parser", - "version": "v2.1.0", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/shaarli/netscape-bookmark-parser.git", - "reference": "819008ee42c4dd7e45d988176a4a22d6ed689577" + "reference": "432a010af2bb1832d6fbc4763e6b0100b980a1df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/shaarli/netscape-bookmark-parser/zipball/819008ee42c4dd7e45d988176a4a22d6ed689577", - "reference": "819008ee42c4dd7e45d988176a4a22d6ed689577", + "url": "https://api.github.com/repos/shaarli/netscape-bookmark-parser/zipball/432a010af2bb1832d6fbc4763e6b0100b980a1df", + "reference": "432a010af2bb1832d6fbc4763e6b0100b980a1df", "shasum": "" }, "require": { @@ -649,9 +699,13 @@ "bookmark", "link", "netscape", - "parser" + "parse" ], - "time": "2018-10-06T14:43:38+00:00" + "support": { + "issues": "https://github.com/shaarli/netscape-bookmark-parser/issues", + "source": "https://github.com/shaarli/netscape-bookmark-parser/tree/v2.2.0" + }, + "time": "2020-06-06T15:53:53+00:00" }, { "name": "slim/slim", @@ -724,26 +778,30 @@ "micro", "router" ], + "support": { + "issues": "https://github.com/slimphp/Slim/issues", + "source": "https://github.com/slimphp/Slim/tree/3.x" + }, "time": "2019-11-28T17:40:33+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^6.0", @@ -782,24 +840,42 @@ "constructor", "instantiate" ], - "time": "2019-10-21T16:45:58+00:00" + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.3.x" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2020-05-29T17:27:14+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.5", + "version": "1.10.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "replace": { "myclabs/deep-copy": "self.version" @@ -830,7 +906,17 @@ "object", "object graph" ], - "time": "2020-01-17T21:11:47+00:00" + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.x" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-06-29T13:22:24+00:00" }, { "name": "phar-io/manifest", @@ -885,6 +971,10 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/master" + }, "time": "2018-07-08T19:23:20+00:00" }, { @@ -932,6 +1022,10 @@ } ], "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/master" + }, "time": "2018-07-08T19:19:57+00:00" }, { @@ -981,6 +1075,10 @@ "reflection", "static analysis" ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/master" + }, "time": "2020-04-27T09:25:28+00:00" }, { @@ -1033,6 +1131,10 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/4.x" + }, "time": "2019-12-28T18:55:12+00:00" }, { @@ -1080,6 +1182,10 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/0.7.2" + }, "time": "2019-08-22T18:11:29+00:00" }, { @@ -1143,6 +1249,10 @@ "spy", "stub" ], + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/v1.10.3" + }, "time": "2020-03-05T15:02:03+00:00" }, { @@ -1206,6 +1316,10 @@ "testing", "xunit" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" + }, "time": "2018-10-31T16:06:48+00:00" }, { @@ -1256,6 +1370,10 @@ "filesystem", "iterator" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.2" + }, "time": "2018-09-13T20:33:42+00:00" }, { @@ -1305,6 +1423,10 @@ "keywords": [ "timer" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/master" + }, "time": "2019-06-07T04:22:29+00:00" }, { @@ -1354,59 +1476,12 @@ "keywords": [ "tokenizer" ], - "time": "2019-09-17T06:23:10+00:00" - }, - { - "name": "phpunit/phpcov", - "version": "5.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpcov.git", - "reference": "72fb974e6fe9b39d7e0b0d44061d2ba4c49ee0b8" + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.1" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpcov/zipball/72fb974e6fe9b39d7e0b0d44061d2ba4c49ee0b8", - "reference": "72fb974e6fe9b39d7e0b0d44061d2ba4c49ee0b8", - "shasum": "" - }, - "require": { - "php": "^7.1", - "phpunit/php-code-coverage": "^6.0", - "phpunit/phpunit": "^7.0", - "sebastian/diff": "^3.0", - "sebastian/finder-facade": "^1.1", - "sebastian/version": "^2.0", - "symfony/console": "^3.0 || ^4.0" - }, - "bin": [ - "phpcov" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "CLI frontend for php-code-coverage", - "homepage": "https://github.com/sebastianbergmann/phpcov", - "time": "2018-02-04T10:18:50+00:00" + "abandoned": true, + "time": "2019-09-17T06:23:10+00:00" }, { "name": "phpunit/phpunit", @@ -1490,6 +1565,10 @@ "testing", "xunit" ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/7.5.20" + }, "time": "2020-01-08T08:45:45+00:00" }, { @@ -1498,12 +1577,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "5a342e2dc0408d026b97ee3176b5b406e54e3766" + "reference": "0749ceaf15c136d085b722a5bb88141398a54142" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/5a342e2dc0408d026b97ee3176b5b406e54e3766", - "reference": "5a342e2dc0408d026b97ee3176b5b406e54e3766", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/0749ceaf15c136d085b722a5bb88141398a54142", + "reference": "0749ceaf15c136d085b722a5bb88141398a54142", "shasum": "" }, "conflict": { @@ -1512,12 +1591,15 @@ "alterphp/easyadmin-extension-bundle": ">=1.2,<1.2.11|>=1.3,<1.3.1", "amphp/artax": "<1.0.6|>=2,<2.0.6", "amphp/http": "<1.0.1", + "amphp/http-client": ">=4,<4.4", "api-platform/core": ">=2.2,<2.2.10|>=2.3,<2.3.6", "asymmetricrypt/asymmetricrypt": ">=0,<9.9.99", "aws/aws-sdk-php": ">=3,<3.2.1", "bagisto/bagisto": "<0.1.5", - "barrelstrength/sprout-base-email": "<3.9", - "bolt/bolt": "<3.6.10", + "barrelstrength/sprout-base-email": "<1.2.7", + "barrelstrength/sprout-forms": "<3.9", + "baserproject/basercms": ">=4,<=4.3.6", + "bolt/bolt": "<3.7.1", "brightlocal/phpwhois": "<=4.2.5", "buddypress/buddypress": "<5.1.2", "bugsnag/bugsnag-laravel": ">=2,<2.0.2", @@ -1530,10 +1612,11 @@ "composer/composer": "<=1-alpha.11", "contao-components/mediaelement": ">=2.14.2,<2.21.1", "contao/core": ">=2,<3.5.39", - "contao/core-bundle": ">=4,<4.4.46|>=4.5,<4.8.6", + "contao/core-bundle": ">=4,<4.4.52|>=4.5,<4.9.6|= 4.10.0", "contao/listing-bundle": ">=4,<4.4.8", "datadog/dd-trace": ">=0.30,<0.30.2", "david-garcia/phpwhois": "<=4.3.1", + "derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1", "doctrine/annotations": ">=1,<1.2.7", "doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2", "doctrine/common": ">=2,<2.4.3|>=2.5,<2.5.1", @@ -1543,10 +1626,10 @@ "doctrine/mongodb-odm": ">=1,<1.0.2", "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", - "dolibarr/dolibarr": "<=10.0.6", + "dolibarr/dolibarr": "<11.0.4", "dompdf/dompdf": ">=0.6,<0.6.2", - "drupal/core": ">=7,<7.69|>=8,<8.7.12|>=8.8,<8.8.4", - "drupal/drupal": ">=7,<7.69|>=8,<8.7.12|>=8.8,<8.8.4", + "drupal/core": ">=7,<7.73|>=8,<8.8.10|>=8.9,<8.9.6|>=9,<9.0.6", + "drupal/drupal": ">=7,<7.73|>=8,<8.8.10|>=8.9,<8.9.6|>=9,<9.0.6", "endroid/qr-code-bundle": "<3.4.2", "enshrined/svg-sanitize": "<0.13.1", "erusev/parsedown": "<1.7.2", @@ -1555,10 +1638,12 @@ "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1|>=5.4,<5.4.11.1|>=2017.12,<2017.12.0.1", "ezsystems/ezplatform": ">=1.7,<1.7.9.1|>=1.13,<1.13.5.1|>=2.5,<2.5.4", "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6", - "ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2", + "ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2.1|>=5,<5.0.1|>=5.1,<5.1.1", + "ezsystems/ezplatform-kernel": ">=1,<1.0.2.1", "ezsystems/ezplatform-user": ">=1,<1.0.1", - "ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.14.1|>=6,<6.7.9.1|>=6.8,<6.13.6.2|>=7,<7.2.4.1|>=7.3,<7.3.2.1|>=7.5,<7.5.6.2", + "ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.14.2|>=6,<6.7.9.1|>=6.8,<6.13.6.3|>=7,<7.2.4.1|>=7.3,<7.3.2.1|>=7.5,<7.5.7.1", "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.6|>=5.4,<5.4.14.1|>=2011,<2017.12.7.2|>=2018.6,<2018.6.1.4|>=2018.9,<2018.9.1.3|>=2019.3,<2019.3.4.2", + "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", "ezsystems/repository-forms": ">=2.3,<2.3.2.1", "ezyang/htmlpurifier": "<4.1.1", "firebase/php-jwt": "<2", @@ -1567,14 +1652,16 @@ "friendsofsymfony/oauth2-php": "<1.3", "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", + "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", "fuel/core": "<1.8.1", "getgrav/grav": "<1.7-beta.8", + "gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3", "gree/jose": "<=2.2", "gregwar/rst": "<1.0.3", "guzzlehttp/guzzle": ">=4-rc.2,<4.2.4|>=5,<5.3.1|>=6,<6.2.1", "illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10", - "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30", - "illuminate/database": ">=4,<4.0.99|>=4.1,<4.1.29", + "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.99999|>=4.2,<=4.2.99999|>=5,<=5.0.99999|>=5.1,<=5.1.99999|>=5.2,<=5.2.99999|>=5.3,<=5.3.99999|>=5.4,<=5.4.99999|>=5.5,<=5.5.49|>=5.6,<=5.6.99999|>=5.7,<=5.7.99999|>=5.8,<=5.8.99999|>=6,<6.18.31|>=7,<7.22.4", + "illuminate/database": ">=4,<4.0.99|>=4.1,<4.1.29|>=5.5,<=5.5.44|>=6,<6.18.34|>=7,<7.23.2", "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", "illuminate/view": ">=7,<7.1.2", "ivankristianto/phpwhois": "<=4.3", @@ -1582,22 +1669,32 @@ "joomla/session": "<1.3.1", "jsmitty12/phpwhois": "<5.1", "kazist/phpwhois": "<=4.2.6", + "kitodo/presentation": "<3.1.2", "kreait/firebase-php": ">=3.2,<3.8.1", "la-haute-societe/tcpdf": "<6.2.22", - "laravel/framework": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30|>=7,<7.1.2", + "laravel/framework": ">=4,<4.0.99|>=4.1,<=4.1.99999|>=4.2,<=4.2.99999|>=5,<=5.0.99999|>=5.1,<=5.1.99999|>=5.2,<=5.2.99999|>=5.3,<=5.3.99999|>=5.4,<=5.4.99999|>=5.5,<=5.5.49|>=5.6,<=5.6.99999|>=5.7,<=5.7.99999|>=5.8,<=5.8.99999|>=6,<6.18.34|>=7,<7.23.2", "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", "league/commonmark": "<0.18.3", "librenms/librenms": "<1.53", + "livewire/livewire": ">2.2.4,<2.2.6", "magento/community-edition": ">=2,<2.2.10|>=2.3,<2.3.3", "magento/magento1ce": "<1.9.4.3", "magento/magento1ee": ">=1,<1.14.4.3", "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2", + "marcwillmann/turn": "<0.3.3", + "mittwald/typo3_forum": "<1.2.1", "monolog/monolog": ">=1.8,<1.12", "namshi/jose": "<2.2", + "nystudio107/craft-seomatic": "<3.3", "nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1", + "october/backend": ">=1.0.319,<1.0.467", + "october/cms": ">=1.0.319,<1.0.466", + "october/october": ">=1.0.319,<1.0.466", + "october/rain": ">=1.0.319,<1.0.468", "onelogin/php-saml": "<2.10.4", "oneup/uploader-bundle": "<1.9.3|>=2,<2.1.5", "openid/php-openid": "<2.3", + "openmage/magento-lts": "<19.4.6|>=20,<20.0.2", "oro/crm": ">=1.7,<1.7.4", "oro/platform": ">=1.7,<1.7.4", "padraic/humbug_get_contents": "<1.1.2", @@ -1605,8 +1702,10 @@ "paragonie/random_compat": "<2", "paypal/merchant-sdk-php": "<3.12", "pear/archive_tar": "<1.4.4", + "personnummer/personnummer": "<3.0.2", "phpfastcache/phpfastcache": ">=5,<5.0.13", - "phpmailer/phpmailer": ">=5,<5.2.27|>=6,<6.0.6", + "phpmailer/phpmailer": "<6.1.6", + "phpmussel/phpmussel": ">=1,<1.6", "phpmyadmin/phpmyadmin": "<4.9.2", "phpoffice/phpexcel": "<1.8.2", "phpoffice/phpspreadsheet": "<1.8", @@ -1615,25 +1714,30 @@ "phpxmlrpc/extras": "<0.6.1", "pimcore/pimcore": "<6.3", "prestashop/autoupgrade": ">=4,<4.10.1", + "prestashop/contactform": ">1.0.1,<4.3", "prestashop/gamification": "<2.3.2", "prestashop/ps_facetedsearch": "<3.4.1", "privatebin/privatebin": "<1.2.2|>=1.3,<1.3.2", "propel/propel": ">=2-alpha.1,<=2-alpha.7", "propel/propel1": ">=1,<=1.7.1", "pusher/pusher-php-server": "<2.2.1", + "rainlab/debugbar-plugin": "<3.1", "robrichards/xmlseclibs": "<3.0.4", + "sabberworm/php-css-parser": ">=1,<1.0.1|>=2,<2.0.1|>=3,<3.0.1|>=4,<4.0.1|>=5,<5.0.9|>=5.1,<5.1.3|>=5.2,<5.2.1|>=6,<6.0.2|>=7,<7.0.4|>=8,<8.0.1|>=8.1,<8.1.1|>=8.2,<8.2.1|>=8.3,<8.3.1", "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", "scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11", "sensiolabs/connect": "<4.2.3", "serluck/phpwhois": "<=4.2.6", + "shopware/core": "<=6.3.1", + "shopware/platform": "<=6.3.1", "shopware/shopware": "<5.3.7", "silverstripe/admin": ">=1.0.3,<1.0.4|>=1.1,<1.1.1", "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", "silverstripe/cms": "<4.3.6|>=4.4,<4.4.4", "silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1", "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", - "silverstripe/framework": "<4.4.5|>=4.5,<4.5.2", - "silverstripe/graphql": ">=2,<2.0.5|>=3,<3.1.2", + "silverstripe/framework": "<4.4.7|>=4.5,<4.5.4", + "silverstripe/graphql": ">=2,<2.0.5|>=3,<3.1.2|>=3.2,<3.2.4", "silverstripe/registry": ">=2.1,<2.1.2|>=2.2,<2.2.1", "silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4", "silverstripe/subsites": ">=2,<2.1.1", @@ -1652,11 +1756,12 @@ "ssddanbrown/bookstack": "<0.29.2", "stormpath/sdk": ">=0,<9.9.99", "studio-42/elfinder": "<2.1.49", + "sulu/sulu": "<1.6.34|>=2,<2.0.10|>=2.1,<2.1.1", "swiftmailer/swiftmailer": ">=4,<5.4.5", "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", "sylius/grid": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", "sylius/grid-bundle": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", - "sylius/resource-bundle": "<1.3.13|>=1.4,<1.4.6|>=1.5,<1.5.1|>=1.6,<1.6.3", + "sylius/resource-bundle": "<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", "sylius/sylius": "<1.3.16|>=1.4,<1.4.12|>=1.5,<1.5.9|>=1.6,<1.6.5", "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", "symbiote/silverstripe-versionedfiles": "<=2.0.3", @@ -1666,7 +1771,7 @@ "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/http-foundation": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", - "symfony/http-kernel": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8", + "symfony/http-kernel": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.4.13|>=5,<5.1.5", "symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", "symfony/mime": ">=4.3,<4.3.8", "symfony/phpunit-bridge": ">=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", @@ -1681,12 +1786,13 @@ "symfony/security-guard": ">=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", "symfony/serializer": ">=2,<2.0.11", - "symfony/symfony": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", + "symfony/symfony": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.4.13|>=5,<5.1.5", "symfony/translation": ">=2,<2.0.17", "symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3", "symfony/var-exporter": ">=4.2,<4.2.12|>=4.3,<4.3.8", "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", + "t3g/svg-sanitizer": "<1.0.3", "tecnickcom/tcpdf": "<6.2.22", "thelia/backoffice-default-template": ">=2.1,<2.1.2", "thelia/thelia": ">=2.1-beta.1,<2.1.3", @@ -1694,8 +1800,8 @@ "titon/framework": ">=0,<9.9.99", "truckersmp/phpwhois": "<=4.3.1", "twig/twig": "<1.38|>=2,<2.7", - "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.30|>=9,<9.5.17|>=10,<10.4.2", - "typo3/cms-core": ">=8,<8.7.30|>=9,<9.5.17|>=10,<10.4.2", + "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.30|>=9,<9.5.20|>=10,<10.4.6", + "typo3/cms-core": ">=8,<8.7.30|>=9,<9.5.20|>=10,<10.4.6", "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5", "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4", "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", @@ -1706,7 +1812,7 @@ "willdurand/js-translation-bundle": "<2.1.1", "yii2mod/yii2-cms": "<1.9.2", "yiisoft/yii": ">=1.1.14,<1.1.15", - "yiisoft/yii2": "<2.0.15", + "yiisoft/yii2": "<2.0.38", "yiisoft/yii2-bootstrap": "<2.0.4", "yiisoft/yii2-dev": "<2.0.15", "yiisoft/yii2-elasticsearch": "<2.0.5", @@ -1758,7 +1864,21 @@ } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", - "time": "2020-05-12T11:18:47+00:00" + "support": { + "issues": "https://github.com/Roave/SecurityAdvisories/issues", + "source": "https://github.com/Roave/SecurityAdvisories/tree/latest" + }, + "funding": [ + { + "url": "https://github.com/Ocramius", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/roave/security-advisories", + "type": "tidelift" + } + ], + "time": "2020-09-24T17:02:11+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1803,6 +1923,10 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/master" + }, "time": "2017-03-04T06:30:41+00:00" }, { @@ -1867,6 +1991,10 @@ "compare", "equality" ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/master" + }, "time": "2018-07-12T15:12:46+00:00" }, { @@ -1923,6 +2051,10 @@ "unidiff", "unified diff" ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/master" + }, "time": "2019-02-04T06:01:07+00:00" }, { @@ -1976,6 +2108,10 @@ "environment", "hhvm" ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/4.2.3" + }, "time": "2019-11-20T08:46:58+00:00" }, { @@ -2043,50 +2179,11 @@ "export", "exporter" ], - "time": "2019-09-14T09:02:43+00:00" - }, - { - "name": "sebastian/finder-facade", - "version": "1.2.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/finder-facade.git", - "reference": "167c45d131f7fc3d159f56f191a0a22228765e16" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/167c45d131f7fc3d159f56f191a0a22228765e16", - "reference": "167c45d131f7fc3d159f56f191a0a22228765e16", - "shasum": "" - }, - "require": { - "php": "^7.1", - "symfony/finder": "^2.3|^3.0|^4.0|^5.0", - "theseer/fdomdocument": "^1.6" - }, - "type": "library", - "extra": { - "branch-alias": [] - }, - "autoload": { - "classmap": [ - "src/" - ] + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/master" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", - "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2020-01-16T08:08:45+00:00" + "time": "2019-09-14T09:02:43+00:00" }, { "name": "sebastian/global-state", @@ -2137,6 +2234,10 @@ "keywords": [ "global state" ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0" + }, "time": "2017-04-27T15:39:26+00:00" }, { @@ -2184,6 +2285,10 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/master" + }, "time": "2017-08-03T12:35:26+00:00" }, { @@ -2229,6 +2334,10 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/master" + }, "time": "2017-03-29T09:07:27+00:00" }, { @@ -2282,6 +2391,10 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/master" + }, "time": "2017-03-03T06:23:57+00:00" }, { @@ -2324,6 +2437,10 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/master" + }, "time": "2018-10-04T04:07:39+00:00" }, { @@ -2367,20 +2484,24 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/master" + }, "time": "2016-10-03T07:35:21+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.5", + "version": "3.5.6", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6" + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0", + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0", "shasum": "" }, "require": { @@ -2418,145 +2539,25 @@ "phpcs", "standards" ], - "time": "2020-04-17T01:09:41+00:00" - }, - { - "name": "symfony/console", - "version": "v4.4.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "10bb3ee3c97308869d53b3e3d03f6ac23ff985f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/10bb3ee3c97308869d53b3e3d03f6ac23ff985f7", - "reference": "10bb3ee3c97308869d53b3e3d03f6ac23ff985f7", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/service-contracts": "^1.1|^2" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3|>=5", - "symfony/lock": "<4.4", - "symfony/process": "<3.3" - }, - "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/lock": "^4.4|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/var-dumper": "^4.3|^5.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2020-03-30T11:41:10+00:00" - }, - { - "name": "symfony/finder", - "version": "v4.4.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "5729f943f9854c5781984ed4907bbb817735776b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/5729f943f9854c5781984ed4907bbb817735776b", - "reference": "5729f943f9854c5781984ed4907bbb817735776b", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2020-03-27T16:54:36+00:00" + "time": "2020-08-10T04:50:15+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.17.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", "shasum": "" }, "require": { @@ -2568,7 +2569,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -2601,222 +2606,24 @@ "polyfill", "portable" ], - "time": "2020-05-12T16:14:59+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.17.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.17-dev" - } + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.18.0" }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ + "funding": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "url": "https://symfony.com/sponsor", + "type": "custom" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2020-05-12T16:47:27+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.17.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "a760d8964ff79ab9bf057613a5808284ec852ccc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a760d8964ff79ab9bf057613a5808284ec852ccc", - "reference": "a760d8964ff79ab9bf057613a5808284ec852ccc", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.17-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" + "url": "https://github.com/fabpot", + "type": "github" }, - "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 backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2020-05-12T16:47:27+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v1.1.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "psr/container": "^1.0" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } - }, - "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": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2019-10-14T12:27:06+00:00" - }, - { - "name": "theseer/fdomdocument", - "version": "1.6.6", - "source": { - "type": "git", - "url": "https://github.com/theseer/fDOMDocument.git", - "reference": "6e8203e40a32a9c770bcb62fe37e68b948da6dca" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/fDOMDocument/zipball/6e8203e40a32a9c770bcb62fe37e68b948da6dca", - "reference": "6e8203e40a32a9c770bcb62fe37e68b948da6dca", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "lib-libxml": "*", - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "lead" + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", - "homepage": "https://github.com/theseer/fDOMDocument", - "time": "2017-06-30T11:53:12+00:00" + "time": "2020-07-14T12:35:20+00:00" }, { "name": "theseer/tokenizer", @@ -2856,27 +2663,32 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/master" + }, "time": "2019-06-13T22:48:21+00:00" }, { "name": "webmozart/assert", - "version": "1.8.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6", - "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6", + "url": "https://api.github.com/repos/webmozart/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": { + "phpstan/phpstan": "<0.12.20", "vimeo/psalm": "<3.9.1" }, "require-dev": { @@ -2904,7 +2716,11 @@ "check", "validate" ], - "time": "2020-04-18T12:12:48+00:00" + "support": { + "issues": "https://github.com/webmozart/assert/issues", + "source": "https://github.com/webmozart/assert/tree/master" + }, + "time": "2020-07-08T17:02:28+00:00" } ], "aliases": [], @@ -2923,5 +2739,6 @@ "platform-dev": [], "platform-overrides": { "php": "7.1.29" - } + }, + "plugin-api-version": "2.0.0" } diff --git a/docker-compose.yml b/docker-compose.yml index e8ea4271..a3de4b1c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,7 +33,7 @@ services: traefik.frontend.rule: "Host:${SHAARLI_VIRTUAL_HOST}" traefik: - image: traefik + image: traefik:1.7-alpine command: - "--defaultentrypoints=http,https" - "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https" diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php index 421d2dd9..a232b351 100644 --- a/tests/ApplicationUtilsTest.php +++ b/tests/ApplicationUtilsTest.php @@ -8,7 +8,7 @@ require_once 'tests/utils/FakeApplicationUtils.php'; /** * Unitary tests for Shaarli utilities */ -class ApplicationUtilsTest extends \PHPUnit\Framework\TestCase +class ApplicationUtilsTest extends \Shaarli\TestCase { protected static $testUpdateFile = 'sandbox/update.txt'; protected static $testVersion = '0.5.0'; @@ -144,10 +144,10 @@ class ApplicationUtilsTest extends \PHPUnit\Framework\TestCase /** * Test update checks - invalid Git branch - * @expectedException Exception */ public function testCheckUpdateInvalidGitBranch() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Invalid branch selected for updates/'); ApplicationUtils::checkUpdate('', 'null', 0, true, true, 'unstable'); @@ -261,10 +261,10 @@ class ApplicationUtilsTest extends \PHPUnit\Framework\TestCase /** * Check a unsupported PHP version - * @expectedException Exception */ public function testCheckSupportedPHPVersion51() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Your PHP version is obsolete/'); $this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.1.0')); @@ -272,10 +272,10 @@ class ApplicationUtilsTest extends \PHPUnit\Framework\TestCase /** * Check another unsupported PHP version - * @expectedException Exception */ public function testCheckSupportedPHPVersion52() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Your PHP version is obsolete/'); $this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.2')); diff --git a/tests/FileUtilsTest.php b/tests/FileUtilsTest.php index 6e8f44f2..9163bdf1 100644 --- a/tests/FileUtilsTest.php +++ b/tests/FileUtilsTest.php @@ -9,7 +9,7 @@ use Exception; * * Test file utility class. */ -class FileUtilsTest extends \PHPUnit\Framework\TestCase +class FileUtilsTest extends \Shaarli\TestCase { /** * @var string Test file path. diff --git a/tests/HistoryTest.php b/tests/HistoryTest.php index fb633e79..6dc0e5b7 100644 --- a/tests/HistoryTest.php +++ b/tests/HistoryTest.php @@ -3,10 +3,9 @@ namespace Shaarli; use DateTime; -use Exception; use Shaarli\Bookmark\Bookmark; -class HistoryTest extends \PHPUnit\Framework\TestCase +class HistoryTest extends \Shaarli\TestCase { /** * @var string History file path diff --git a/tests/LanguagesTest.php b/tests/LanguagesTest.php index 914179c8..ce24c160 100644 --- a/tests/LanguagesTest.php +++ b/tests/LanguagesTest.php @@ -7,7 +7,7 @@ use Shaarli\Config\ConfigManager; /** * Class LanguagesTest. */ -class LanguagesTest extends \PHPUnit\Framework\TestCase +class LanguagesTest extends \Shaarli\TestCase { /** * @var string Config file path (without extension). diff --git a/tests/PluginManagerTest.php b/tests/PluginManagerTest.php index 3018999c..efef5e87 100644 --- a/tests/PluginManagerTest.php +++ b/tests/PluginManagerTest.php @@ -1,4 +1,5 @@ pluginManager->executeHooks('error', $data); - $this->assertSame( - 'test [plugin incompatibility]: Class \'Unknown\' not found', + $this->assertRegExp( + '/test \[plugin incompatibility\]: Class [\'"]Unknown[\'"] not found/', $this->pluginManager->getErrors()[0] ); } diff --git a/tests/TestCase.php b/tests/TestCase.php new file mode 100644 index 00000000..781e7aa3 --- /dev/null +++ b/tests/TestCase.php @@ -0,0 +1,77 @@ +expectExceptionMessageMatches($regularExpression); + } else { + parent::expectExceptionMessageRegExp($regularExpression); + } + } + + /** + * assertContains is now used for iterable, strings should use assertStringContainsString + */ + public function assertContainsPolyfill($expected, $actual, string $message = ''): void + { + if (is_string($actual) && method_exists($this, 'assertStringContainsString')) { + static::assertStringContainsString($expected, $actual, $message); + } else { + static::assertContains($expected, $actual, $message); + } + } + + /** + * assertNotContains is now used for iterable, strings should use assertStringNotContainsString + */ + public function assertNotContainsPolyfill($expected, $actual, string $message = ''): void + { + if (is_string($actual) && method_exists($this, 'assertStringNotContainsString')) { + static::assertStringNotContainsString($expected, $actual, $message); + } else { + static::assertNotContains($expected, $actual, $message); + } + } + + /** + * assertFileNotExists has been renamed in assertFileDoesNotExist + */ + public static function assertFileNotExists(string $filename, string $message = ''): void + { + if (method_exists(TestCase::class, 'assertFileDoesNotExist')) { + static::assertFileDoesNotExist($filename, $message); + } else { + parent::assertFileNotExists($filename, $message); + } + } + + /** + * assertRegExp has been renamed in assertMatchesRegularExpression + */ + public static function assertRegExp(string $pattern, string $string, string $message = ''): void + { + if (method_exists(TestCase::class, 'assertMatchesRegularExpression')) { + static::assertMatchesRegularExpression($pattern, $string, $message); + } else { + parent::assertRegExp($pattern, $string, $message); + } + } + + public function isInTestsContext(): bool + { + return true; + } +} diff --git a/tests/ThumbnailerTest.php b/tests/ThumbnailerTest.php index 5b6d6a4d..70519aca 100644 --- a/tests/ThumbnailerTest.php +++ b/tests/ThumbnailerTest.php @@ -2,7 +2,6 @@ namespace Shaarli; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use WebThumbnailer\Application\ConfigManager as WTConfigManager; diff --git a/tests/TimeZoneTest.php b/tests/TimeZoneTest.php index d3d9aeeb..77862855 100644 --- a/tests/TimeZoneTest.php +++ b/tests/TimeZoneTest.php @@ -8,7 +8,7 @@ require_once 'application/TimeZone.php'; /** * Unitary tests for timezone utilities */ -class TimeZoneTest extends PHPUnit\Framework\TestCase +class TimeZoneTest extends \Shaarli\TestCase { /** * @var array of timezones diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index 93b77539..6e787d7f 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php @@ -10,7 +10,7 @@ require_once 'application/Languages.php'; /** * Unitary tests for Shaarli utilities */ -class UtilsTest extends PHPUnit\Framework\TestCase +class UtilsTest extends \Shaarli\TestCase { // Log file protected static $testLogFile = 'tests.log'; diff --git a/tests/api/ApiMiddlewareTest.php b/tests/api/ApiMiddlewareTest.php index b157e4a7..86700840 100644 --- a/tests/api/ApiMiddlewareTest.php +++ b/tests/api/ApiMiddlewareTest.php @@ -18,7 +18,7 @@ use Slim\Http\Response; * * @package Api */ -class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase +class ApiMiddlewareTest extends \Shaarli\TestCase { /** * @var string datastore to test write operations @@ -26,7 +26,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase protected static $testDatastore = 'sandbox/datastore.php'; /** - * @var \ConfigManager instance + * @var ConfigManager instance */ protected $conf; @@ -66,6 +66,53 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase @unlink(self::$testDatastore); } + /** + * Invoke the middleware with a valid token + */ + public function testInvokeMiddlewareWithValidToken(): void + { + $next = function (Request $request, Response $response): Response { + return $response; + }; + $mw = new ApiMiddleware($this->container); + $env = Environment::mock([ + 'REQUEST_METHOD' => 'GET', + 'REQUEST_URI' => '/echo', + 'HTTP_AUTHORIZATION'=> 'Bearer ' . ApiUtilsTest::generateValidJwtToken('NapoleonWasALizard'), + ]); + $request = Request::createFromEnvironment($env); + $response = new Response(); + /** @var Response $response */ + $response = $mw($request, $response, $next); + + $this->assertEquals(200, $response->getStatusCode()); + } + + /** + * Invoke the middleware with a valid token + * Using specific Apache CGI redirected authorization. + */ + public function testInvokeMiddlewareWithValidTokenFromRedirectedHeader(): void + { + $next = function (Request $request, Response $response): Response { + return $response; + }; + + $token = 'Bearer ' . ApiUtilsTest::generateValidJwtToken('NapoleonWasALizard'); + $this->container->environment['REDIRECT_HTTP_AUTHORIZATION'] = $token; + $mw = new ApiMiddleware($this->container); + $env = Environment::mock([ + 'REQUEST_METHOD' => 'GET', + 'REQUEST_URI' => '/echo', + ]); + $request = Request::createFromEnvironment($env); + $response = new Response(); + /** @var Response $response */ + $response = $mw($request, $response, $next); + + $this->assertEquals(200, $response->getStatusCode()); + } + /** * Invoke the middleware with the API disabled: * should return a 401 error Unauthorized. @@ -109,7 +156,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase $this->assertEquals(401, $response->getStatusCode()); $body = json_decode((string) $response->getBody()); $this->assertEquals('Not authorized: API is disabled', $body->message); - $this->assertContains('ApiAuthorizationException', $body->stacktrace); + $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace); } /** @@ -132,7 +179,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase $this->assertEquals(401, $response->getStatusCode()); $body = json_decode((string) $response->getBody()); $this->assertEquals('Not authorized: JWT token not provided', $body->message); - $this->assertContains('ApiAuthorizationException', $body->stacktrace); + $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace); } /** @@ -157,7 +204,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase $this->assertEquals(401, $response->getStatusCode()); $body = json_decode((string) $response->getBody()); $this->assertEquals('Not authorized: Token secret must be set in Shaarli\'s administration', $body->message); - $this->assertContains('ApiAuthorizationException', $body->stacktrace); + $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace); } /** @@ -180,7 +227,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase $this->assertEquals(401, $response->getStatusCode()); $body = json_decode((string) $response->getBody()); $this->assertEquals('Not authorized: Invalid JWT header', $body->message); - $this->assertContains('ApiAuthorizationException', $body->stacktrace); + $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace); } /** @@ -206,6 +253,6 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase $this->assertEquals(401, $response->getStatusCode()); $body = json_decode((string) $response->getBody()); $this->assertEquals('Not authorized: Malformed JWT token', $body->message); - $this->assertContains('ApiAuthorizationException', $body->stacktrace); + $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace); } } diff --git a/tests/api/ApiUtilsTest.php b/tests/api/ApiUtilsTest.php index 96787014..7a143859 100644 --- a/tests/api/ApiUtilsTest.php +++ b/tests/api/ApiUtilsTest.php @@ -8,7 +8,7 @@ use Shaarli\Http\Base64Url; /** * Class ApiUtilsTest */ -class ApiUtilsTest extends \PHPUnit\Framework\TestCase +class ApiUtilsTest extends \Shaarli\TestCase { /** * Force the timezone for ISO datetimes. diff --git a/tests/api/controllers/history/HistoryTest.php b/tests/api/controllers/history/HistoryTest.php index 40f26b12..84f8716e 100644 --- a/tests/api/controllers/history/HistoryTest.php +++ b/tests/api/controllers/history/HistoryTest.php @@ -11,7 +11,7 @@ use Slim\Http\Response; require_once 'tests/utils/ReferenceHistory.php'; -class HistoryTest extends \PHPUnit\Framework\TestCase +class HistoryTest extends \Shaarli\TestCase { /** * @var string datastore to test write operations diff --git a/tests/api/controllers/info/InfoTest.php b/tests/api/controllers/info/InfoTest.php index cc50d2e3..1598e1e8 100644 --- a/tests/api/controllers/info/InfoTest.php +++ b/tests/api/controllers/info/InfoTest.php @@ -1,10 +1,10 @@ expectException(\Shaarli\Bookmark\Exception\NotWritableDataStoreException::class); $this->expectExceptionMessageRegExp('#Couldn\'t load data from the data store file "null".*#'); $conf = new ConfigManager('tests/utils/config/configJson'); @@ -748,7 +747,7 @@ class BookmarkFileServiceTest extends TestCase $link = $this->publicLinkDB->findByUrl('http://mediagoblin.org/'); $this->assertNotEquals(false, $link); - $this->assertContains( + $this->assertContainsPolyfill( 'A free software media publishing platform', $link->getDescription() ); diff --git a/tests/bookmark/BookmarkFilterTest.php b/tests/bookmark/BookmarkFilterTest.php index 752631a5..48c7f824 100644 --- a/tests/bookmark/BookmarkFilterTest.php +++ b/tests/bookmark/BookmarkFilterTest.php @@ -3,10 +3,10 @@ namespace Shaarli\Bookmark; use Exception; -use PHPUnit\Framework\TestCase; use ReferenceLinkDB; use Shaarli\Config\ConfigManager; use Shaarli\History; +use Shaarli\TestCase; /** * Class BookmarkFilterTest. @@ -212,10 +212,10 @@ class BookmarkFilterTest extends TestCase /** * Use an invalid date format - * @expectedException Exception */ public function testFilterInvalidDayWithChars() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Invalid date format/'); self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, 'Rainy day, dream away'); @@ -223,10 +223,10 @@ class BookmarkFilterTest extends TestCase /** * Use an invalid date format - * @expectedException Exception */ public function testFilterInvalidDayDigits() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Invalid date format/'); self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, '20'); diff --git a/tests/bookmark/BookmarkInitializerTest.php b/tests/bookmark/BookmarkInitializerTest.php index 454269bb..25704004 100644 --- a/tests/bookmark/BookmarkInitializerTest.php +++ b/tests/bookmark/BookmarkInitializerTest.php @@ -2,9 +2,9 @@ namespace Shaarli\Bookmark; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use Shaarli\History; +use Shaarli\TestCase; /** * Class BookmarkInitializerTest diff --git a/tests/bookmark/BookmarkTest.php b/tests/bookmark/BookmarkTest.php index 4b6a3c07..afec2440 100644 --- a/tests/bookmark/BookmarkTest.php +++ b/tests/bookmark/BookmarkTest.php @@ -2,8 +2,8 @@ namespace Shaarli\Bookmark; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Exception\InvalidBookmarkException; +use Shaarli\TestCase; /** * Class BookmarkTest @@ -150,7 +150,7 @@ class BookmarkTest extends TestCase $exception = $e; } $this->assertNotNull($exception); - $this->assertContains('- ID: '. PHP_EOL, $exception->getMessage()); + $this->assertContainsPolyfill('- ID: '. PHP_EOL, $exception->getMessage()); } /** @@ -169,7 +169,7 @@ class BookmarkTest extends TestCase $exception = $e; } $this->assertNotNull($exception); - $this->assertContains('- ID: str'. PHP_EOL, $exception->getMessage()); + $this->assertContainsPolyfill('- ID: str'. PHP_EOL, $exception->getMessage()); } /** @@ -188,7 +188,7 @@ class BookmarkTest extends TestCase $exception = $e; } $this->assertNotNull($exception); - $this->assertContains('- ShortUrl: '. PHP_EOL, $exception->getMessage()); + $this->assertContainsPolyfill('- ShortUrl: '. PHP_EOL, $exception->getMessage()); } /** @@ -207,7 +207,7 @@ class BookmarkTest extends TestCase $exception = $e; } $this->assertNotNull($exception); - $this->assertContains('- Created: '. PHP_EOL, $exception->getMessage()); + $this->assertContainsPolyfill('- Created: '. PHP_EOL, $exception->getMessage()); } /** @@ -226,7 +226,7 @@ class BookmarkTest extends TestCase $exception = $e; } $this->assertNotNull($exception); - $this->assertContains('- Created: Not a DateTime object'. PHP_EOL, $exception->getMessage()); + $this->assertContainsPolyfill('- Created: Not a DateTime object'. PHP_EOL, $exception->getMessage()); } /** diff --git a/tests/bookmark/LinkUtilsTest.php b/tests/bookmark/LinkUtilsTest.php index 0d07897b..ef00b92f 100644 --- a/tests/bookmark/LinkUtilsTest.php +++ b/tests/bookmark/LinkUtilsTest.php @@ -2,7 +2,7 @@ namespace Shaarli\Bookmark; -use PHPUnit\Framework\TestCase; +use Shaarli\TestCase; require_once 'tests/utils/CurlUtils.php'; @@ -450,13 +450,13 @@ class LinkUtilsTest extends TestCase カタカナ #カタカナ」カタカナ\n'; $autolinkedDescription = hashtag_autolink($rawDescription, $index); - $this->assertContains($this->getHashtagLink('hashtag', $index), $autolinkedDescription); - $this->assertNotContains(' #hashtag', $autolinkedDescription); - $this->assertNotContains('>#nothashtag', $autolinkedDescription); - $this->assertContains($this->getHashtagLink('ашок', $index), $autolinkedDescription); - $this->assertContains($this->getHashtagLink('カタカナ', $index), $autolinkedDescription); - $this->assertContains($this->getHashtagLink('hashtag_hashtag', $index), $autolinkedDescription); - $this->assertNotContains($this->getHashtagLink('hashtag-nothashtag', $index), $autolinkedDescription); + $this->assertContainsPolyfill($this->getHashtagLink('hashtag', $index), $autolinkedDescription); + $this->assertNotContainsPolyfill(' #hashtag', $autolinkedDescription); + $this->assertNotContainsPolyfill('>#nothashtag', $autolinkedDescription); + $this->assertContainsPolyfill($this->getHashtagLink('ашок', $index), $autolinkedDescription); + $this->assertContainsPolyfill($this->getHashtagLink('カタカナ', $index), $autolinkedDescription); + $this->assertContainsPolyfill($this->getHashtagLink('hashtag_hashtag', $index), $autolinkedDescription); + $this->assertNotContainsPolyfill($this->getHashtagLink('hashtag-nothashtag', $index), $autolinkedDescription); } /** @@ -467,9 +467,9 @@ class LinkUtilsTest extends TestCase $rawDescription = 'blabla #hashtag x#nothashtag'; $autolinkedDescription = hashtag_autolink($rawDescription); - $this->assertContains($this->getHashtagLink('hashtag'), $autolinkedDescription); - $this->assertNotContains(' #hashtag', $autolinkedDescription); - $this->assertNotContains('>#nothashtag', $autolinkedDescription); + $this->assertContainsPolyfill($this->getHashtagLink('hashtag'), $autolinkedDescription); + $this->assertNotContainsPolyfill(' #hashtag', $autolinkedDescription); + $this->assertNotContainsPolyfill('>#nothashtag', $autolinkedDescription); } /** diff --git a/tests/bootstrap.php b/tests/bootstrap.php index d4ddedd5..2d675c9a 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -18,6 +18,7 @@ require_once 'application/bookmark/LinkUtils.php'; require_once 'application/Utils.php'; require_once 'application/http/UrlUtils.php'; require_once 'application/http/HttpUtils.php'; +require_once 'tests/TestCase.php'; require_once 'tests/container/ShaarliTestContainer.php'; require_once 'tests/front/controller/visitor/FrontControllerMockHelper.php'; require_once 'tests/front/controller/admin/FrontAdminControllerMockHelper.php'; diff --git a/tests/config/ConfigJsonTest.php b/tests/config/ConfigJsonTest.php index f884b0c6..c0ba5b8f 100644 --- a/tests/config/ConfigJsonTest.php +++ b/tests/config/ConfigJsonTest.php @@ -4,7 +4,7 @@ namespace Shaarli\Config; /** * Class ConfigJsonTest */ -class ConfigJsonTest extends \PHPUnit\Framework\TestCase +class ConfigJsonTest extends \Shaarli\TestCase { /** * @var ConfigJson @@ -42,7 +42,7 @@ class ConfigJsonTest extends \PHPUnit\Framework\TestCase public function testReadInvalidJson() { $this->expectException(\Exception::class); - $this->expectExceptionMessageRegExp(' /An error occurred while parsing JSON configuration file \\([\\w\\/\\.]+\\): error code #4/'); + $this->expectExceptionMessageRegExp('/An error occurred while parsing JSON configuration file \\([\\w\\/\\.]+\\): error code #4/'); $this->configIO->read('tests/utils/config/configInvalid.json.php'); } @@ -108,17 +108,6 @@ class ConfigJsonTest extends \PHPUnit\Framework\TestCase unlink($dest); } - /** - * Write to invalid path. - */ - public function testWriteInvalidArray() - { - $this->expectException(\Shaarli\Exceptions\IOException::class); - - $conf = array('conf' => 'value'); - @$this->configIO->write(array(), $conf); - } - /** * Write to invalid path. */ diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php index 802e6524..65d8ba2c 100644 --- a/tests/config/ConfigManagerTest.php +++ b/tests/config/ConfigManagerTest.php @@ -7,7 +7,7 @@ namespace Shaarli\Config; * Note: it only test the manager with ConfigJson, * ConfigPhp is only a workaround to handle the transition to JSON type. */ -class ConfigManagerTest extends \PHPUnit\Framework\TestCase +class ConfigManagerTest extends \Shaarli\TestCase { /** * @var ConfigManager diff --git a/tests/config/ConfigPhpTest.php b/tests/config/ConfigPhpTest.php index a9aa80f5..7bf9fe64 100644 --- a/tests/config/ConfigPhpTest.php +++ b/tests/config/ConfigPhpTest.php @@ -8,7 +8,7 @@ namespace Shaarli\Config; * which are kept between tests. * @runTestsInSeparateProcesses */ -class ConfigPhpTest extends \PHPUnit\Framework\TestCase +class ConfigPhpTest extends \Shaarli\TestCase { /** * @var ConfigPhp diff --git a/tests/config/ConfigPluginTest.php b/tests/config/ConfigPluginTest.php index 3a45f623..fa72d8c4 100644 --- a/tests/config/ConfigPluginTest.php +++ b/tests/config/ConfigPluginTest.php @@ -9,7 +9,7 @@ require_once 'application/config/ConfigPlugin.php'; /** * Unitary tests for Shaarli config related functions */ -class ConfigPluginTest extends \PHPUnit\Framework\TestCase +class ConfigPluginTest extends \Shaarli\TestCase { /** * Test save_plugin_config with valid data. diff --git a/tests/container/ContainerBuilderTest.php b/tests/container/ContainerBuilderTest.php index 2047a63a..5d52daef 100644 --- a/tests/container/ContainerBuilderTest.php +++ b/tests/container/ContainerBuilderTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Shaarli\Container; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\BookmarkServiceInterface; use Shaarli\Config\ConfigManager; use Shaarli\Feed\FeedBuilder; @@ -20,6 +19,7 @@ use Shaarli\Render\PageCacheManager; use Shaarli\Security\CookieManager; use Shaarli\Security\LoginManager; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Shaarli\Thumbnailer; use Shaarli\Updater\Updater; use Slim\Http\Environment; diff --git a/tests/feed/CachedPageTest.php b/tests/feed/CachedPageTest.php index 25d640d3..904db9dc 100644 --- a/tests/feed/CachedPageTest.php +++ b/tests/feed/CachedPageTest.php @@ -7,7 +7,7 @@ namespace Shaarli\Feed; /** * Unitary tests for cached pages */ -class CachedPageTest extends \PHPUnit\Framework\TestCase +class CachedPageTest extends \Shaarli\TestCase { // test cache directory protected static $testCacheDir = 'sandbox/pagecache'; diff --git a/tests/feed/FeedBuilderTest.php b/tests/feed/FeedBuilderTest.php index 5dfe73aa..c29e8ef3 100644 --- a/tests/feed/FeedBuilderTest.php +++ b/tests/feed/FeedBuilderTest.php @@ -3,7 +3,6 @@ namespace Shaarli\Feed; use DateTime; -use PHPUnit\Framework\TestCase; use ReferenceLinkDB; use Shaarli\Bookmark\Bookmark; use Shaarli\Bookmark\BookmarkFileService; @@ -11,6 +10,7 @@ use Shaarli\Bookmark\LinkDB; use Shaarli\Config\ConfigManager; use Shaarli\Formatter\FormatterFactory; use Shaarli\History; +use Shaarli\TestCase; /** * FeedBuilderTest class. @@ -97,9 +97,9 @@ class FeedBuilderTest extends TestCase $pub = DateTime::createFromFormat(DateTime::RSS, $link['pub_iso_date']); $up = DateTime::createFromFormat(DateTime::ATOM, $link['up_iso_date']); $this->assertEquals($pub, $up); - $this->assertContains('Stallman has a beard', $link['description']); - $this->assertContains('Permalink', $link['description']); - $this->assertContains('http://host.tld/shaare/WDWyig', $link['description']); + $this->assertContainsPolyfill('Stallman has a beard', $link['description']); + $this->assertContainsPolyfill('Permalink', $link['description']); + $this->assertContainsPolyfill('http://host.tld/shaare/WDWyig', $link['description']); $this->assertEquals(1, count($link['taglist'])); $this->assertEquals('sTuff', $link['taglist'][0]); @@ -201,16 +201,16 @@ class FeedBuilderTest extends TestCase $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); $this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']); $this->assertEquals('http://host.tld/shaare/WDWyig', $link['url']); - $this->assertContains('Direct link', $link['description']); - $this->assertContains('http://host.tld/shaare/WDWyig', $link['description']); + $this->assertContainsPolyfill('Direct link', $link['description']); + $this->assertContainsPolyfill('http://host.tld/shaare/WDWyig', $link['description']); // Second link is a direct link $link = $data['links'][array_keys($data['links'])[1]]; $this->assertEquals(8, $link['id']); $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'), $link['created']); $this->assertEquals('http://host.tld/shaare/RttfEw', $link['guid']); $this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['url']); - $this->assertContains('Direct link', $link['description']); - $this->assertContains('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['description']); + $this->assertContainsPolyfill('Direct link', $link['description']); + $this->assertContainsPolyfill('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['description']); } /** @@ -274,6 +274,6 @@ class FeedBuilderTest extends TestCase $link = $data['links'][array_keys($data['links'])[0]]; $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['guid']); $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['url']); - $this->assertContains('http://host.tld:8080/~user/shaarli/./add-tag/hashtag', $link['description']); + $this->assertContainsPolyfill('http://host.tld:8080/~user/shaarli/./add-tag/hashtag', $link['description']); } } diff --git a/tests/formatter/BookmarkDefaultFormatterTest.php b/tests/formatter/BookmarkDefaultFormatterTest.php index 9ea86c14..9534436e 100644 --- a/tests/formatter/BookmarkDefaultFormatterTest.php +++ b/tests/formatter/BookmarkDefaultFormatterTest.php @@ -3,9 +3,9 @@ namespace Shaarli\Formatter; use DateTime; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Config\ConfigManager; +use Shaarli\TestCase; /** * Class BookmarkDefaultFormatterTest diff --git a/tests/formatter/BookmarkMarkdownFormatterTest.php b/tests/formatter/BookmarkMarkdownFormatterTest.php index a7729416..ab6b4080 100644 --- a/tests/formatter/BookmarkMarkdownFormatterTest.php +++ b/tests/formatter/BookmarkMarkdownFormatterTest.php @@ -3,9 +3,9 @@ namespace Shaarli\Formatter; use DateTime; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Config\ConfigManager; +use Shaarli\TestCase; /** * Class BookmarkMarkdownFormatterTest diff --git a/tests/formatter/BookmarkRawFormatterTest.php b/tests/formatter/BookmarkRawFormatterTest.php index 76cf1172..c76bb7b9 100644 --- a/tests/formatter/BookmarkRawFormatterTest.php +++ b/tests/formatter/BookmarkRawFormatterTest.php @@ -3,9 +3,9 @@ namespace Shaarli\Formatter; use DateTime; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Config\ConfigManager; +use Shaarli\TestCase; /** * Class BookmarkRawFormatterTest diff --git a/tests/formatter/FormatterFactoryTest.php b/tests/formatter/FormatterFactoryTest.php index 6aab6a61..ae476cb5 100644 --- a/tests/formatter/FormatterFactoryTest.php +++ b/tests/formatter/FormatterFactoryTest.php @@ -2,8 +2,8 @@ namespace Shaarli\Formatter; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; +use Shaarli\TestCase; /** * Class FormatterFactoryTest diff --git a/tests/front/ShaarliAdminMiddlewareTest.php b/tests/front/ShaarliAdminMiddlewareTest.php index 7451330b..44025f11 100644 --- a/tests/front/ShaarliAdminMiddlewareTest.php +++ b/tests/front/ShaarliAdminMiddlewareTest.php @@ -4,10 +4,10 @@ declare(strict_types=1); namespace Shaarli\Front; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use Shaarli\Container\ShaarliContainer; use Shaarli\Security\LoginManager; +use Shaarli\TestCase; use Shaarli\Updater\Updater; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/ShaarliMiddlewareTest.php b/tests/front/ShaarliMiddlewareTest.php index 05aa34a9..655c5bba 100644 --- a/tests/front/ShaarliMiddlewareTest.php +++ b/tests/front/ShaarliMiddlewareTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Shaarli\Front; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use Shaarli\Container\ShaarliContainer; use Shaarli\Front\Exception\LoginBannedException; @@ -12,6 +11,7 @@ use Shaarli\Front\Exception\UnauthorizedException; use Shaarli\Render\PageBuilder; use Shaarli\Render\PageCacheManager; use Shaarli\Security\LoginManager; +use Shaarli\TestCase; use Shaarli\Updater\Updater; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/ConfigureControllerTest.php b/tests/front/controller/admin/ConfigureControllerTest.php index 612f20f1..aca6cff3 100644 --- a/tests/front/controller/admin/ConfigureControllerTest.php +++ b/tests/front/controller/admin/ConfigureControllerTest.php @@ -4,10 +4,10 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use Shaarli\Front\Exception\WrongTokenException; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Shaarli\Thumbnailer; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/ExportControllerTest.php b/tests/front/controller/admin/ExportControllerTest.php index 12d26f4a..0e6f2762 100644 --- a/tests/front/controller/admin/ExportControllerTest.php +++ b/tests/front/controller/admin/ExportControllerTest.php @@ -4,12 +4,12 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Formatter\BookmarkFormatter; use Shaarli\Formatter\BookmarkRawFormatter; use Shaarli\Netscape\NetscapeBookmarkUtils; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/ImportControllerTest.php b/tests/front/controller/admin/ImportControllerTest.php index eb31fad0..c266caa5 100644 --- a/tests/front/controller/admin/ImportControllerTest.php +++ b/tests/front/controller/admin/ImportControllerTest.php @@ -4,10 +4,10 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; use Psr\Http\Message\UploadedFileInterface; use Shaarli\Netscape\NetscapeBookmarkUtils; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; use Slim\Http\UploadedFile; diff --git a/tests/front/controller/admin/LogoutControllerTest.php b/tests/front/controller/admin/LogoutControllerTest.php index 45e84dc0..94e53019 100644 --- a/tests/front/controller/admin/LogoutControllerTest.php +++ b/tests/front/controller/admin/LogoutControllerTest.php @@ -4,10 +4,9 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; use Shaarli\Security\CookieManager; -use Shaarli\Security\LoginManager; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/ManageShaareControllerTest/AddShaareTest.php b/tests/front/controller/admin/ManageShaareControllerTest/AddShaareTest.php index 7d5b752a..0f27ec2f 100644 --- a/tests/front/controller/admin/ManageShaareControllerTest/AddShaareTest.php +++ b/tests/front/controller/admin/ManageShaareControllerTest/AddShaareTest.php @@ -4,10 +4,10 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; -use PHPUnit\Framework\TestCase; use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; use Shaarli\Front\Controller\Admin\ManageShaareController; use Shaarli\Http\HttpAccess; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/ManageShaareControllerTest/ChangeVisibilityBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/ChangeVisibilityBookmarkTest.php index 5a615791..096d0774 100644 --- a/tests/front/controller/admin/ManageShaareControllerTest/ChangeVisibilityBookmarkTest.php +++ b/tests/front/controller/admin/ManageShaareControllerTest/ChangeVisibilityBookmarkTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Bookmark\Exception\BookmarkNotFoundException; use Shaarli\Formatter\BookmarkFormatter; @@ -14,6 +13,7 @@ use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; use Shaarli\Front\Controller\Admin\ManageShaareController; use Shaarli\Http\HttpAccess; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php index dee622bb..ba774e21 100644 --- a/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php +++ b/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Bookmark\Exception\BookmarkNotFoundException; use Shaarli\Formatter\BookmarkFormatter; @@ -13,6 +12,7 @@ use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; use Shaarli\Front\Controller\Admin\ManageShaareController; use Shaarli\Http\HttpAccess; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/ManageShaareControllerTest/DisplayCreateFormTest.php b/tests/front/controller/admin/ManageShaareControllerTest/DisplayCreateFormTest.php index 777583d5..2eb95251 100644 --- a/tests/front/controller/admin/ManageShaareControllerTest/DisplayCreateFormTest.php +++ b/tests/front/controller/admin/ManageShaareControllerTest/DisplayCreateFormTest.php @@ -4,12 +4,12 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Config\ConfigManager; use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; use Shaarli\Front\Controller\Admin\ManageShaareController; use Shaarli\Http\HttpAccess; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; @@ -96,12 +96,14 @@ class DisplayCreateFormTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_editlink'], ['render_includes']) ->willReturnCallback(function (string $hook, array $data) use ($remoteTitle, $remoteDesc): array { - static::assertSame('render_editlink', $hook); - static::assertSame($remoteTitle, $data['link']['title']); - static::assertSame($remoteDesc, $data['link']['description']); + if ('render_editlink' === $hook) { + static::assertSame($remoteTitle, $data['link']['title']); + static::assertSame($remoteDesc, $data['link']['description']); + } return $data; }) diff --git a/tests/front/controller/admin/ManageShaareControllerTest/DisplayEditFormTest.php b/tests/front/controller/admin/ManageShaareControllerTest/DisplayEditFormTest.php index 1a1cdcf3..2dc3f41c 100644 --- a/tests/front/controller/admin/ManageShaareControllerTest/DisplayEditFormTest.php +++ b/tests/front/controller/admin/ManageShaareControllerTest/DisplayEditFormTest.php @@ -4,13 +4,13 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Bookmark\Exception\BookmarkNotFoundException; use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; use Shaarli\Front\Controller\Admin\ManageShaareController; use Shaarli\Http\HttpAccess; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/ManageShaareControllerTest/PinBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/PinBookmarkTest.php index 1607b475..50ce7df1 100644 --- a/tests/front/controller/admin/ManageShaareControllerTest/PinBookmarkTest.php +++ b/tests/front/controller/admin/ManageShaareControllerTest/PinBookmarkTest.php @@ -4,13 +4,13 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Bookmark\Exception\BookmarkNotFoundException; use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; use Shaarli\Front\Controller\Admin\ManageShaareController; use Shaarli\Http\HttpAccess; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php index a5e2dbc5..f7a68226 100644 --- a/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php +++ b/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin\ManageShaareControllerTest; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Config\ConfigManager; use Shaarli\Front\Controller\Admin\FrontAdminControllerMockHelper; @@ -12,6 +11,7 @@ use Shaarli\Front\Controller\Admin\ManageShaareController; use Shaarli\Front\Exception\WrongTokenException; use Shaarli\Http\HttpAccess; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Shaarli\Thumbnailer; use Slim\Http\Request; use Slim\Http\Response; @@ -88,17 +88,18 @@ class SaveBookmarkTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['save_link']) ->willReturnCallback(function (string $hook, array $data) use ($parameters, $id): array { - static::assertSame('save_link', $hook); - - static::assertSame($id, $data['id']); - static::assertSame($parameters['lf_url'], $data['url']); - static::assertSame($parameters['lf_title'], $data['title']); - static::assertSame($parameters['lf_description'], $data['description']); - static::assertSame($parameters['lf_tags'], $data['tags']); - static::assertTrue($data['private']); + if ('save_link' === $hook) { + static::assertSame($id, $data['id']); + static::assertSame($parameters['lf_url'], $data['url']); + static::assertSame($parameters['lf_title'], $data['title']); + static::assertSame($parameters['lf_description'], $data['description']); + static::assertSame($parameters['lf_tags'], $data['tags']); + static::assertTrue($data['private']); + } return $data; }) @@ -174,17 +175,18 @@ class SaveBookmarkTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['save_link']) ->willReturnCallback(function (string $hook, array $data) use ($parameters, $id): array { - static::assertSame('save_link', $hook); - - static::assertSame($id, $data['id']); - static::assertSame($parameters['lf_url'], $data['url']); - static::assertSame($parameters['lf_title'], $data['title']); - static::assertSame($parameters['lf_description'], $data['description']); - static::assertSame($parameters['lf_tags'], $data['tags']); - static::assertTrue($data['private']); + if ('save_link' === $hook) { + static::assertSame($id, $data['id']); + static::assertSame($parameters['lf_url'], $data['url']); + static::assertSame($parameters['lf_title'], $data['title']); + static::assertSame($parameters['lf_description'], $data['description']); + static::assertSame($parameters['lf_tags'], $data['tags']); + static::assertTrue($data['private']); + } return $data; }) diff --git a/tests/front/controller/admin/ManageTagControllerTest.php b/tests/front/controller/admin/ManageTagControllerTest.php index 09ba0b4b..8a0ff7a9 100644 --- a/tests/front/controller/admin/ManageTagControllerTest.php +++ b/tests/front/controller/admin/ManageTagControllerTest.php @@ -4,11 +4,11 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Bookmark\BookmarkFilter; use Shaarli\Front\Exception\WrongTokenException; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/PasswordControllerTest.php b/tests/front/controller/admin/PasswordControllerTest.php index 9a01089e..58f47b49 100644 --- a/tests/front/controller/admin/PasswordControllerTest.php +++ b/tests/front/controller/admin/PasswordControllerTest.php @@ -4,11 +4,11 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use Shaarli\Front\Exception\OpenShaarliPasswordException; use Shaarli\Front\Exception\WrongTokenException; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/PluginsControllerTest.php b/tests/front/controller/admin/PluginsControllerTest.php index 9526474c..974d614d 100644 --- a/tests/front/controller/admin/PluginsControllerTest.php +++ b/tests/front/controller/admin/PluginsControllerTest.php @@ -4,11 +4,11 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use Shaarli\Front\Exception\WrongTokenException; use Shaarli\Plugin\PluginManager; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/SessionFilterControllerTest.php b/tests/front/controller/admin/SessionFilterControllerTest.php index c4253167..712a625b 100644 --- a/tests/front/controller/admin/SessionFilterControllerTest.php +++ b/tests/front/controller/admin/SessionFilterControllerTest.php @@ -4,9 +4,9 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; use Shaarli\Security\LoginManager; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/ShaarliAdminControllerTest.php b/tests/front/controller/admin/ShaarliAdminControllerTest.php index fff427cb..486d5d2d 100644 --- a/tests/front/controller/admin/ShaarliAdminControllerTest.php +++ b/tests/front/controller/admin/ShaarliAdminControllerTest.php @@ -4,9 +4,9 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; use Shaarli\Front\Exception\WrongTokenException; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; /** diff --git a/tests/front/controller/admin/ThumbnailsControllerTest.php b/tests/front/controller/admin/ThumbnailsControllerTest.php index 0c0c8a83..f4a8acff 100644 --- a/tests/front/controller/admin/ThumbnailsControllerTest.php +++ b/tests/front/controller/admin/ThumbnailsControllerTest.php @@ -4,9 +4,9 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Bookmark\Exception\BookmarkNotFoundException; +use Shaarli\TestCase; use Shaarli\Thumbnailer; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/TokenControllerTest.php b/tests/front/controller/admin/TokenControllerTest.php index 04b0c0fa..d2f0907f 100644 --- a/tests/front/controller/admin/TokenControllerTest.php +++ b/tests/front/controller/admin/TokenControllerTest.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/admin/ToolsControllerTest.php b/tests/front/controller/admin/ToolsControllerTest.php index 39144d2f..e82f8b14 100644 --- a/tests/front/controller/admin/ToolsControllerTest.php +++ b/tests/front/controller/admin/ToolsControllerTest.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Admin; -use PHPUnit\Framework\TestCase; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/visitor/BookmarkListControllerTest.php b/tests/front/controller/visitor/BookmarkListControllerTest.php index 5daaa2c4..0c95df97 100644 --- a/tests/front/controller/visitor/BookmarkListControllerTest.php +++ b/tests/front/controller/visitor/BookmarkListControllerTest.php @@ -4,11 +4,11 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Bookmark\Exception\BookmarkNotFoundException; use Shaarli\Config\ConfigManager; use Shaarli\Security\LoginManager; +use Shaarli\TestCase; use Shaarli\Thumbnailer; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/visitor/DailyControllerTest.php b/tests/front/controller/visitor/DailyControllerTest.php index cb5b96f3..fc78bc13 100644 --- a/tests/front/controller/visitor/DailyControllerTest.php +++ b/tests/front/controller/visitor/DailyControllerTest.php @@ -4,9 +4,9 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Feed\CachedPage; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; @@ -78,19 +78,20 @@ class DailyControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_daily']) ->willReturnCallback(function (string $hook, array $data, array $param) use ($currentDay): array { - static::assertSame('render_daily', $hook); + if ('render_daily' === $hook) { + static::assertArrayHasKey('linksToDisplay', $data); + static::assertCount(3, $data['linksToDisplay']); + static::assertSame(1, $data['linksToDisplay'][0]['id']); + static::assertSame($currentDay->getTimestamp(), $data['day']); + static::assertSame('20200510', $data['previousday']); + static::assertSame('20200516', $data['nextday']); - static::assertArrayHasKey('linksToDisplay', $data); - static::assertCount(3, $data['linksToDisplay']); - static::assertSame(1, $data['linksToDisplay'][0]['id']); - static::assertSame($currentDay->getTimestamp(), $data['day']); - static::assertSame('20200510', $data['previousday']); - static::assertSame('20200516', $data['nextday']); - - static::assertArrayHasKey('loggedin', $param); + static::assertArrayHasKey('loggedin', $param); + } return $data; }) @@ -203,19 +204,20 @@ class DailyControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_daily']) ->willReturnCallback(function (string $hook, array $data, array $param) use ($currentDay): array { - static::assertSame('render_daily', $hook); - - static::assertArrayHasKey('linksToDisplay', $data); - static::assertCount(1, $data['linksToDisplay']); - static::assertSame(1, $data['linksToDisplay'][0]['id']); - static::assertSame($currentDay->getTimestamp(), $data['day']); - static::assertEmpty($data['previousday']); - static::assertEmpty($data['nextday']); + if ('render_daily' === $hook) { + static::assertArrayHasKey('linksToDisplay', $data); + static::assertCount(1, $data['linksToDisplay']); + static::assertSame(1, $data['linksToDisplay'][0]['id']); + static::assertSame($currentDay->getTimestamp(), $data['day']); + static::assertEmpty($data['previousday']); + static::assertEmpty($data['nextday']); - static::assertArrayHasKey('loggedin', $param); + static::assertArrayHasKey('loggedin', $param); + } return $data; }); @@ -281,7 +283,7 @@ class DailyControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') ->willReturnCallback(function (string $hook, array $data, array $param): array { return $data; @@ -333,7 +335,7 @@ class DailyControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') ->willReturnCallback(function (string $hook, array $data, array $param): array { return $data; diff --git a/tests/front/controller/visitor/ErrorControllerTest.php b/tests/front/controller/visitor/ErrorControllerTest.php index e497bfef..75408cf4 100644 --- a/tests/front/controller/visitor/ErrorControllerTest.php +++ b/tests/front/controller/visitor/ErrorControllerTest.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; use Shaarli\Front\Exception\ShaarliFrontException; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/visitor/ErrorNotFoundControllerTest.php b/tests/front/controller/visitor/ErrorNotFoundControllerTest.php index 625467b1..a1cbbecf 100644 --- a/tests/front/controller/visitor/ErrorNotFoundControllerTest.php +++ b/tests/front/controller/visitor/ErrorNotFoundControllerTest.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; use Slim\Http\Uri; diff --git a/tests/front/controller/visitor/FeedControllerTest.php b/tests/front/controller/visitor/FeedControllerTest.php index 0a6b577f..4ae7c925 100644 --- a/tests/front/controller/visitor/FeedControllerTest.php +++ b/tests/front/controller/visitor/FeedControllerTest.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; use Shaarli\Feed\FeedBuilder; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; @@ -45,14 +45,16 @@ class FeedControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_feed']) ->willReturnCallback(function (string $hook, array $data, array $param): void { - static::assertSame('render_feed', $hook); - static::assertSame('data', $data['content']); + if ('render_feed' === $hook) { + static::assertSame('data', $data['content']); - static::assertArrayHasKey('loggedin', $param); - static::assertSame('feed.rss', $param['target']); + static::assertArrayHasKey('loggedin', $param); + static::assertSame('feed.rss', $param['target']); + } }) ; @@ -84,14 +86,16 @@ class FeedControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_feed']) ->willReturnCallback(function (string $hook, array $data, array $param): void { - static::assertSame('render_feed', $hook); - static::assertSame('data', $data['content']); + if ('render_feed' === $hook) { + static::assertSame('data', $data['content']); - static::assertArrayHasKey('loggedin', $param); - static::assertSame('feed.atom', $param['target']); + static::assertArrayHasKey('loggedin', $param); + static::assertSame('feed.atom', $param['target']); + } }) ; @@ -124,14 +128,16 @@ class FeedControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_feed']) ->willReturnCallback(function (string $hook, array $data, array $param): void { - static::assertSame('render_feed', $hook); - static::assertSame('data', $data['content']); + if ('render_feed' === $hook) { + static::assertSame('data', $data['content']); - static::assertArrayHasKey('loggedin', $param); - static::assertSame('feed.atom', $param['target']); + static::assertArrayHasKey('loggedin', $param); + static::assertSame('feed.atom', $param['target']); + } }) ; diff --git a/tests/front/controller/visitor/FrontControllerMockHelper.php b/tests/front/controller/visitor/FrontControllerMockHelper.php index 6c53289b..fc0bb7d1 100644 --- a/tests/front/controller/visitor/FrontControllerMockHelper.php +++ b/tests/front/controller/visitor/FrontControllerMockHelper.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\MockObject\MockObject; use Shaarli\Bookmark\BookmarkServiceInterface; use Shaarli\Config\ConfigManager; use Shaarli\Container\ShaarliTestContainer; @@ -115,5 +114,5 @@ trait FrontControllerMockHelper /** * Force to be used in PHPUnit context. */ - protected abstract function createMock($originalClassName): MockObject; + protected abstract function isInTestsContext(): bool; } diff --git a/tests/front/controller/visitor/InstallControllerTest.php b/tests/front/controller/visitor/InstallControllerTest.php index 994d3f33..345ad544 100644 --- a/tests/front/controller/visitor/InstallControllerTest.php +++ b/tests/front/controller/visitor/InstallControllerTest.php @@ -4,10 +4,10 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use Shaarli\Front\Exception\AlreadyInstalledException; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/visitor/LoginControllerTest.php b/tests/front/controller/visitor/LoginControllerTest.php index 0a21f938..1312ccb7 100644 --- a/tests/front/controller/visitor/LoginControllerTest.php +++ b/tests/front/controller/visitor/LoginControllerTest.php @@ -4,13 +4,13 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; use Shaarli\Config\ConfigManager; use Shaarli\Front\Exception\LoginBannedException; use Shaarli\Front\Exception\WrongTokenException; use Shaarli\Render\TemplatePage; use Shaarli\Security\CookieManager; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/visitor/OpenSearchControllerTest.php b/tests/front/controller/visitor/OpenSearchControllerTest.php index 9609a377..42d876c3 100644 --- a/tests/front/controller/visitor/OpenSearchControllerTest.php +++ b/tests/front/controller/visitor/OpenSearchControllerTest.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/visitor/PictureWallControllerTest.php b/tests/front/controller/visitor/PictureWallControllerTest.php index 3dc3f292..b868231d 100644 --- a/tests/front/controller/visitor/PictureWallControllerTest.php +++ b/tests/front/controller/visitor/PictureWallControllerTest.php @@ -4,10 +4,10 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Config\ConfigManager; use Shaarli\Front\Exception\ThumbnailsDisabledException; +use Shaarli\TestCase; use Shaarli\Thumbnailer; use Slim\Http\Request; use Slim\Http\Response; @@ -67,15 +67,17 @@ class PictureWallControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_picwall']) ->willReturnCallback(function (string $hook, array $data, array $param): array { - static::assertSame('render_picwall', $hook); - static::assertArrayHasKey('linksToDisplay', $data); - static::assertCount(2, $data['linksToDisplay']); - static::assertSame(1, $data['linksToDisplay'][0]['id']); - static::assertSame(3, $data['linksToDisplay'][1]['id']); - static::assertArrayHasKey('loggedin', $param); + if ('render_picwall' === $hook) { + static::assertArrayHasKey('linksToDisplay', $data); + static::assertCount(2, $data['linksToDisplay']); + static::assertSame(1, $data['linksToDisplay'][0]['id']); + static::assertSame(3, $data['linksToDisplay'][1]['id']); + static::assertArrayHasKey('loggedin', $param); + } return $data; }); diff --git a/tests/front/controller/visitor/PublicSessionFilterControllerTest.php b/tests/front/controller/visitor/PublicSessionFilterControllerTest.php index b45fbe53..7e3b00af 100644 --- a/tests/front/controller/visitor/PublicSessionFilterControllerTest.php +++ b/tests/front/controller/visitor/PublicSessionFilterControllerTest.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/visitor/ShaarliVisitorControllerTest.php b/tests/front/controller/visitor/ShaarliVisitorControllerTest.php index 00188c02..935ec24e 100644 --- a/tests/front/controller/visitor/ShaarliVisitorControllerTest.php +++ b/tests/front/controller/visitor/ShaarliVisitorControllerTest.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\BookmarkFilter; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/front/controller/visitor/TagCloudControllerTest.php b/tests/front/controller/visitor/TagCloudControllerTest.php index 9a6a4bc0..9305612e 100644 --- a/tests/front/controller/visitor/TagCloudControllerTest.php +++ b/tests/front/controller/visitor/TagCloudControllerTest.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\BookmarkFilter; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; @@ -53,14 +53,16 @@ class TagCloudControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_tagcloud']) ->willReturnCallback(function (string $hook, array $data, array $param): array { - static::assertSame('render_tagcloud', $hook); - static::assertSame('', $data['search_tags']); - static::assertCount(3, $data['tags']); + if ('render_tagcloud' === $hook) { + static::assertSame('', $data['search_tags']); + static::assertCount(3, $data['tags']); - static::assertArrayHasKey('loggedin', $param); + static::assertArrayHasKey('loggedin', $param); + } return $data; }) @@ -124,14 +126,16 @@ class TagCloudControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_tagcloud']) ->willReturnCallback(function (string $hook, array $data, array $param): array { - static::assertSame('render_tagcloud', $hook); - static::assertSame('ghi def', $data['search_tags']); - static::assertCount(1, $data['tags']); + if ('render_tagcloud' === $hook) { + static::assertSame('ghi def', $data['search_tags']); + static::assertCount(1, $data['tags']); - static::assertArrayHasKey('loggedin', $param); + static::assertArrayHasKey('loggedin', $param); + } return $data; }) @@ -175,14 +179,16 @@ class TagCloudControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_tagcloud']) ->willReturnCallback(function (string $hook, array $data, array $param): array { - static::assertSame('render_tagcloud', $hook); - static::assertSame('', $data['search_tags']); - static::assertCount(0, $data['tags']); + if ('render_tagcloud' === $hook) { + static::assertSame('', $data['search_tags']); + static::assertCount(0, $data['tags']); - static::assertArrayHasKey('loggedin', $param); + static::assertArrayHasKey('loggedin', $param); + } return $data; }) @@ -227,14 +233,16 @@ class TagCloudControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_taglist']) ->willReturnCallback(function (string $hook, array $data, array $param): array { - static::assertSame('render_taglist', $hook); - static::assertSame('', $data['search_tags']); - static::assertCount(3, $data['tags']); + if ('render_taglist' === $hook) { + static::assertSame('', $data['search_tags']); + static::assertCount(3, $data['tags']); - static::assertArrayHasKey('loggedin', $param); + static::assertArrayHasKey('loggedin', $param); + } return $data; }) @@ -297,14 +305,16 @@ class TagCloudControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_taglist']) ->willReturnCallback(function (string $hook, array $data, array $param): array { - static::assertSame('render_taglist', $hook); - static::assertSame('ghi def', $data['search_tags']); - static::assertCount(1, $data['tags']); + if ('render_taglist' === $hook) { + static::assertSame('ghi def', $data['search_tags']); + static::assertCount(1, $data['tags']); - static::assertArrayHasKey('loggedin', $param); + static::assertArrayHasKey('loggedin', $param); + } return $data; }) @@ -344,14 +354,16 @@ class TagCloudControllerTest extends TestCase // Make sure that PluginManager hook is triggered $this->container->pluginManager - ->expects(static::at(0)) + ->expects(static::atLeastOnce()) ->method('executeHooks') + ->withConsecutive(['render_taglist']) ->willReturnCallback(function (string $hook, array $data, array $param): array { - static::assertSame('render_taglist', $hook); - static::assertSame('', $data['search_tags']); - static::assertCount(0, $data['tags']); + if ('render_taglist' === $hook) { + static::assertSame('', $data['search_tags']); + static::assertCount(0, $data['tags']); - static::assertArrayHasKey('loggedin', $param); + static::assertArrayHasKey('loggedin', $param); + } return $data; }) diff --git a/tests/front/controller/visitor/TagControllerTest.php b/tests/front/controller/visitor/TagControllerTest.php index 43076086..750ea02d 100644 --- a/tests/front/controller/visitor/TagControllerTest.php +++ b/tests/front/controller/visitor/TagControllerTest.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shaarli\Front\Controller\Visitor; -use PHPUnit\Framework\TestCase; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/http/HttpUtils/ClientIpIdTest.php b/tests/http/HttpUtils/ClientIpIdTest.php index 982e57e0..3a0fcf30 100644 --- a/tests/http/HttpUtils/ClientIpIdTest.php +++ b/tests/http/HttpUtils/ClientIpIdTest.php @@ -10,7 +10,7 @@ require_once 'application/http/HttpUtils.php'; /** * Unitary tests for client_ip_id() */ -class ClientIpIdTest extends \PHPUnit\Framework\TestCase +class ClientIpIdTest extends \Shaarli\TestCase { /** * Get a remote client ID based on its IP diff --git a/tests/http/HttpUtils/GetHttpUrlTest.php b/tests/http/HttpUtils/GetHttpUrlTest.php index 3dc5bc9b..a868ac02 100644 --- a/tests/http/HttpUtils/GetHttpUrlTest.php +++ b/tests/http/HttpUtils/GetHttpUrlTest.php @@ -10,7 +10,7 @@ require_once 'application/http/HttpUtils.php'; /** * Unitary tests for get_http_response() */ -class GetHttpUrlTest extends \PHPUnit\Framework\TestCase +class GetHttpUrlTest extends \Shaarli\TestCase { /** * Get an invalid local URL diff --git a/tests/http/HttpUtils/GetIpAdressFromProxyTest.php b/tests/http/HttpUtils/GetIpAdressFromProxyTest.php index fe3a639e..60cdb992 100644 --- a/tests/http/HttpUtils/GetIpAdressFromProxyTest.php +++ b/tests/http/HttpUtils/GetIpAdressFromProxyTest.php @@ -7,7 +7,7 @@ require_once 'application/http/HttpUtils.php'; /** * Unitary tests for getIpAddressFromProxy() */ -class GetIpAdressFromProxyTest extends \PHPUnit\Framework\TestCase +class GetIpAdressFromProxyTest extends \Shaarli\TestCase { /** diff --git a/tests/http/HttpUtils/IndexUrlTest.php b/tests/http/HttpUtils/IndexUrlTest.php index cce45c51..f283d119 100644 --- a/tests/http/HttpUtils/IndexUrlTest.php +++ b/tests/http/HttpUtils/IndexUrlTest.php @@ -5,7 +5,7 @@ namespace Shaarli\Http; -use PHPUnit\Framework\TestCase; +use Shaarli\TestCase; require_once 'application/http/HttpUtils.php'; diff --git a/tests/http/HttpUtils/IndexUrlTestWithConstant.php b/tests/http/HttpUtils/IndexUrlTestWithConstant.php index 15ca3d72..ecaea724 100644 --- a/tests/http/HttpUtils/IndexUrlTestWithConstant.php +++ b/tests/http/HttpUtils/IndexUrlTestWithConstant.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace Shaarli\Http; -use PHPUnit\Framework\TestCase; +use Shaarli\TestCase; /** * Test index_url with SHAARLI_ROOT_URL defined to override automatic retrieval. diff --git a/tests/http/HttpUtils/IsHttpsTest.php b/tests/http/HttpUtils/IsHttpsTest.php index 348956c6..8b3fd93d 100644 --- a/tests/http/HttpUtils/IsHttpsTest.php +++ b/tests/http/HttpUtils/IsHttpsTest.php @@ -9,7 +9,7 @@ require_once 'application/http/HttpUtils.php'; * * Test class for is_https() function. */ -class IsHttpsTest extends \PHPUnit\Framework\TestCase +class IsHttpsTest extends \Shaarli\TestCase { /** diff --git a/tests/http/HttpUtils/PageUrlTest.php b/tests/http/HttpUtils/PageUrlTest.php index f1991716..ebb3e617 100644 --- a/tests/http/HttpUtils/PageUrlTest.php +++ b/tests/http/HttpUtils/PageUrlTest.php @@ -10,7 +10,7 @@ require_once 'application/http/HttpUtils.php'; /** * Unitary tests for page_url() */ -class PageUrlTest extends \PHPUnit\Framework\TestCase +class PageUrlTest extends \Shaarli\TestCase { /** * If on the main page, remove "index.php" from the URL resource diff --git a/tests/http/HttpUtils/ServerUrlTest.php b/tests/http/HttpUtils/ServerUrlTest.php index 9caf1049..339664e1 100644 --- a/tests/http/HttpUtils/ServerUrlTest.php +++ b/tests/http/HttpUtils/ServerUrlTest.php @@ -10,7 +10,7 @@ require_once 'application/http/HttpUtils.php'; /** * Unitary tests for server_url() */ -class ServerUrlTest extends \PHPUnit\Framework\TestCase +class ServerUrlTest extends \Shaarli\TestCase { /** * Detect if the server uses SSL diff --git a/tests/http/UrlTest.php b/tests/http/UrlTest.php index ae92f73a..c6b39c29 100644 --- a/tests/http/UrlTest.php +++ b/tests/http/UrlTest.php @@ -8,7 +8,7 @@ namespace Shaarli\Http; /** * Unitary tests for URL utilities */ -class UrlTest extends \PHPUnit\Framework\TestCase +class UrlTest extends \Shaarli\TestCase { // base URL for tests protected static $baseUrl = 'http://domain.tld:3000'; diff --git a/tests/http/UrlUtils/CleanupUrlTest.php b/tests/http/UrlUtils/CleanupUrlTest.php index 6c4d124b..45690ecf 100644 --- a/tests/http/UrlUtils/CleanupUrlTest.php +++ b/tests/http/UrlUtils/CleanupUrlTest.php @@ -7,7 +7,7 @@ namespace Shaarli\Http; require_once 'application/http/UrlUtils.php'; -class CleanupUrlTest extends \PHPUnit\Framework\TestCase +class CleanupUrlTest extends \Shaarli\TestCase { /** * @var string reference URL diff --git a/tests/http/UrlUtils/GetUrlSchemeTest.php b/tests/http/UrlUtils/GetUrlSchemeTest.php index 2b97f7be..18a9a5e5 100644 --- a/tests/http/UrlUtils/GetUrlSchemeTest.php +++ b/tests/http/UrlUtils/GetUrlSchemeTest.php @@ -7,7 +7,7 @@ namespace Shaarli\Http; require_once 'application/http/UrlUtils.php'; -class GetUrlSchemeTest extends \PHPUnit\Framework\TestCase +class GetUrlSchemeTest extends \Shaarli\TestCase { /** * Get empty scheme string for empty UrlUtils diff --git a/tests/http/UrlUtils/UnparseUrlTest.php b/tests/http/UrlUtils/UnparseUrlTest.php index 040d8c54..5e6246cc 100644 --- a/tests/http/UrlUtils/UnparseUrlTest.php +++ b/tests/http/UrlUtils/UnparseUrlTest.php @@ -10,7 +10,7 @@ require_once 'application/http/UrlUtils.php'; /** * Unitary tests for unparse_url() */ -class UnparseUrlTest extends \PHPUnit\Framework\TestCase +class UnparseUrlTest extends \Shaarli\TestCase { /** * Thanks for building nothing diff --git a/tests/http/UrlUtils/WhitelistProtocolsTest.php b/tests/http/UrlUtils/WhitelistProtocolsTest.php index 69512dbd..b8a6baaa 100644 --- a/tests/http/UrlUtils/WhitelistProtocolsTest.php +++ b/tests/http/UrlUtils/WhitelistProtocolsTest.php @@ -9,7 +9,7 @@ require_once 'application/http/UrlUtils.php'; * * Test whitelist_protocols() function of UrlUtils. */ -class WhitelistProtocolsTest extends \PHPUnit\Framework\TestCase +class WhitelistProtocolsTest extends \Shaarli\TestCase { /** * Test whitelist_protocols() on a note (relative URL). diff --git a/tests/languages/fr/LanguagesFrTest.php b/tests/languages/fr/LanguagesFrTest.php index e412b5bc..d84feed1 100644 --- a/tests/languages/fr/LanguagesFrTest.php +++ b/tests/languages/fr/LanguagesFrTest.php @@ -12,7 +12,7 @@ use Shaarli\Config\ConfigManager; * * @package Shaarli */ -class LanguagesFrTest extends \PHPUnit\Framework\TestCase +class LanguagesFrTest extends \Shaarli\TestCase { /** * @var string Config file path (without extension). diff --git a/tests/legacy/LegacyControllerTest.php b/tests/legacy/LegacyControllerTest.php index 4e52f3e1..1a2549a3 100644 --- a/tests/legacy/LegacyControllerTest.php +++ b/tests/legacy/LegacyControllerTest.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace Shaarli\Legacy; -use PHPUnit\Framework\TestCase; use Shaarli\Front\Controller\Visitor\FrontControllerMockHelper; +use Shaarli\TestCase; use Slim\Http\Request; use Slim\Http\Response; diff --git a/tests/legacy/LegacyLinkDBTest.php b/tests/legacy/LegacyLinkDBTest.php index 819bc272..df2cad62 100644 --- a/tests/legacy/LegacyLinkDBTest.php +++ b/tests/legacy/LegacyLinkDBTest.php @@ -18,7 +18,7 @@ require_once 'tests/utils/ReferenceLinkDB.php'; /** * Unitary tests for LegacyLinkDBTest */ -class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase +class LegacyLinkDBTest extends \Shaarli\TestCase { // datastore to test write operations protected static $testDatastore = 'sandbox/datastore.php'; @@ -99,11 +99,10 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase /** * Attempt to instantiate a LinkDB whereas the datastore is not writable - * - * @expectedException Shaarli\Exceptions\IOException */ public function testConstructDatastoreNotWriteable() { + $this->expectException(\Shaarli\Exceptions\IOException::class); $this->expectExceptionMessageRegExp('/Error accessing "null"/'); new LegacyLinkDB('null/store.db', false, false); @@ -258,7 +257,7 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase $link = self::$publicLinkDB->getLinkFromUrl('http://mediagoblin.org/'); $this->assertNotEquals(false, $link); - $this->assertContains( + $this->assertContainsPolyfill( 'A free software media publishing platform', $link['description'] ); @@ -471,9 +470,9 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase $res = $linkDB->renameTag('cartoon', 'Taz'); $this->assertEquals(3, count($res)); - $this->assertContains(' Taz ', $linkDB[4]['tags']); - $this->assertContains(' Taz ', $linkDB[1]['tags']); - $this->assertContains(' Taz ', $linkDB[0]['tags']); + $this->assertContainsPolyfill(' Taz ', $linkDB[4]['tags']); + $this->assertContainsPolyfill(' Taz ', $linkDB[1]['tags']); + $this->assertContainsPolyfill(' Taz ', $linkDB[0]['tags']); } /** @@ -513,7 +512,7 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase $res = $linkDB->renameTag('cartoon', null); $this->assertEquals(3, count($res)); - $this->assertNotContains('cartoon', $linkDB[4]['tags']); + $this->assertNotContainsPolyfill('cartoon', $linkDB[4]['tags']); } /** diff --git a/tests/legacy/LegacyLinkFilterTest.php b/tests/legacy/LegacyLinkFilterTest.php index 9db921a9..45d7754d 100644 --- a/tests/legacy/LegacyLinkFilterTest.php +++ b/tests/legacy/LegacyLinkFilterTest.php @@ -10,7 +10,7 @@ use Shaarli\Legacy\LegacyLinkFilter; /** * Class LegacyLinkFilterTest. */ -class LegacyLinkFilterTest extends \PHPUnit\Framework\TestCase +class LegacyLinkFilterTest extends \Shaarli\TestCase { /** * @var string Test datastore path. @@ -197,10 +197,10 @@ class LegacyLinkFilterTest extends \PHPUnit\Framework\TestCase /** * Use an invalid date format - * @expectedException Exception */ public function testFilterInvalidDayWithChars() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Invalid date format/'); self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, 'Rainy day, dream away'); @@ -208,10 +208,10 @@ class LegacyLinkFilterTest extends \PHPUnit\Framework\TestCase /** * Use an invalid date format - * @expectedException Exception */ public function testFilterInvalidDayDigits() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Invalid date format/'); self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, '20'); diff --git a/tests/legacy/LegacyUpdaterTest.php b/tests/legacy/LegacyUpdaterTest.php index acfac530..f7391b86 100644 --- a/tests/legacy/LegacyUpdaterTest.php +++ b/tests/legacy/LegacyUpdaterTest.php @@ -20,7 +20,7 @@ require_once 'inc/rain.tpl.class.php'; * Class UpdaterTest. * Runs unit tests against the updater class. */ -class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase +class LegacyUpdaterTest extends \Shaarli\TestCase { /** * @var string Path to test datastore. @@ -80,11 +80,10 @@ class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase /** * Test errors in UpdaterUtils::write_updates_file(): empty updates file. - * - * @expectedException Exception */ public function testWriteEmptyUpdatesFile() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/'); UpdaterUtils::write_updates_file('', array('test')); @@ -92,11 +91,10 @@ class LegacyUpdaterTest extends \PHPUnit\Framework\TestCase /** * Test errors in UpdaterUtils::write_updates_file(): not writable updates file. - * - * @expectedException Exception */ public function testWriteUpdatesFileNotWritable() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Unable to write(.*)/'); $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt'; @@ -725,7 +723,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; $this->assertEquals(\Shaarli\Thumbnailer::MODE_ALL, $this->conf->get('thumbnails.mode')); $this->assertEquals(125, $this->conf->get('thumbnails.width')); $this->assertEquals(90, $this->conf->get('thumbnails.height')); - $this->assertContains('You have enabled or changed thumbnails', $_SESSION['warnings'][0]); + $this->assertContainsPolyfill('You have enabled or changed thumbnails', $_SESSION['warnings'][0]); } /** diff --git a/tests/netscape/BookmarkExportTest.php b/tests/netscape/BookmarkExportTest.php index a6eacae4..9b95ccc9 100644 --- a/tests/netscape/BookmarkExportTest.php +++ b/tests/netscape/BookmarkExportTest.php @@ -2,12 +2,12 @@ namespace Shaarli\Netscape; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\BookmarkFileService; use Shaarli\Config\ConfigManager; use Shaarli\Formatter\BookmarkFormatter; use Shaarli\Formatter\FormatterFactory; use Shaarli\History; +use Shaarli\TestCase; require_once 'tests/utils/ReferenceLinkDB.php'; @@ -77,10 +77,10 @@ class BookmarkExportTest extends TestCase /** * Attempt to export an invalid link selection - * @expectedException Exception */ public function testFilterAndFormatInvalid() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Invalid export selection/'); $this->netscapeBookmarkUtils->filterAndFormat( diff --git a/tests/netscape/BookmarkImportTest.php b/tests/netscape/BookmarkImportTest.php index 89ae4aa7..c1e49b5f 100644 --- a/tests/netscape/BookmarkImportTest.php +++ b/tests/netscape/BookmarkImportTest.php @@ -3,13 +3,13 @@ namespace Shaarli\Netscape; use DateTime; -use PHPUnit\Framework\TestCase; use Psr\Http\Message\UploadedFileInterface; use Shaarli\Bookmark\Bookmark; use Shaarli\Bookmark\BookmarkFileService; use Shaarli\Bookmark\BookmarkFilter; use Shaarli\Config\ConfigManager; use Shaarli\History; +use Shaarli\TestCase; use Slim\Http\UploadedFile; /** diff --git a/tests/plugins/PluginAddlinkTest.php b/tests/plugins/PluginAddlinkTest.php index 1f60d289..a3ec9fc9 100644 --- a/tests/plugins/PluginAddlinkTest.php +++ b/tests/plugins/PluginAddlinkTest.php @@ -9,7 +9,7 @@ require_once 'plugins/addlink_toolbar/addlink_toolbar.php'; /** * Unit test for the Addlink toolbar plugin */ -class PluginAddlinkTest extends \PHPUnit\Framework\TestCase +class PluginAddlinkTest extends \Shaarli\TestCase { /** * Reset plugin path. diff --git a/tests/plugins/PluginArchiveorgTest.php b/tests/plugins/PluginArchiveorgTest.php index 9c19752c..467dc3d0 100644 --- a/tests/plugins/PluginArchiveorgTest.php +++ b/tests/plugins/PluginArchiveorgTest.php @@ -6,8 +6,8 @@ namespace Shaarli\Plugin\Archiveorg; * PluginArchiveorgTest.php */ -use PHPUnit\Framework\TestCase; use Shaarli\Plugin\PluginManager; +use Shaarli\TestCase; require_once 'plugins/archiveorg/archiveorg.php'; diff --git a/tests/plugins/PluginDefaultColorsTest.php b/tests/plugins/PluginDefaultColorsTest.php index 240bb4b2..cc844c60 100644 --- a/tests/plugins/PluginDefaultColorsTest.php +++ b/tests/plugins/PluginDefaultColorsTest.php @@ -2,10 +2,10 @@ namespace Shaarli\Plugin\DefaultColors; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\LinkDB; use Shaarli\Config\ConfigManager; use Shaarli\Plugin\PluginManager; +use Shaarli\TestCase; require_once 'plugins/default_colors/default_colors.php'; diff --git a/tests/plugins/PluginIssoTest.php b/tests/plugins/PluginIssoTest.php index 2bbb93d2..16ecf357 100644 --- a/tests/plugins/PluginIssoTest.php +++ b/tests/plugins/PluginIssoTest.php @@ -2,10 +2,10 @@ namespace Shaarli\Plugin\Isso; use DateTime; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\Bookmark; use Shaarli\Config\ConfigManager; use Shaarli\Plugin\PluginManager; +use Shaarli\TestCase; require_once 'plugins/isso/isso.php'; @@ -116,8 +116,8 @@ class PluginIssoTest extends TestCase $processed = hook_isso_render_linklist($data, $conf); // link_plugin should be added for the icon - $this->assertContains('', $processed['links'][0]['link_plugin'][0]); - $this->assertContains('', $processed['links'][1]['link_plugin'][0]); + $this->assertContainsPolyfill('', $processed['links'][0]['link_plugin'][0]); + $this->assertContainsPolyfill('', $processed['links'][1]['link_plugin'][0]); } /** @@ -146,7 +146,7 @@ class PluginIssoTest extends TestCase $processed = hook_isso_render_linklist($data, $conf); // link_plugin should be added for the icon - $this->assertContains('', $processed['links'][0]['link_plugin'][0]); + $this->assertContainsPolyfill('', $processed['links'][0]['link_plugin'][0]); } /** diff --git a/tests/plugins/PluginPlayvideosTest.php b/tests/plugins/PluginPlayvideosTest.php index de1a1aec..338d2e35 100644 --- a/tests/plugins/PluginPlayvideosTest.php +++ b/tests/plugins/PluginPlayvideosTest.php @@ -14,7 +14,7 @@ require_once 'plugins/playvideos/playvideos.php'; * Class PluginPlayvideosTest * Unit test for the PlayVideos plugin */ -class PluginPlayvideosTest extends \PHPUnit\Framework\TestCase +class PluginPlayvideosTest extends \Shaarli\TestCase { /** * Reset plugin path diff --git a/tests/plugins/PluginPubsubhubbubTest.php b/tests/plugins/PluginPubsubhubbubTest.php index d30c3703..d3f7b439 100644 --- a/tests/plugins/PluginPubsubhubbubTest.php +++ b/tests/plugins/PluginPubsubhubbubTest.php @@ -11,7 +11,7 @@ require_once 'plugins/pubsubhubbub/pubsubhubbub.php'; * Class PluginPubsubhubbubTest * Unit test for the pubsubhubbub plugin */ -class PluginPubsubhubbubTest extends \PHPUnit\Framework\TestCase +class PluginPubsubhubbubTest extends \Shaarli\TestCase { /** * @var string Config file path (without extension). diff --git a/tests/plugins/PluginQrcodeTest.php b/tests/plugins/PluginQrcodeTest.php index bc6be0eb..1d85fba6 100644 --- a/tests/plugins/PluginQrcodeTest.php +++ b/tests/plugins/PluginQrcodeTest.php @@ -14,7 +14,7 @@ require_once 'plugins/qrcode/qrcode.php'; * Class PluginQrcodeTest * Unit test for the QR-Code plugin */ -class PluginQrcodeTest extends \PHPUnit\Framework\TestCase +class PluginQrcodeTest extends \Shaarli\TestCase { /** * Reset plugin path diff --git a/tests/plugins/PluginWallabagTest.php b/tests/plugins/PluginWallabagTest.php index 372929ea..36317215 100644 --- a/tests/plugins/PluginWallabagTest.php +++ b/tests/plugins/PluginWallabagTest.php @@ -10,7 +10,7 @@ require_once 'plugins/wallabag/wallabag.php'; * Class PluginWallabagTest * Unit test for the Wallabag plugin */ -class PluginWallabagTest extends \PHPUnit\Framework\TestCase +class PluginWallabagTest extends \Shaarli\TestCase { /** * Reset plugin path diff --git a/tests/plugins/WallabagInstanceTest.php b/tests/plugins/WallabagInstanceTest.php index 4cb0d4cc..5ef3de1a 100644 --- a/tests/plugins/WallabagInstanceTest.php +++ b/tests/plugins/WallabagInstanceTest.php @@ -4,7 +4,7 @@ namespace Shaarli\Plugin\Wallabag; /** * Class WallabagInstanceTest */ -class WallabagInstanceTest extends \PHPUnit\Framework\TestCase +class WallabagInstanceTest extends \Shaarli\TestCase { /** * @var string wallabag url. diff --git a/tests/render/PageCacheManagerTest.php b/tests/render/PageCacheManagerTest.php index 4aa7e179..08d4e5ea 100644 --- a/tests/render/PageCacheManagerTest.php +++ b/tests/render/PageCacheManagerTest.php @@ -6,8 +6,8 @@ namespace Shaarli\Render; -use PHPUnit\Framework\TestCase; use Shaarli\Security\SessionManager; +use Shaarli\TestCase; /** * Unitary tests for cached pages diff --git a/tests/render/ThemeUtilsTest.php b/tests/render/ThemeUtilsTest.php index 58e3426b..7d841e4d 100644 --- a/tests/render/ThemeUtilsTest.php +++ b/tests/render/ThemeUtilsTest.php @@ -7,7 +7,7 @@ namespace Shaarli\Render; * * @package Shaarli */ -class ThemeUtilsTest extends \PHPUnit\Framework\TestCase +class ThemeUtilsTest extends \Shaarli\TestCase { /** * Test getThemes() with existing theme directories. diff --git a/tests/security/BanManagerTest.php b/tests/security/BanManagerTest.php index 2fef82f5..698d3d10 100644 --- a/tests/security/BanManagerTest.php +++ b/tests/security/BanManagerTest.php @@ -3,8 +3,8 @@ namespace Shaarli\Security; -use PHPUnit\Framework\TestCase; use Shaarli\FileUtils; +use Shaarli\TestCase; /** * Test coverage for BanManager diff --git a/tests/security/LoginManagerTest.php b/tests/security/LoginManagerTest.php index cc9aa647..d302983d 100644 --- a/tests/security/LoginManagerTest.php +++ b/tests/security/LoginManagerTest.php @@ -2,7 +2,7 @@ namespace Shaarli\Security; -use PHPUnit\Framework\TestCase; +use Shaarli\TestCase; /** * Test coverage for LoginManager diff --git a/tests/security/SessionManagerTest.php b/tests/security/SessionManagerTest.php index 27e3b1a9..3f9c3ef5 100644 --- a/tests/security/SessionManagerTest.php +++ b/tests/security/SessionManagerTest.php @@ -2,7 +2,7 @@ namespace Shaarli\Security; -use PHPUnit\Framework\TestCase; +use Shaarli\TestCase; /** * Test coverage for SessionManager diff --git a/tests/updater/DummyUpdater.php b/tests/updater/DummyUpdater.php index 07c7f5c4..3403233f 100644 --- a/tests/updater/DummyUpdater.php +++ b/tests/updater/DummyUpdater.php @@ -37,7 +37,7 @@ class DummyUpdater extends Updater * * @return bool true. */ - final private function updateMethodDummy1() + final protected function updateMethodDummy1() { return true; } @@ -47,7 +47,7 @@ class DummyUpdater extends Updater * * @return bool true. */ - final private function updateMethodDummy2() + final protected function updateMethodDummy2() { return true; } @@ -57,7 +57,7 @@ class DummyUpdater extends Updater * * @return bool true. */ - final private function updateMethodDummy3() + final protected function updateMethodDummy3() { return true; } @@ -67,7 +67,7 @@ class DummyUpdater extends Updater * * @throws Exception error. */ - final private function updateMethodException() + final protected function updateMethodException() { throw new Exception('whatever'); } diff --git a/tests/updater/UpdaterTest.php b/tests/updater/UpdaterTest.php index 5cfcd5db..a6280b8c 100644 --- a/tests/updater/UpdaterTest.php +++ b/tests/updater/UpdaterTest.php @@ -2,11 +2,11 @@ namespace Shaarli\Updater; use Exception; -use PHPUnit\Framework\TestCase; use Shaarli\Bookmark\BookmarkFileService; use Shaarli\Bookmark\BookmarkServiceInterface; use Shaarli\Config\ConfigManager; use Shaarli\History; +use Shaarli\TestCase; /** @@ -87,11 +87,10 @@ class UpdaterTest extends TestCase /** * Test errors in UpdaterUtils::write_updates_file(): empty updates file. - * - * @expectedException Exception */ public function testWriteEmptyUpdatesFile() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/'); UpdaterUtils::write_updates_file('', array('test')); @@ -99,11 +98,10 @@ class UpdaterTest extends TestCase /** * Test errors in UpdaterUtils::write_updates_file(): not writable updates file. - * - * @expectedException Exception */ public function testWriteUpdatesFileNotWritable() { + $this->expectException(\Exception::class); $this->expectExceptionMessageRegExp('/Unable to write(.*)/'); $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt';