From 2fa2799b64fd12f08fbfbc0a815279a0606aba67 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 20 Jan 2020 00:34:02 -0500 Subject: [PATCH 01/14] Require PHP 7.1 in Composer In reality we have unwittingly required PHP 7.1 for some time --- composer.json | 11 +- composer.lock | 355 +++++++++++++++++++------------ vendor-bin/csfixer/composer.lock | 43 ++-- vendor-bin/daux/composer.lock | 82 +++---- vendor-bin/phpunit/composer.lock | 47 ++-- vendor-bin/robo/composer.lock | 52 ++--- 6 files changed, 337 insertions(+), 253 deletions(-) diff --git a/composer.json b/composer.json index 3fdd1c71..0fef64b7 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ ], "require": { - "php": "7.*", + "php": "^7.1", "ext-intl": "*", "ext-json": "*", "ext-hash": "*", @@ -27,12 +27,17 @@ "hosteurope/password-generator": "1.*", "docopt/docopt": "1.*", "jkingweb/druuid": "3.*", - "zendframework/zend-diactoros": "2.*", - "zendframework/zend-httphandlerrunner": "1.*" + "laminas/laminas-diactoros": "2.*", + "laminas/laminas-httphandlerrunner": "1.*" }, "require-dev": { "bamarni/composer-bin-plugin": "*" }, + "config": { + "platform": { + "php": "7.1.33" + } + }, "scripts": { "post-install-cmd": ["@composer bin all install"], "post-update-cmd": ["@composer bin all update"] diff --git a/composer.lock b/composer.lock index c33f781e..bc0f82a0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c2b0698669d89268ffb995a5e1d6667a", + "content-hash": "356cebec1e1e689b4249b661f787b7d9", "packages": [ { "name": "docopt/docopt", - "version": "1.0.2", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/docopt/docopt.php.git", - "reference": "d2ee65c2fe4be78f945a48edd02be45843b39423" + "reference": "bf3683a16e09fa1665e493eb4d5a29469e132a4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/docopt/docopt.php/zipball/d2ee65c2fe4be78f945a48edd02be45843b39423", - "reference": "d2ee65c2fe4be78f945a48edd02be45843b39423", + "url": "https://api.github.com/repos/docopt/docopt.php/zipball/bf3683a16e09fa1665e493eb4d5a29469e132a4f", + "reference": "bf3683a16e09fa1665e493eb4d5a29469e132a4f", "shasum": "" }, "require": { @@ -44,13 +44,13 @@ "role": "Developer" } ], - "description": "Port of Python's docopt for PHP 5.3", + "description": "Port of Python's docopt for PHP >=5.3", "homepage": "http://github.com/docopt/docopt.php", "keywords": [ "cli", "docs" ], - "time": "2015-10-30T03:21:23+00:00" + "time": "2019-12-03T02:48:46+00:00" }, { "name": "hosteurope/password-generator", @@ -138,17 +138,212 @@ "time": "2017-02-09T14:17:01+00:00" }, { - "name": "p3k/picofeed", - "version": "v0.1.38", + "name": "laminas/laminas-diactoros", + "version": "2.2.2", "source": { "type": "git", - "url": "https://github.com/aaronpk/picoFeed.git", - "reference": "989c0bcf2eac016a4104abce1aadff791fc287ab" + "url": "https://github.com/laminas/laminas-diactoros.git", + "reference": "95178c4751d737cdf9ab0a9f70a42754ac860e7b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aaronpk/picoFeed/zipball/989c0bcf2eac016a4104abce1aadff791fc287ab", - "reference": "989c0bcf2eac016a4104abce1aadff791fc287ab", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/95178c4751d737cdf9ab0a9f70a42754ac860e7b", + "reference": "95178c4751d737cdf9ab0a9f70a42754ac860e7b", + "shasum": "" + }, + "require": { + "laminas/laminas-zendframework-bridge": "^1.0", + "php": "^7.1", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0" + }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "replace": { + "zendframework/zend-diactoros": "self.version" + }, + "require-dev": { + "ext-curl": "*", + "ext-dom": "*", + "ext-libxml": "*", + "http-interop/http-factory-tests": "^0.5.0", + "laminas/laminas-coding-standard": "~1.0.0", + "php-http/psr7-integration-tests": "dev-master", + "phpunit/phpunit": "^7.5.18" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev", + "dev-develop": "2.2.x-dev", + "dev-release-1.8": "1.8.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php", + "src/functions/create_uploaded_file.legacy.php", + "src/functions/marshal_headers_from_sapi.legacy.php", + "src/functions/marshal_method_from_sapi.legacy.php", + "src/functions/marshal_protocol_version_from_sapi.legacy.php", + "src/functions/marshal_uri_from_sapi.legacy.php", + "src/functions/normalize_server.legacy.php", + "src/functions/normalize_uploaded_files.legacy.php", + "src/functions/parse_cookie_header.legacy.php" + ], + "psr-4": { + "Laminas\\Diactoros\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "PSR HTTP Message implementations", + "homepage": "https://laminas.dev", + "keywords": [ + "http", + "laminas", + "psr", + "psr-7" + ], + "time": "2020-01-07T19:39:26+00:00" + }, + { + "name": "laminas/laminas-httphandlerrunner", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-httphandlerrunner.git", + "reference": "296f5ff35074dd981d1570a66b95596c81808087" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-httphandlerrunner/zipball/296f5ff35074dd981d1570a66b95596c81808087", + "reference": "296f5ff35074dd981d1570a66b95596c81808087", + "shasum": "" + }, + "require": { + "laminas/laminas-zendframework-bridge": "^1.0", + "php": "^7.1", + "psr/http-message": "^1.0", + "psr/http-message-implementation": "^1.0", + "psr/http-server-handler": "^1.0" + }, + "replace": { + "zendframework/zend-httphandlerrunner": "self.version" + }, + "require-dev": { + "laminas/laminas-coding-standard": "~1.0.0", + "laminas/laminas-diactoros": "^1.7 || ^2.1.1", + "phpunit/phpunit": "^7.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev", + "dev-develop": "1.2.x-dev" + }, + "laminas": { + "config-provider": "Laminas\\HttpHandlerRunner\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Laminas\\HttpHandlerRunner\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Execute PSR-15 RequestHandlerInterface instances and emit responses they generate.", + "homepage": "https://laminas.dev", + "keywords": [ + "components", + "laminas", + "mezzio", + "psr-15", + "psr-7" + ], + "time": "2019-12-31T17:06:16+00:00" + }, + { + "name": "laminas/laminas-zendframework-bridge", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-zendframework-bridge.git", + "reference": "0fb9675b84a1666ab45182b6c5b29956921e818d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/0fb9675b84a1666ab45182b6c5b29956921e818d", + "reference": "0fb9675b84a1666ab45182b6c5b29956921e818d", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev", + "dev-develop": "1.1.x-dev" + }, + "laminas": { + "module": "Laminas\\ZendFrameworkBridge" + } + }, + "autoload": { + "files": [ + "src/autoload.php" + ], + "psr-4": { + "Laminas\\ZendFrameworkBridge\\": "src//" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Alias legacy ZF class names to Laminas Project equivalents.", + "keywords": [ + "ZendFramework", + "autoloading", + "laminas", + "zf" + ], + "time": "2020-01-07T22:58:31+00:00" + }, + { + "name": "p3k/picofeed", + "version": "v0.1.35", + "source": { + "type": "git", + "url": "https://github.com/aaronpk/picofeed.git", + "reference": "b2a48acb026df91d2e21dfc8b4edbc1fc48f01f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aaronpk/picofeed/zipball/b2a48acb026df91d2e21dfc8b4edbc1fc48f01f1", + "reference": "b2a48acb026df91d2e21dfc8b4edbc1fc48f01f1", "shasum": "" }, "require": { @@ -187,8 +382,8 @@ } ], "description": "Modern library to handle RSS/Atom feeds", - "homepage": "https://github.com/miniflux/picoFeed", - "time": "2017-11-30T00:16:58+00:00" + "homepage": "https://github.com/aaronpk/picoFeed", + "time": "2019-01-17T17:26:41+00:00" }, { "name": "psr/http-factory", @@ -345,128 +540,6 @@ ], "time": "2018-10-30T16:46:14+00:00" }, - { - "name": "zendframework/zend-diactoros", - "version": "2.1.5", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-diactoros.git", - "reference": "6dcf9e760a6b476f3e9d80abbc9ce9c4aa921f9c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/6dcf9e760a6b476f3e9d80abbc9ce9c4aa921f9c", - "reference": "6dcf9e760a6b476f3e9d80abbc9ce9c4aa921f9c", - "shasum": "" - }, - "require": { - "php": "^7.1", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0" - }, - "provide": { - "psr/http-factory-implementation": "1.0", - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "ext-curl": "*", - "ext-dom": "*", - "ext-libxml": "*", - "http-interop/http-factory-tests": "^0.5.0", - "php-http/psr7-integration-tests": "dev-master", - "phpunit/phpunit": "^7.0.2", - "zendframework/zend-coding-standard": "~1.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev", - "dev-develop": "2.2.x-dev", - "dev-release-1.8": "1.8.x-dev" - } - }, - "autoload": { - "files": [ - "src/functions/create_uploaded_file.php", - "src/functions/marshal_headers_from_sapi.php", - "src/functions/marshal_method_from_sapi.php", - "src/functions/marshal_protocol_version_from_sapi.php", - "src/functions/marshal_uri_from_sapi.php", - "src/functions/normalize_server.php", - "src/functions/normalize_uploaded_files.php", - "src/functions/parse_cookie_header.php" - ], - "psr-4": { - "Zend\\Diactoros\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "PSR HTTP Message implementations", - "keywords": [ - "http", - "psr", - "psr-7" - ], - "time": "2019-10-10T17:38:20+00:00" - }, - { - "name": "zendframework/zend-httphandlerrunner", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-httphandlerrunner.git", - "reference": "75fb12751fe9d6e392cce1ee0d687dacae2db787" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-httphandlerrunner/zipball/75fb12751fe9d6e392cce1ee0d687dacae2db787", - "reference": "75fb12751fe9d6e392cce1ee0d687dacae2db787", - "shasum": "" - }, - "require": { - "php": "^7.1", - "psr/http-message": "^1.0", - "psr/http-message-implementation": "^1.0", - "psr/http-server-handler": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.0.2", - "zendframework/zend-coding-standard": "~1.0.0", - "zendframework/zend-diactoros": "^1.7 || ^2.1.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev", - "dev-develop": "1.2.x-dev" - }, - "zf": { - "config-provider": "Zend\\HttpHandlerRunner\\ConfigProvider" - } - }, - "autoload": { - "psr-4": { - "Zend\\HttpHandlerRunner\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Execute PSR-15 RequestHandlerInterface instances and emit responses they generate.", - "keywords": [ - "ZendFramework", - "components", - "expressive", - "psr-15", - "psr-7", - "zf" - ], - "time": "2019-02-19T18:20:34+00:00" - }, { "name": "zendframework/zendxml", "version": "1.2.0", @@ -511,6 +584,7 @@ "xml", "zf" ], + "abandoned": "laminas/laminas-xml", "time": "2019-01-22T19:42:14+00:00" } ], @@ -561,11 +635,14 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "7.*", + "php": "^7.1", "ext-intl": "*", "ext-json": "*", "ext-hash": "*", "ext-dom": "*" }, - "platform-dev": [] + "platform-dev": [], + "platform-overrides": { + "php": "7.1.33" + } } diff --git a/vendor-bin/csfixer/composer.lock b/vendor-bin/csfixer/composer.lock index 6bf072a5..721b3e35 100644 --- a/vendor-bin/csfixer/composer.lock +++ b/vendor-bin/csfixer/composer.lock @@ -8,24 +8,23 @@ "packages": [ { "name": "composer/semver", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e" + "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e", + "url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de", + "reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + "phpunit/phpunit": "^4.5 || ^5.0.5" }, "type": "library", "extra": { @@ -66,7 +65,7 @@ "validation", "versioning" ], - "time": "2019-03-19T17:25:45+00:00" + "time": "2020-01-13T12:06:48+00:00" }, { "name": "composer/xdebug-handler", @@ -571,16 +570,16 @@ }, { "name": "symfony/console", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "dae5ef273d700771168ab889d9f8a19b2d206656" + "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dae5ef273d700771168ab889d9f8a19b2d206656", - "reference": "dae5ef273d700771168ab889d9f8a19b2d206656", + "url": "https://api.github.com/repos/symfony/console/zipball/fe6e3cd889ca64172d7a742a2eb058541404ef47", + "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47", "shasum": "" }, "require": { @@ -643,11 +642,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-12-01T10:51:15+00:00" + "time": "2019-12-17T13:20:22+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -775,7 +774,7 @@ }, { "name": "symfony/filesystem", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -825,7 +824,7 @@ }, { "name": "symfony/finder", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -874,7 +873,7 @@ }, { "name": "symfony/options-resolver", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", @@ -1217,16 +1216,16 @@ }, { "name": "symfony/process", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "1568a2e8370fbc7416ef64eb5a698e4a05db5ff4" + "reference": "ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/1568a2e8370fbc7416ef64eb5a698e4a05db5ff4", - "reference": "1568a2e8370fbc7416ef64eb5a698e4a05db5ff4", + "url": "https://api.github.com/repos/symfony/process/zipball/ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e", + "reference": "ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e", "shasum": "" }, "require": { @@ -1262,7 +1261,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-11-28T14:20:16+00:00" + "time": "2019-12-10T11:06:55+00:00" }, { "name": "symfony/service-contracts", @@ -1324,7 +1323,7 @@ }, { "name": "symfony/stopwatch", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", diff --git a/vendor-bin/daux/composer.lock b/vendor-bin/daux/composer.lock index 116c2b28..4bbbe450 100644 --- a/vendor-bin/daux/composer.lock +++ b/vendor-bin/daux/composer.lock @@ -79,16 +79,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.4.1", + "version": "6.5.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "0895c932405407fd3a7368b6910c09a24d26db11" + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0895c932405407fd3a7368b6910c09a24d26db11", - "reference": "0895c932405407fd3a7368b6910c09a24d26db11", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", "shasum": "" }, "require": { @@ -103,12 +103,13 @@ "psr/log": "^1.1" }, "suggest": { + "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.3-dev" + "dev-master": "6.5-dev" } }, "autoload": { @@ -141,7 +142,7 @@ "rest", "web service" ], - "time": "2019-10-23T15:58:00+00:00" + "time": "2019-12-23T11:57:10+00:00" }, { "name": "guzzlehttp/promises", @@ -391,16 +392,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.9.3", + "version": "1.9.5", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", "shasum": "" }, "require": { @@ -435,7 +436,7 @@ "object", "object graph" ], - "time": "2019-08-09T12:45:53+00:00" + "time": "2020-01-17T21:11:47+00:00" }, { "name": "psr/container", @@ -578,16 +579,16 @@ }, { "name": "scrivo/highlight.php", - "version": "v9.15.10.0", + "version": "v9.17.1.0", "source": { "type": "git", "url": "https://github.com/scrivo/highlight.php.git", - "reference": "9ad3adb4456dc91196327498dbbce6aa1ba1239e" + "reference": "5451a9ad6d638559cf2a092880f935c39776134e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/9ad3adb4456dc91196327498dbbce6aa1ba1239e", - "reference": "9ad3adb4456dc91196327498dbbce6aa1ba1239e", + "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/5451a9ad6d638559cf2a092880f935c39776134e", + "reference": "5451a9ad6d638559cf2a092880f935c39776134e", "shasum": "" }, "require": { @@ -597,7 +598,8 @@ }, "require-dev": { "phpunit/phpunit": "^4.8|^5.7", - "symfony/finder": "^2.8" + "symfony/finder": "^3.4", + "symfony/var-dumper": "^3.4" }, "suggest": { "ext-dom": "Needed to make use of the features in the utilities namespace" @@ -625,7 +627,7 @@ { "name": "Vladimir Jimenez", "homepage": "https://allejo.io", - "role": "Contributor" + "role": "Maintainer" }, { "name": "Martin Folkers", @@ -641,20 +643,20 @@ "highlight.php", "syntax" ], - "time": "2019-08-27T04:27:48+00:00" + "time": "2019-12-13T21:54:06+00:00" }, { "name": "symfony/console", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201" + "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f0aea3df20d15635b3cb9730ca5eea1c65b7f201", - "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201", + "url": "https://api.github.com/repos/symfony/console/zipball/82437719dab1e6bdd28726af14cb345c2ec816d0", + "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0", "shasum": "" }, "require": { @@ -717,20 +719,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-12-01T10:06:17+00:00" + "time": "2019-12-17T10:32:23+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "8bccc59e61b41963d14c3dbdb23181e5c932a1d5" + "reference": "fcae1cff5b57b2a9c3aabefeb1527678705ddb62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8bccc59e61b41963d14c3dbdb23181e5c932a1d5", - "reference": "8bccc59e61b41963d14c3dbdb23181e5c932a1d5", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/fcae1cff5b57b2a9c3aabefeb1527678705ddb62", + "reference": "fcae1cff5b57b2a9c3aabefeb1527678705ddb62", "shasum": "" }, "require": { @@ -772,11 +774,11 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2019-11-28T13:33:56+00:00" + "time": "2019-12-19T15:57:49+00:00" }, { "name": "symfony/intl", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/intl.git", @@ -851,7 +853,7 @@ }, { "name": "symfony/mime", - "version": "v5.0.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", @@ -1263,16 +1265,16 @@ }, { "name": "symfony/process", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "51c0135ef3f44c5803b33dc60e96bf4f77752726" + "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/51c0135ef3f44c5803b33dc60e96bf4f77752726", - "reference": "51c0135ef3f44c5803b33dc60e96bf4f77752726", + "url": "https://api.github.com/repos/symfony/process/zipball/b84501ad50adb72a94fb460a5b5c91f693e99c9b", + "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b", "shasum": "" }, "require": { @@ -1308,7 +1310,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-11-28T13:33:56+00:00" + "time": "2019-12-06T10:06:46+00:00" }, { "name": "symfony/service-contracts", @@ -1370,16 +1372,16 @@ }, { "name": "symfony/yaml", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "76de473358fe802578a415d5bb43c296cf09d211" + "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/76de473358fe802578a415d5bb43c296cf09d211", - "reference": "76de473358fe802578a415d5bb43c296cf09d211", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a08832b974dd5fafe3085a66d41fe4c84bb2628c", + "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c", "shasum": "" }, "require": { @@ -1425,7 +1427,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-11-12T14:51:11+00:00" + "time": "2019-12-10T10:33:21+00:00" }, { "name": "webuni/commonmark-table-extension", diff --git a/vendor-bin/phpunit/composer.lock b/vendor-bin/phpunit/composer.lock index 392331bc..02f49dd1 100644 --- a/vendor-bin/phpunit/composer.lock +++ b/vendor-bin/phpunit/composer.lock @@ -201,16 +201,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.9.3", + "version": "1.9.5", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", "shasum": "" }, "require": { @@ -245,7 +245,7 @@ "object", "object graph" ], - "time": "2019-08-09T12:45:53+00:00" + "time": "2020-01-17T21:11:47+00:00" }, { "name": "phake/phake", @@ -461,16 +461,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.2", + "version": "4.3.4", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c", + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c", "shasum": "" }, "require": { @@ -482,6 +482,7 @@ "require-dev": { "doctrine/instantiator": "^1.0.5", "mockery/mockery": "^1.0", + "phpdocumentor/type-resolver": "0.4.*", "phpunit/phpunit": "^6.4" }, "type": "library", @@ -508,7 +509,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-09-12T14:27:41+00:00" + "time": "2019-12-28T18:55:12+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -559,33 +560,33 @@ }, { "name": "phpspec/prophecy", - "version": "1.9.0", + "version": "1.10.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" + "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/cbe1df668b3fe136bcc909126a0f529a78d4cbbc", + "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", + "phpspec/phpspec": "^2.5 || ^3.2", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { @@ -618,7 +619,7 @@ "spy", "stub" ], - "time": "2019-10-03T11:07:50+00:00" + "time": "2019-12-22T21:05:45+00:00" }, { "name": "phpunit/php-code-coverage", @@ -874,16 +875,16 @@ }, { "name": "phpunit/phpunit", - "version": "8.5.0", + "version": "8.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3ee1c1fd6fc264480c25b6fb8285edefe1702dab" + "reference": "018b6ac3c8ab20916db85fa91bf6465acb64d1e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3ee1c1fd6fc264480c25b6fb8285edefe1702dab", - "reference": "3ee1c1fd6fc264480c25b6fb8285edefe1702dab", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/018b6ac3c8ab20916db85fa91bf6465acb64d1e0", + "reference": "018b6ac3c8ab20916db85fa91bf6465acb64d1e0", "shasum": "" }, "require": { @@ -953,7 +954,7 @@ "testing", "xunit" ], - "time": "2019-12-06T05:41:38+00:00" + "time": "2020-01-08T08:49:49+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", diff --git a/vendor-bin/robo/composer.lock b/vendor-bin/robo/composer.lock index 7c5979c1..73268710 100644 --- a/vendor-bin/robo/composer.lock +++ b/vendor-bin/robo/composer.lock @@ -786,16 +786,16 @@ }, { "name": "pear/archive_tar", - "version": "1.4.8", + "version": "1.4.9", "source": { "type": "git", "url": "https://github.com/pear/Archive_Tar.git", - "reference": "442bdffb7edb84c898cfd94f7ac8500e49d5bbb5" + "reference": "c5b00053770e1d72128252c62c2c1a12c26639f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/Archive_Tar/zipball/442bdffb7edb84c898cfd94f7ac8500e49d5bbb5", - "reference": "442bdffb7edb84c898cfd94f7ac8500e49d5bbb5", + "url": "https://api.github.com/repos/pear/Archive_Tar/zipball/c5b00053770e1d72128252c62c2c1a12c26639f0", + "reference": "c5b00053770e1d72128252c62c2c1a12c26639f0", "shasum": "" }, "require": { @@ -848,7 +848,7 @@ "archive", "tar" ], - "time": "2019-10-21T13:31:24+00:00" + "time": "2019-12-04T10:17:28+00:00" }, { "name": "pear/console_getopt", @@ -943,16 +943,16 @@ }, { "name": "pear/pear_exception", - "version": "v1.0.0", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/pear/PEAR_Exception.git", - "reference": "8c18719fdae000b690e3912be401c76e406dd13b" + "reference": "dbb42a5a0e45f3adcf99babfb2a1ba77b8ac36a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/PEAR_Exception/zipball/8c18719fdae000b690e3912be401c76e406dd13b", - "reference": "8c18719fdae000b690e3912be401c76e406dd13b", + "url": "https://api.github.com/repos/pear/PEAR_Exception/zipball/dbb42a5a0e45f3adcf99babfb2a1ba77b8ac36a7", + "reference": "dbb42a5a0e45f3adcf99babfb2a1ba77b8ac36a7", "shasum": "" }, "require": { @@ -968,9 +968,9 @@ } }, "autoload": { - "psr-0": { - "PEAR": "" - } + "classmap": [ + "PEAR/" + ] }, "notification-url": "https://packagist.org/downloads/", "include-path": [ @@ -994,7 +994,7 @@ "keywords": [ "exception" ], - "time": "2015-02-10T20:07:52+00:00" + "time": "2019-12-10T10:24:42+00:00" }, { "name": "psr/container", @@ -1094,16 +1094,16 @@ }, { "name": "symfony/console", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201" + "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f0aea3df20d15635b3cb9730ca5eea1c65b7f201", - "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201", + "url": "https://api.github.com/repos/symfony/console/zipball/82437719dab1e6bdd28726af14cb345c2ec816d0", + "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0", "shasum": "" }, "require": { @@ -1166,11 +1166,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-12-01T10:06:17+00:00" + "time": "2019-12-17T10:32:23+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1298,7 +1298,7 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -1348,7 +1348,7 @@ }, { "name": "symfony/finder", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -1679,16 +1679,16 @@ }, { "name": "symfony/yaml", - "version": "v4.4.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "76de473358fe802578a415d5bb43c296cf09d211" + "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/76de473358fe802578a415d5bb43c296cf09d211", - "reference": "76de473358fe802578a415d5bb43c296cf09d211", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a08832b974dd5fafe3085a66d41fe4c84bb2628c", + "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c", "shasum": "" }, "require": { @@ -1734,7 +1734,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-11-12T14:51:11+00:00" + "time": "2019-12-10T10:33:21+00:00" } ], "packages-dev": [], From 9e1087914ceb61bfde256e6e781ba587195d925f Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 20 Jan 2020 00:36:42 -0500 Subject: [PATCH 02/14] Change tool dependencies to "dev" type --- vendor-bin/csfixer/composer.json | 2 +- vendor-bin/csfixer/composer.lock | 6 +++--- vendor-bin/daux/composer.json | 2 +- vendor-bin/daux/composer.lock | 6 +++--- vendor-bin/phpunit/composer.json | 2 +- vendor-bin/phpunit/composer.lock | 6 +++--- vendor-bin/robo/composer.json | 4 +--- vendor-bin/robo/composer.lock | 6 +++--- 8 files changed, 16 insertions(+), 18 deletions(-) diff --git a/vendor-bin/csfixer/composer.json b/vendor-bin/csfixer/composer.json index 3fd8b5d7..c49c0755 100644 --- a/vendor-bin/csfixer/composer.json +++ b/vendor-bin/csfixer/composer.json @@ -1,5 +1,5 @@ { - "require": { + "require-dev": { "friendsofphp/php-cs-fixer": "^2.8" } } diff --git a/vendor-bin/csfixer/composer.lock b/vendor-bin/csfixer/composer.lock index 721b3e35..bfe93215 100644 --- a/vendor-bin/csfixer/composer.lock +++ b/vendor-bin/csfixer/composer.lock @@ -4,8 +4,9 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3fb53f1e3b4dd21c4d1e88c3ffd570ca", - "packages": [ + "content-hash": "dec0bf343ea4650da0303df8dfb2ab40", + "packages": [], + "packages-dev": [ { "name": "composer/semver", "version": "1.5.1", @@ -1372,7 +1373,6 @@ "time": "2019-11-18T17:27:11+00:00" } ], - "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": [], diff --git a/vendor-bin/daux/composer.json b/vendor-bin/daux/composer.json index 723bdf0e..75452ad2 100644 --- a/vendor-bin/daux/composer.json +++ b/vendor-bin/daux/composer.json @@ -1,5 +1,5 @@ { - "require": { + "require-dev": { "daux/daux.io": "^0.11" } } diff --git a/vendor-bin/daux/composer.lock b/vendor-bin/daux/composer.lock index 4bbbe450..c53a0572 100644 --- a/vendor-bin/daux/composer.lock +++ b/vendor-bin/daux/composer.lock @@ -4,8 +4,9 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6d944ffdc165b3e6f14e71a82b67a57d", - "packages": [ + "content-hash": "c1f427736a854f73400b9e527724a254", + "packages": [], + "packages-dev": [ { "name": "daux/daux.io", "version": "0.11.1", @@ -1557,7 +1558,6 @@ "time": "2018-03-20T13:36:33+00:00" } ], - "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": [], diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json index cf21bc19..bfb4453b 100644 --- a/vendor-bin/phpunit/composer.json +++ b/vendor-bin/phpunit/composer.json @@ -1,5 +1,5 @@ { - "require": { + "require-dev": { "phpunit/phpunit": "^8.0", "dms/phpunit-arraysubset-asserts": "^0.1", "phake/phake": "^3.0", diff --git a/vendor-bin/phpunit/composer.lock b/vendor-bin/phpunit/composer.lock index 02f49dd1..3c3867b5 100644 --- a/vendor-bin/phpunit/composer.lock +++ b/vendor-bin/phpunit/composer.lock @@ -4,8 +4,9 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1b9c1eee014ebc012eb65b77de64c784", - "packages": [ + "content-hash": "af132f4314b7e577912ffde57af60aab", + "packages": [], + "packages-dev": [ { "name": "clue/arguments", "version": "v2.0.0", @@ -1811,7 +1812,6 @@ "time": "2015-12-17T08:42:14+00:00" } ], - "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": [], diff --git a/vendor-bin/robo/composer.json b/vendor-bin/robo/composer.json index 58e4932b..54a362d2 100644 --- a/vendor-bin/robo/composer.json +++ b/vendor-bin/robo/composer.json @@ -1,9 +1,7 @@ { - "require": { + "require-dev": { "consolidation/robo": "^1.1", "pear/archive_tar": "^1.4", "symfony/process": "^3.0" - }, - "require-dev": { } } diff --git a/vendor-bin/robo/composer.lock b/vendor-bin/robo/composer.lock index 73268710..49fe7d99 100644 --- a/vendor-bin/robo/composer.lock +++ b/vendor-bin/robo/composer.lock @@ -4,8 +4,9 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d95cf402fed434140db8ae87c3c8bf32", - "packages": [ + "content-hash": "a4e3a5e9da2703b2a1acc144e941a4ac", + "packages": [], + "packages-dev": [ { "name": "consolidation/annotated-command", "version": "2.12.0", @@ -1737,7 +1738,6 @@ "time": "2019-12-10T10:33:21+00:00" } ], - "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": [], From 0565553d4a80dc952232710eff62c06d1d20a11b Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 20 Jan 2020 00:38:38 -0500 Subject: [PATCH 03/14] Change PHP requirement in manual --- docs/en/020_Getting_Started/010_Requirements.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/020_Getting_Started/010_Requirements.md b/docs/en/020_Getting_Started/010_Requirements.md index ba1b06d5..f7818699 100644 --- a/docs/en/020_Getting_Started/010_Requirements.md +++ b/docs/en/020_Getting_Started/010_Requirements.md @@ -1,7 +1,7 @@ The Arsse has the following requirements: -- A Linux server running Nginx or Apache 2.4 (tested on Ubuntu 16.04 and 18.04) -- PHP 7.0.7 or later with the following extensions: +- A Linux server running Nginx or Apache 2.4 +- PHP 7.1.0 or later with the following extensions: - [intl](http://php.net/manual/en/book.intl.php), [json](http://php.net/manual/en/book.json.php), [hash](http://php.net/manual/en/book.hash.php), and [dom](http://php.net/manual/en/book.dom.php) - [simplexml](http://php.net/manual/en/book.simplexml.php), and [iconv](http://php.net/manual/en/book.iconv.php) - One of: From 5838af892f6c05d455ebe4672644cb6d75e17411 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 20 Jan 2020 10:40:05 -0500 Subject: [PATCH 04/14] Replace references to Zend with Laminas --- CHANGELOG | 6 ++++++ arsse.php | 2 +- lib/REST.php | 4 ++-- lib/REST/Fever/API.php | 6 +++--- lib/REST/NextcloudNews/V1_2.php | 4 ++-- lib/REST/NextcloudNews/Versions.php | 4 ++-- lib/REST/TinyTinyRSS/API.php | 4 ++-- lib/REST/TinyTinyRSS/Icon.php | 2 +- tests/cases/Misc/TestHTTP.php | 4 ++-- tests/cases/REST/Fever/TestAPI.php | 8 ++++---- tests/cases/REST/NextcloudNews/TestV1_2.php | 4 ++-- tests/cases/REST/NextcloudNews/TestVersions.php | 6 +++--- tests/cases/REST/TestREST.php | 10 +++++----- tests/cases/REST/TinyTinyRSS/TestAPI.php | 6 +++--- tests/cases/REST/TinyTinyRSS/TestIcon.php | 4 ++-- tests/lib/AbstractTest.php | 6 +++--- 16 files changed, 43 insertions(+), 37 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7aac0189..f5618ba8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +Version 0.8.3 (2020-??-??) +========================== + +Changes: +- Officially require PHP 7.1 (effectively required since version 0.8.0) + Version 0.8.2 (2019-12-07) ========================== diff --git a/arsse.php b/arsse.php index 0cfa0ae4..1fe1870a 100644 --- a/arsse.php +++ b/arsse.php @@ -25,7 +25,7 @@ if (\PHP_SAPI === "cli") { $conf = file_exists(BASE."config.php") ? new Conf(BASE."config.php") : new Conf; Arsse::load($conf); // handle Web requests - $emitter = new \Zend\HttpHandlerRunner\Emitter\SapiEmitter; + $emitter = new \Laminas\HttpHandlerRunner\Emitter\SapiEmitter; $response = (new REST)->dispatch(); $emitter->emit($response); } diff --git a/lib/REST.php b/lib/REST.php index 07389baf..b375f3c9 100644 --- a/lib/REST.php +++ b/lib/REST.php @@ -11,8 +11,8 @@ use JKingWeb\Arsse\Misc\URL; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\ServerRequestFactory; -use Zend\Diactoros\Response\EmptyResponse; +use Laminas\Diactoros\ServerRequestFactory; +use Laminas\Diactoros\Response\EmptyResponse; class REST { const API_LIST = [ diff --git a/lib/REST/Fever/API.php b/lib/REST/Fever/API.php index 1569c928..21565985 100644 --- a/lib/REST/Fever/API.php +++ b/lib/REST/Fever/API.php @@ -14,9 +14,9 @@ use JKingWeb\Arsse\Db\ExceptionInput; use JKingWeb\Arsse\Misc\HTTP; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\Response\JsonResponse; -use Zend\Diactoros\Response\XmlResponse; -use Zend\Diactoros\Response\EmptyResponse; +use Laminas\Diactoros\Response\JsonResponse; +use Laminas\Diactoros\Response\XmlResponse; +use Laminas\Diactoros\Response\EmptyResponse; class API extends \JKingWeb\Arsse\REST\AbstractHandler { const LEVEL = 3; diff --git a/lib/REST/NextcloudNews/V1_2.php b/lib/REST/NextcloudNews/V1_2.php index f0d2177a..90e7009e 100644 --- a/lib/REST/NextcloudNews/V1_2.php +++ b/lib/REST/NextcloudNews/V1_2.php @@ -19,8 +19,8 @@ use JKingWeb\Arsse\REST\Exception404; use JKingWeb\Arsse\REST\Exception405; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\Response\JsonResponse as Response; -use Zend\Diactoros\Response\EmptyResponse; +use Laminas\Diactoros\Response\JsonResponse as Response; +use Laminas\Diactoros\Response\EmptyResponse; class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler { const REALM = "Nextcloud News API v1-2"; diff --git a/lib/REST/NextcloudNews/Versions.php b/lib/REST/NextcloudNews/Versions.php index 78d4ac7f..a8db7a71 100644 --- a/lib/REST/NextcloudNews/Versions.php +++ b/lib/REST/NextcloudNews/Versions.php @@ -8,8 +8,8 @@ namespace JKingWeb\Arsse\REST\NextcloudNews; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\Response\JsonResponse as Response; -use Zend\Diactoros\Response\EmptyResponse; +use Laminas\Diactoros\Response\JsonResponse as Response; +use Laminas\Diactoros\Response\EmptyResponse; class Versions implements \JKingWeb\Arsse\REST\Handler { public function __construct() { diff --git a/lib/REST/TinyTinyRSS/API.php b/lib/REST/TinyTinyRSS/API.php index 56a24374..4049a2a0 100644 --- a/lib/REST/TinyTinyRSS/API.php +++ b/lib/REST/TinyTinyRSS/API.php @@ -20,8 +20,8 @@ use JKingWeb\Arsse\Db\ResultEmpty; use JKingWeb\Arsse\Feed\Exception as FeedException; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\Response\JsonResponse as Response; -use Zend\Diactoros\Response\EmptyResponse; +use Laminas\Diactoros\Response\JsonResponse as Response; +use Laminas\Diactoros\Response\EmptyResponse; class API extends \JKingWeb\Arsse\REST\AbstractHandler { const LEVEL = 14; // emulated API level diff --git a/lib/REST/TinyTinyRSS/Icon.php b/lib/REST/TinyTinyRSS/Icon.php index 0415bf2c..c5c9030e 100644 --- a/lib/REST/TinyTinyRSS/Icon.php +++ b/lib/REST/TinyTinyRSS/Icon.php @@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\REST\TinyTinyRSS; use JKingWeb\Arsse\Arsse; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\Response\EmptyResponse as Response; +use Laminas\Diactoros\Response\EmptyResponse as Response; class Icon extends \JKingWeb\Arsse\REST\AbstractHandler { public function __construct() { diff --git a/tests/cases/Misc/TestHTTP.php b/tests/cases/Misc/TestHTTP.php index 70d1316b..8430ddaa 100644 --- a/tests/cases/Misc/TestHTTP.php +++ b/tests/cases/Misc/TestHTTP.php @@ -13,9 +13,9 @@ use Psr\Http\Message\ResponseInterface; class TestHTTP extends \JKingWeb\Arsse\Test\AbstractTest { /** @dataProvider provideMediaTypes */ public function testMatchMediaType(string $header, array $types, bool $exp) { - $msg = (new \Zend\Diactoros\Request)->withHeader("Content-Type", $header); + $msg = (new \Laminas\Diactoros\Request)->withHeader("Content-Type", $header); $this->assertSame($exp, HTTP::matchType($msg, ...$types)); - $msg = (new \Zend\Diactoros\Response)->withHeader("Content-Type", $header); + $msg = (new \Laminas\Diactoros\Response)->withHeader("Content-Type", $header); $this->assertSame($exp, HTTP::matchType($msg, ...$types)); } diff --git a/tests/cases/REST/Fever/TestAPI.php b/tests/cases/REST/Fever/TestAPI.php index ad54243c..f7cd3c53 100644 --- a/tests/cases/REST/Fever/TestAPI.php +++ b/tests/cases/REST/Fever/TestAPI.php @@ -15,10 +15,10 @@ use JKingWeb\Arsse\Db\ExceptionInput; use JKingWeb\Arsse\Db\Transaction; use JKingWeb\Arsse\REST\Fever\API; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\ServerRequest; -use Zend\Diactoros\Response\JsonResponse; -use Zend\Diactoros\Response\XmlResponse; -use Zend\Diactoros\Response\EmptyResponse; +use Laminas\Diactoros\ServerRequest; +use Laminas\Diactoros\Response\JsonResponse; +use Laminas\Diactoros\Response\XmlResponse; +use Laminas\Diactoros\Response\EmptyResponse; /** @covers \JKingWeb\Arsse\REST\Fever\API */ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { diff --git a/tests/cases/REST/NextcloudNews/TestV1_2.php b/tests/cases/REST/NextcloudNews/TestV1_2.php index af3d9d54..9aa3c8e9 100644 --- a/tests/cases/REST/NextcloudNews/TestV1_2.php +++ b/tests/cases/REST/NextcloudNews/TestV1_2.php @@ -16,8 +16,8 @@ use JKingWeb\Arsse\Db\ExceptionInput; use JKingWeb\Arsse\Db\Transaction; use JKingWeb\Arsse\REST\NextcloudNews\V1_2; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\Response\JsonResponse as Response; -use Zend\Diactoros\Response\EmptyResponse; +use Laminas\Diactoros\Response\JsonResponse as Response; +use Laminas\Diactoros\Response\EmptyResponse; /** @covers \JKingWeb\Arsse\REST\NextcloudNews\V1_2 */ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { diff --git a/tests/cases/REST/NextcloudNews/TestVersions.php b/tests/cases/REST/NextcloudNews/TestVersions.php index 2fc40b80..7c65ddbf 100644 --- a/tests/cases/REST/NextcloudNews/TestVersions.php +++ b/tests/cases/REST/NextcloudNews/TestVersions.php @@ -8,9 +8,9 @@ namespace JKingWeb\Arsse\TestCase\REST\NextcloudNews; use JKingWeb\Arsse\REST\NextcloudNews\Versions; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\ServerRequest; -use Zend\Diactoros\Response\JsonResponse as Response; -use Zend\Diactoros\Response\EmptyResponse; +use Laminas\Diactoros\ServerRequest; +use Laminas\Diactoros\Response\JsonResponse as Response; +use Laminas\Diactoros\Response\EmptyResponse; /** @covers \JKingWeb\Arsse\REST\NextcloudNews\Versions */ class TestVersions extends \JKingWeb\Arsse\Test\AbstractTest { diff --git a/tests/cases/REST/TestREST.php b/tests/cases/REST/TestREST.php index 36c1753a..249e80c1 100644 --- a/tests/cases/REST/TestREST.php +++ b/tests/cases/REST/TestREST.php @@ -15,11 +15,11 @@ use JKingWeb\Arsse\REST\NextcloudNews\V1_2 as NCN; use JKingWeb\Arsse\REST\TinyTinyRSS\API as TTRSS; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\Request; -use Zend\Diactoros\Response; -use Zend\Diactoros\ServerRequest; -use Zend\Diactoros\Response\TextResponse; -use Zend\Diactoros\Response\EmptyResponse; +use Laminas\Diactoros\Request; +use Laminas\Diactoros\Response; +use Laminas\Diactoros\ServerRequest; +use Laminas\Diactoros\Response\TextResponse; +use Laminas\Diactoros\Response\EmptyResponse; /** @covers \JKingWeb\Arsse\REST */ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { diff --git a/tests/cases/REST/TinyTinyRSS/TestAPI.php b/tests/cases/REST/TinyTinyRSS/TestAPI.php index d3a275ac..f25c4ccb 100644 --- a/tests/cases/REST/TinyTinyRSS/TestAPI.php +++ b/tests/cases/REST/TinyTinyRSS/TestAPI.php @@ -16,9 +16,9 @@ use JKingWeb\Arsse\Db\ExceptionInput; use JKingWeb\Arsse\Db\Transaction; use JKingWeb\Arsse\REST\TinyTinyRSS\API; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\ServerRequest; -use Zend\Diactoros\Response\JsonResponse as Response; -use Zend\Diactoros\Response\EmptyResponse; +use Laminas\Diactoros\ServerRequest; +use Laminas\Diactoros\Response\JsonResponse as Response; +use Laminas\Diactoros\Response\EmptyResponse; /** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\API * @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Exception */ diff --git a/tests/cases/REST/TinyTinyRSS/TestIcon.php b/tests/cases/REST/TinyTinyRSS/TestIcon.php index d7f50626..fd330945 100644 --- a/tests/cases/REST/TinyTinyRSS/TestIcon.php +++ b/tests/cases/REST/TinyTinyRSS/TestIcon.php @@ -11,8 +11,8 @@ use JKingWeb\Arsse\User; use JKingWeb\Arsse\Database; use JKingWeb\Arsse\REST\TinyTinyRSS\Icon; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\ServerRequest; -use Zend\Diactoros\Response\EmptyResponse as Response; +use Laminas\Diactoros\ServerRequest; +use Laminas\Diactoros\Response\EmptyResponse as Response; /** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Icon */ class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest { diff --git a/tests/lib/AbstractTest.php b/tests/lib/AbstractTest.php index 1581b0a6..bb0c688f 100644 --- a/tests/lib/AbstractTest.php +++ b/tests/lib/AbstractTest.php @@ -18,9 +18,9 @@ use Psr\Http\Message\MessageInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; -use Zend\Diactoros\ServerRequest; -use Zend\Diactoros\Response\JsonResponse; -use Zend\Diactoros\Response\XmlResponse; +use Laminas\Diactoros\ServerRequest; +use Laminas\Diactoros\Response\JsonResponse; +use Laminas\Diactoros\Response\XmlResponse; /** @coversNothing */ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { From bbace7a0acfa0e4ab7abf8c519ea385ad417bc45 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 20 Jan 2020 13:34:03 -0500 Subject: [PATCH 05/14] Use void and nullable return types where practical --- lib/Arsse.php | 2 +- lib/CLI.php | 4 +- lib/Database.php | 8 +- lib/Db/AbstractResult.php | 2 +- lib/Db/MySQL/Driver.php | 2 +- lib/Db/MySQL/PDODriver.php | 2 +- lib/Db/PostgreSQL/Driver.php | 2 +- lib/Db/PostgreSQL/PDODriver.php | 2 +- lib/Db/SQLite3/Driver.php | 4 +- lib/Db/SQLite3/PDODriver.php | 2 +- lib/Feed.php | 2 +- lib/Misc/Date.php | 8 +- lib/Misc/ValueInfo.php | 2 +- lib/REST/Fever/API.php | 4 +- lib/REST/TinyTinyRSS/Search.php | 2 +- lib/User/Internal/Driver.php | 6 +- tests/cases/CLI/TestCLI.php | 30 ++--- tests/cases/Conf/TestConf.php | 32 ++--- tests/cases/Database/SeriesArticle.php | 120 +++++++++--------- tests/cases/Database/SeriesCleanup.php | 20 +-- tests/cases/Database/SeriesFeed.php | 20 +-- tests/cases/Database/SeriesFolder.php | 92 +++++++------- tests/cases/Database/SeriesLabel.php | 96 +++++++------- tests/cases/Database/SeriesMeta.php | 14 +- tests/cases/Database/SeriesMiscellany.php | 12 +- tests/cases/Database/SeriesSession.php | 24 ++-- tests/cases/Database/SeriesSubscription.php | 92 +++++++------- tests/cases/Database/SeriesTag.php | 100 +++++++-------- tests/cases/Database/SeriesToken.php | 24 ++-- tests/cases/Database/SeriesUser.php | 38 +++--- tests/cases/Database/TestDatabase.php | 4 +- tests/cases/Db/BaseDriver.php | 70 +++++----- tests/cases/Db/BaseResult.php | 18 +-- tests/cases/Db/BaseStatement.php | 18 +-- tests/cases/Db/BaseUpdate.php | 24 ++-- tests/cases/Db/MySQL/TestCreation.php | 2 +- tests/cases/Db/MySQL/TestStatement.php | 2 +- tests/cases/Db/MySQLPDO/TestCreation.php | 2 +- tests/cases/Db/PostgreSQL/TestCreation.php | 4 +- tests/cases/Db/PostgreSQLPDO/TestCreation.php | 4 +- tests/cases/Db/SQLite3/TestCreation.php | 26 ++-- tests/cases/Db/SQLite3PDO/TestCreation.php | 26 ++-- tests/cases/Db/TestResultAggregate.php | 14 +- tests/cases/Db/TestResultEmpty.php | 10 +- tests/cases/Db/TestTransaction.php | 6 +- tests/cases/Exception/TestException.php | 14 +- tests/cases/Feed/TestFeed.php | 34 ++--- tests/cases/Feed/TestFetching.php | 18 +-- tests/cases/ImportExport/TestFile.php | 4 +- tests/cases/ImportExport/TestImportExport.php | 16 +-- tests/cases/ImportExport/TestOPML.php | 8 +- tests/cases/Lang/TestBasic.php | 10 +- tests/cases/Lang/TestComplex.php | 24 ++-- tests/cases/Lang/TestErrors.php | 24 ++-- tests/cases/Misc/TestContext.php | 12 +- tests/cases/Misc/TestDate.php | 8 +- tests/cases/Misc/TestHTTP.php | 4 +- tests/cases/Misc/TestQuery.php | 16 +-- tests/cases/Misc/TestURL.php | 8 +- tests/cases/Misc/TestValueInfo.php | 16 +-- tests/cases/REST/Fever/TestAPI.php | 28 ++-- tests/cases/REST/Fever/TestUser.php | 6 +- tests/cases/REST/NextcloudNews/TestV1_2.php | 66 +++++----- .../cases/REST/NextcloudNews/TestVersions.php | 8 +- tests/cases/REST/TestREST.php | 18 +-- tests/cases/REST/TinyTinyRSS/TestAPI.php | 78 ++++++------ tests/cases/REST/TinyTinyRSS/TestIcon.php | 8 +- tests/cases/REST/TinyTinyRSS/TestSearch.php | 2 +- tests/cases/Service/TestSerial.php | 8 +- tests/cases/Service/TestService.php | 12 +- tests/cases/Service/TestSubprocess.php | 8 +- tests/cases/TestArsse.php | 4 +- tests/cases/User/TestInternal.php | 22 ++-- tests/cases/User/TestUser.php | 22 ++-- tests/lib/AbstractTest.php | 12 +- tests/lib/DatabaseDrivers/MySQL.php | 4 +- tests/lib/DatabaseDrivers/MySQLPDO.php | 4 +- tests/lib/DatabaseDrivers/PostgreSQL.php | 6 +- tests/lib/DatabaseDrivers/PostgreSQLPDO.php | 4 +- tests/lib/DatabaseDrivers/SQLite3.php | 4 +- tests/lib/DatabaseDrivers/SQLite3PDO.php | 4 +- 81 files changed, 771 insertions(+), 771 deletions(-) diff --git a/lib/Arsse.php b/lib/Arsse.php index c122e897..6e120392 100644 --- a/lib/Arsse.php +++ b/lib/Arsse.php @@ -18,7 +18,7 @@ class Arsse { /** @var User */ public static $user; - public static function load(Conf $conf) { + public static function load(Conf $conf): void { static::$lang = static::$lang ?? new Lang; static::$conf = $conf; static::$lang->set($conf->lang); diff --git a/lib/CLI.php b/lib/CLI.php index 58bacedf..017ad461 100644 --- a/lib/CLI.php +++ b/lib/CLI.php @@ -160,7 +160,7 @@ USAGE_TEXT; return ($file === "-" ? null : $file) ?? $stdinOrStdout; } - public function dispatch(array $argv = null) { + public function dispatch(array $argv = null): int { $argv = $argv ?? $_SERVER['argv']; $argv0 = array_shift($argv); $args = \Docopt::handle($this->usage($argv0), [ @@ -210,7 +210,7 @@ USAGE_TEXT; } // @codeCoverageIgnore /** @codeCoverageIgnore */ - protected function logError(string $msg) { + protected function logError(string $msg): void { fwrite(STDERR, $msg.\PHP_EOL); } diff --git a/lib/Database.php b/lib/Database.php index bcca3eb0..eadabd70 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -218,7 +218,7 @@ class Database { } /** Retrieve a value from the metadata table. If the key is not set null is returned */ - public function metaGet(string $key) { + public function metaGet(string $key): ?string { return $this->db->prepare("SELECT value from arsse_meta where \"key\" = ?", "str")->run($key)->getValue(); } @@ -284,7 +284,7 @@ class Database { } /** Retrieves the hashed password of a user */ - public function userPasswordGet(string $user) { + public function userPasswordGet(string $user): ?string { if (!Arsse::$user->authorize($user, __FUNCTION__)) { throw new User\ExceptionAuthz("notAuthorized", ["action" => __FUNCTION__, "user" => $user]); } elseif (!$this->userExists($user)) { @@ -617,7 +617,7 @@ class Database { } /** Ensures an operation to rename and/or move a folder does not result in a conflict or circular dependence, and raises an exception otherwise */ - protected function folderValidateMove(string $user, $id = null, $parent = null, string $name = null) { + protected function folderValidateMove(string $user, $id = null, $parent = null, string $name = null): ?int { $errData = ["action" => $this->caller(), "field" => "parent", 'id' => $parent]; if (!$id) { // the root cannot be moved @@ -932,7 +932,7 @@ class Database { } /** Returns the time at which any of a user's subscriptions (or a specific subscription) was last refreshed, as a DateTimeImmutable object */ - public function subscriptionRefreshed(string $user, int $id = null) { + public function subscriptionRefreshed(string $user, int $id = null): ?\DateTimeInterface { if (!Arsse::$user->authorize($user, __FUNCTION__)) { throw new User\ExceptionAuthz("notAuthorized", ["action" => __FUNCTION__, "user" => $user]); } diff --git a/lib/Db/AbstractResult.php b/lib/Db/AbstractResult.php index 6086cf68..4ae62bbb 100644 --- a/lib/Db/AbstractResult.php +++ b/lib/Db/AbstractResult.php @@ -22,7 +22,7 @@ abstract class AbstractResult implements Result { } } - public function getRow() { + public function getRow(): ?array { if ($this->valid()) { $out = $this->cur; $this->next(); diff --git a/lib/Db/MySQL/Driver.php b/lib/Db/MySQL/Driver.php index 0f8712b5..6be8c3f4 100644 --- a/lib/Db/MySQL/Driver.php +++ b/lib/Db/MySQL/Driver.php @@ -158,7 +158,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver { return class_exists("mysqli"); } - protected function makeConnection(string $db, string $user, string $password, string $host, int $port, string $socket) { + protected function makeConnection(string $db, string $user, string $password, string $host, int $port, string $socket): void { $this->db = mysqli_init(); $this->db->options(\MYSQLI_OPT_CONNECT_TIMEOUT, ceil(Arsse::$conf->dbTimeoutConnect)); @$this->db->real_connect($host, $user, $password, $db, $port, $socket); diff --git a/lib/Db/MySQL/PDODriver.php b/lib/Db/MySQL/PDODriver.php index 4439b33c..a2947104 100644 --- a/lib/Db/MySQL/PDODriver.php +++ b/lib/Db/MySQL/PDODriver.php @@ -18,7 +18,7 @@ class PDODriver extends Driver { return class_exists("PDO") && in_array("mysql", \PDO::getAvailableDrivers()); } - protected function makeConnection(string $db, string $user, string $password, string $host, int $port, string $socket) { + protected function makeConnection(string $db, string $user, string $password, string $host, int $port, string $socket): void { $dsn = "mysql:".implode(";", [ "charset=utf8mb4", "dbname=$db", diff --git a/lib/Db/PostgreSQL/Driver.php b/lib/Db/PostgreSQL/Driver.php index 94497ddf..f06518ec 100644 --- a/lib/Db/PostgreSQL/Driver.php +++ b/lib/Db/PostgreSQL/Driver.php @@ -181,7 +181,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver { return \extension_loaded("pgsql"); } - protected function makeConnection(string $user, string $pass, string $db, string $host, int $port, string $service) { + protected function makeConnection(string $user, string $pass, string $db, string $host, int $port, string $service): void { $dsn = $this->makeconnectionString(false, $user, $pass, $db, $host, $port, $service); set_error_handler(function(int $code, string $msg) { $msg = substr($msg, 62); diff --git a/lib/Db/PostgreSQL/PDODriver.php b/lib/Db/PostgreSQL/PDODriver.php index c754a38f..fe6f0a55 100644 --- a/lib/Db/PostgreSQL/PDODriver.php +++ b/lib/Db/PostgreSQL/PDODriver.php @@ -18,7 +18,7 @@ class PDODriver extends Driver { return class_exists("PDO") && in_array("pgsql", \PDO::getAvailableDrivers()); } - protected function makeConnection(string $user, string $pass, string $db, string $host, int $port, string $service) { + protected function makeConnection(string $user, string $pass, string $db, string $host, int $port, string $service): void { $dsn = $this->makeconnectionString(true, $user, $pass, $db, $host, $port, $service); try { $this->db = new \PDO("pgsql:$dsn", $user, $pass, [ diff --git a/lib/Db/SQLite3/Driver.php b/lib/Db/SQLite3/Driver.php index d0866c02..d76dedd1 100644 --- a/lib/Db/SQLite3/Driver.php +++ b/lib/Db/SQLite3/Driver.php @@ -69,13 +69,13 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver { return class_exists("SQLite3"); } - protected function makeConnection(string $file, string $key) { + protected function makeConnection(string $file, string $key): void { $this->db = new \SQLite3($file, \SQLITE3_OPEN_READWRITE | \SQLITE3_OPEN_CREATE, $key); // enable exceptions $this->db->enableExceptions(true); } - protected function setTimeout(int $msec) { + protected function setTimeout(int $msec): void { $this->exec("PRAGMA busy_timeout = $msec"); } diff --git a/lib/Db/SQLite3/PDODriver.php b/lib/Db/SQLite3/PDODriver.php index 12ffc973..c590d510 100644 --- a/lib/Db/SQLite3/PDODriver.php +++ b/lib/Db/SQLite3/PDODriver.php @@ -16,7 +16,7 @@ class PDODriver extends AbstractPDODriver { return class_exists("PDO") && in_array("sqlite", \PDO::getAvailableDrivers()); } - protected function makeConnection(string $file, string $key) { + protected function makeConnection(string $file, string $key): void { $this->db = new \PDO("sqlite:".$file, "", "", [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, ]); diff --git a/lib/Feed.php b/lib/Feed.php index 767063c1..859bd06e 100644 --- a/lib/Feed.php +++ b/lib/Feed.php @@ -390,7 +390,7 @@ class Feed { return $offset; } - protected function computeLastModified() { + protected function computeLastModified(): ?\DateTimeInterface { if (!$this->modified) { return $this->lastModified; // @codeCoverageIgnore } diff --git a/lib/Misc/Date.php b/lib/Misc/Date.php index f4b34850..0b519dc4 100644 --- a/lib/Misc/Date.php +++ b/lib/Misc/Date.php @@ -21,19 +21,19 @@ class Date { return $out; } - public static function normalize($date, string $inFormat = null) { + public static function normalize($date, string $inFormat = null): ?\DateTimeInterface { return ValueInfo::normalize($date, ValueInfo::T_DATE, $inFormat); } - public static function add($interval, $date = "now") { + public static function add($interval, $date = "now"): ?\DateTimeInterface { return self::modify("add", $interval, $date); } - public static function sub($interval, $date = "now") { + public static function sub($interval, $date = "now"): ?\DateTimeInterface { return self::modify("sub", $interval, $date); } - protected static function modify(string $func, $interval, $date) { + protected static function modify(string $func, $interval, $date): ?\DateTimeInterface { $date = self::normalize($date); $interval = (!$interval instanceof \DateInterval) ? ValueInfo::normalize($interval, ValueInfo::T_INTERVAL) : $interval; return $date ? $date->$func($interval) : null; diff --git a/lib/Misc/ValueInfo.php b/lib/Misc/ValueInfo.php index 1b3d2608..75a81bae 100644 --- a/lib/Misc/ValueInfo.php +++ b/lib/Misc/ValueInfo.php @@ -499,7 +499,7 @@ class ValueInfo { } } - public static function bool($value, bool $default = null) { + public static function bool($value, bool $default = null): ?bool { if (is_null($value) || ValueInfo::str($value) & ValueInfo::WHITE) { return $default; } diff --git a/lib/REST/Fever/API.php b/lib/REST/Fever/API.php index 21565985..776490c9 100644 --- a/lib/REST/Fever/API.php +++ b/lib/REST/Fever/API.php @@ -306,7 +306,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler { return $listSaved; } - protected function setUnread() { + protected function setUnread(): void { $lastUnread = Arsse::$db->articleList(Arsse::$user->id, (new Context)->limit(1), ["marked_date"], ["marked_date desc"])->getValue(); if (!$lastUnread) { // there are no articles @@ -322,7 +322,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler { Arsse::$db->articleMark(Arsse::$user->id, ['read' => false], $c); } - protected function getRefreshTime() { + protected function getRefreshTime(): ?int { return Date::transform(Arsse::$db->subscriptionRefreshed(Arsse::$user->id), "unix"); } diff --git a/lib/REST/TinyTinyRSS/Search.php b/lib/REST/TinyTinyRSS/Search.php index f7913616..929ef4d8 100644 --- a/lib/REST/TinyTinyRSS/Search.php +++ b/lib/REST/TinyTinyRSS/Search.php @@ -32,7 +32,7 @@ class Search { "" => "searchTerms", ]; - public static function parse(string $search, Context $context = null) { + public static function parse(string $search, Context $context = null): ?Context { // normalize the input $search = strtolower(trim(preg_replace("<\s+>", " ", $search))); // set initial state diff --git a/lib/User/Internal/Driver.php b/lib/User/Internal/Driver.php index d50777a1..c9e78d1c 100644 --- a/lib/User/Internal/Driver.php +++ b/lib/User/Internal/Driver.php @@ -40,7 +40,7 @@ class Driver implements \JKingWeb\Arsse\User\Driver { return Arsse::$db->userExists($user); } - public function userAdd(string $user, string $password = null) { + public function userAdd(string $user, string $password = null): ?string { if (isset($password)) { // only add the user if the password is not null; the user manager will retry with a generated password if null is returned Arsse::$db->userAdd($user, $password); @@ -56,7 +56,7 @@ class Driver implements \JKingWeb\Arsse\User\Driver { return Arsse::$db->userList(); } - public function userPasswordSet(string $user, string $newPassword = null, string $oldPassword = null) { + public function userPasswordSet(string $user, string $newPassword = null, string $oldPassword = null): ?string { // do nothing: the internal database is updated regardless of what the driver does (assuming it does not throw an exception) return $newPassword; } @@ -71,7 +71,7 @@ class Driver implements \JKingWeb\Arsse\User\Driver { } } - protected function userPasswordGet(string $user) { + protected function userPasswordGet(string $user): ?string { return Arsse::$db->userPasswordGet($user); } } diff --git a/tests/cases/CLI/TestCLI.php b/tests/cases/CLI/TestCLI.php index a0b4197a..a350ce1e 100644 --- a/tests/cases/CLI/TestCLI.php +++ b/tests/cases/CLI/TestCLI.php @@ -24,7 +24,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::when($this->cli)->loadConf->thenReturn(true); } - public function assertConsole(CLI $cli, string $command, int $exitStatus, string $output = "", bool $pattern = false) { + public function assertConsole(CLI $cli, string $command, int $exitStatus, string $output = "", bool $pattern = false): void { $argv = \Clue\Arguments\split($command); $output = strlen($output) ? $output.\PHP_EOL : ""; if ($pattern) { @@ -35,13 +35,13 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exitStatus, $cli->dispatch($argv)); } - public function testPrintVersion() { + public function testPrintVersion():void { $this->assertConsole($this->cli, "arsse.php --version", 0, Arsse::VERSION); \Phake::verify($this->cli, \Phake::times(0))->loadConf; } /** @dataProvider provideHelpText */ - public function testPrintHelp(string $cmd, string $name) { + public function testPrintHelp(string $cmd, string $name):void { $this->assertConsole($this->cli, $cmd, 0, str_replace("arsse.php", $name, CLI::USAGE)); \Phake::verify($this->cli, \Phake::times(0))->loadConf; } @@ -57,7 +57,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testStartTheDaemon() { + public function testStartTheDaemon():void { $srv = \Phake::mock(Service::class); \Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable); \Phake::when($this->cli)->getInstance(Service::class)->thenReturn($srv); @@ -67,7 +67,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($this->cli)->getInstance(Service::class); } - public function testRefreshAllFeeds() { + public function testRefreshAllFeeds():void { $srv = \Phake::mock(Service::class); \Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable); \Phake::when($this->cli)->getInstance(Service::class)->thenReturn($srv); @@ -78,7 +78,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideFeedUpdates */ - public function testRefreshAFeed(string $cmd, int $exitStatus, string $output) { + public function testRefreshAFeed(string $cmd, int $exitStatus, string $output):void { Arsse::$db = \Phake::mock(Database::class); \Phake::when(Arsse::$db)->feedUpdate(1, true)->thenReturn(true); \Phake::when(Arsse::$db)->feedUpdate(2, true)->thenThrow(new \JKingWeb\Arsse\Feed\Exception("http://example.com/", new \PicoFeed\Client\InvalidUrlException)); @@ -95,7 +95,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideDefaultConfigurationSaves */ - public function testSaveTheDefaultConfiguration(string $cmd, int $exitStatus, string $file) { + public function testSaveTheDefaultConfiguration(string $cmd, int $exitStatus, string $file):void { $conf = \Phake::mock(Conf::class); \Phake::when($conf)->exportFile("php://output", true)->thenReturn(true); \Phake::when($conf)->exportFile("good.conf", true)->thenReturn(true); @@ -116,7 +116,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserList */ - public function testListUsers(string $cmd, array $list, int $exitStatus, string $output) { + public function testListUsers(string $cmd, array $list, int $exitStatus, string $output):void { // FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead Arsse::$user = $this->createMock(User::class); Arsse::$user->method("list")->willReturn($list); @@ -135,7 +135,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserAdditions */ - public function testAddAUser(string $cmd, int $exitStatus, string $output) { + public function testAddAUser(string $cmd, int $exitStatus, string $output):void { // FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead Arsse::$user = $this->createMock(User::class); Arsse::$user->method("add")->will($this->returnCallback(function($user, $pass = null) { @@ -158,7 +158,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserAuthentication */ - public function testAuthenticateAUser(string $cmd, int $exitStatus, string $output) { + public function testAuthenticateAUser(string $cmd, int $exitStatus, string $output):void { // FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead Arsse::$user = $this->createMock(User::class); Arsse::$user->method("auth")->will($this->returnCallback(function($user, $pass) { @@ -192,7 +192,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserRemovals */ - public function testRemoveAUser(string $cmd, int $exitStatus, string $output) { + public function testRemoveAUser(string $cmd, int $exitStatus, string $output):void { // FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead Arsse::$user = $this->createMock(User::class); Arsse::$user->method("remove")->will($this->returnCallback(function($user) { @@ -212,7 +212,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserPasswordChanges */ - public function testChangeAUserPassword(string $cmd, int $exitStatus, string $output) { + public function testChangeAUserPassword(string $cmd, int $exitStatus, string $output):void { $passwordChange = function($user, $pass = null) { switch ($user) { case "jane.doe@example.com": @@ -242,7 +242,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserPasswordClearings */ - public function testClearAUserPassword(string $cmd, int $exitStatus, string $output) { + public function testClearAUserPassword(string $cmd, int $exitStatus, string $output):void { $passwordClear = function($user) { switch ($user) { case "jane.doe@example.com": @@ -270,7 +270,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideOpmlExports */ - public function testExportToOpml(string $cmd, int $exitStatus, string $file, string $user, bool $flat) { + public function testExportToOpml(string $cmd, int $exitStatus, string $file, string $user, bool $flat):void { $opml = \Phake::mock(OPML::class); \Phake::when($opml)->exportFile("php://output", $user, $flat)->thenReturn(true); \Phake::when($opml)->exportFile("good.opml", $user, $flat)->thenReturn(true); @@ -311,7 +311,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideOpmlImports */ - public function testImportFromOpml(string $cmd, int $exitStatus, string $file, string $user, bool $flat, bool $replace) { + public function testImportFromOpml(string $cmd, int $exitStatus, string $file, string $user, bool $flat, bool $replace):void { $opml = \Phake::mock(OPML::class); \Phake::when($opml)->importFile("php://input", $user, $flat, $replace)->thenReturn(true); \Phake::when($opml)->importFile("good.opml", $user, $flat, $replace)->thenReturn(true); diff --git a/tests/cases/Conf/TestConf.php b/tests/cases/Conf/TestConf.php index f52d3b35..d10d1d4c 100644 --- a/tests/cases/Conf/TestConf.php +++ b/tests/cases/Conf/TestConf.php @@ -38,12 +38,12 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testLoadDefaultValues() { + public function testLoadDefaultValues():void { $this->assertInstanceOf(Conf::class, new Conf); } /** @depends testLoadDefaultValues */ - public function testImportFromArray() { + public function testImportFromArray():void { $arr = [ 'lang' => "xx", 'purgeFeeds' => "P2D", @@ -54,7 +54,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { } /** @depends testImportFromArray */ - public function testImportFromFile() { + public function testImportFromFile():void { $conf = new Conf; $conf->importFile(self::$path."confGood"); $this->assertEquals("xx", $conf->lang); @@ -63,43 +63,43 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { } /** @depends testImportFromFile */ - public function testImportFromMissingFile() { + public function testImportFromMissingFile():void { $this->assertException("fileMissing", "Conf"); $conf = new Conf(self::$path."confMissing"); } /** @depends testImportFromFile */ - public function testImportFromEmptyFile() { + public function testImportFromEmptyFile():void { $this->assertException("fileCorrupt", "Conf"); $conf = new Conf(self::$path."confEmpty"); } /** @depends testImportFromFile */ - public function testImportFromFileWithoutReadPermission() { + public function testImportFromFileWithoutReadPermission():void { $this->assertException("fileUnreadable", "Conf"); $conf = new Conf(self::$path."confUnreadable"); } /** @depends testImportFromFile */ - public function testImportFromFileWhichIsNotAnArray() { + public function testImportFromFileWhichIsNotAnArray():void { $this->assertException("fileCorrupt", "Conf"); $conf = new Conf(self::$path."confNotArray"); } /** @depends testImportFromFile */ - public function testImportFromFileWhichIsNotPhp() { + public function testImportFromFileWhichIsNotPhp():void { $this->assertException("fileCorrupt", "Conf"); // this should not print the output of the non-PHP file $conf = new Conf(self::$path."confNotPHP"); } /** @depends testImportFromFile */ - public function testImportFromCorruptFile() { + public function testImportFromCorruptFile():void { $this->assertException("fileCorrupt", "Conf"); $conf = new Conf(self::$path."confCorrupt"); } - public function testImportBogusValue() { + public function testImportBogusValue():void { $arr = [ 'dbAutoUpdate' => "yes, please", ]; @@ -108,7 +108,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { $conf->import($arr); } - public function testImportBogusDriver() { + public function testImportBogusDriver():void { $arr = [ 'dbDriver' => "this driver does not exist", ]; @@ -117,7 +117,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { $conf->import($arr); } - public function testExportToArray() { + public function testExportToArray():void { $conf = new Conf; $conf->lang = ["en", "fr"]; // should not be exported: not scalar $conf->dbSQLite3File = "test.db"; // should be exported: value changed @@ -138,7 +138,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { /** @depends testExportToArray * @depends testImportFromFile */ - public function testExportToFile() { + public function testExportToFile():void { $conf = new Conf; $conf->lang = ["en", "fr"]; // should not be exported: not scalar $conf->dbSQLite3File = "test.db"; // should be exported: value changed @@ -159,19 +159,19 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { } /** @depends testExportToFile */ - public function testExportToStdout() { + public function testExportToStdout():void { $conf = new Conf(self::$path."confGood"); $conf->exportFile(self::$path."confGood"); $this->expectOutputString(file_get_contents(self::$path."confGood")); $conf->exportFile("php://output"); } - public function testExportToFileWithoutWritePermission() { + public function testExportToFileWithoutWritePermission():void { $this->assertException("fileUnwritable", "Conf"); (new Conf)->exportFile(self::$path."confUnreadable"); } - public function testExportToFileWithoutCreatePermission() { + public function testExportToFileWithoutCreatePermission():void { $this->assertException("fileUncreatable", "Conf"); (new Conf)->exportFile(self::$path."confForbidden/conf"); } diff --git a/tests/cases/Database/SeriesArticle.php b/tests/cases/Database/SeriesArticle.php index 26fc4f02..b560527c 100644 --- a/tests/cases/Database/SeriesArticle.php +++ b/tests/cases/Database/SeriesArticle.php @@ -13,7 +13,7 @@ use JKingWeb\Arsse\Misc\Date; use JKingWeb\Arsse\Misc\ValueInfo; trait SeriesArticle { - protected function setUpSeriesArticle() { + protected function setUpSeriesArticle():void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -408,12 +408,12 @@ trait SeriesArticle { $this->user = "john.doe@example.net"; } - protected function tearDownSeriesArticle() { + protected function tearDownSeriesArticle():void { unset($this->data, $this->matches, $this->fields, $this->checkTables, $this->user); } /** @dataProvider provideContextMatches */ - public function testListArticlesCheckingContext(Context $c, array $exp) { + public function testListArticlesCheckingContext(Context $c, array $exp):void { $ids = array_column($ids = Arsse::$db->articleList("john.doe@example.com", $c, ["id"], ["id"])->getAll(), "id"); sort($ids); sort($exp); @@ -516,7 +516,7 @@ trait SeriesArticle { ]; } - public function testRetrieveArticleIdsForEditions() { + public function testRetrieveArticleIdsForEditions():void { $exp = [ 1 => 1, 2 => 2, @@ -553,17 +553,17 @@ trait SeriesArticle { $this->assertEquals($exp, Arsse::$db->editionArticle(...range(1, 1001))); } - public function testListArticlesOfAMissingFolder() { + public function testListArticlesOfAMissingFolder():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->articleList($this->user, (new Context)->folder(1)); } - public function testListArticlesOfAMissingSubscription() { + public function testListArticlesOfAMissingSubscription():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->articleList($this->user, (new Context)->subscription(1)); } - public function testListArticlesCheckingProperties() { + public function testListArticlesCheckingProperties():void { $this->user = "john.doe@example.org"; // check that the different fieldset groups return the expected columns foreach ($this->fields as $column) { @@ -577,7 +577,7 @@ trait SeriesArticle { } /** @dataProvider provideOrderedLists */ - public function testListArticlesCheckingOrder(array $sortCols, array $exp) { + public function testListArticlesCheckingOrder(array $sortCols, array $exp):void { $act = ValueInfo::normalize(array_column(iterator_to_array(Arsse::$db->articleList("john.doe@example.com", null, ["id"], $sortCols)), "id"), ValueInfo::T_INT | ValueInfo::M_ARRAY); $this->assertSame($exp, $act); } @@ -595,17 +595,17 @@ trait SeriesArticle { ]; } - public function testListArticlesWithoutAuthority() { + public function testListArticlesWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleList($this->user); } - public function testMarkNothing() { + public function testMarkNothing():void { $this->assertSame(0, Arsse::$db->articleMark($this->user, [])); } - public function testMarkAllArticlesUnread() { + public function testMarkAllArticlesUnread():void { Arsse::$db->articleMark($this->user, ['read'=>false]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -616,7 +616,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesRead() { + public function testMarkAllArticlesRead():void { Arsse::$db->articleMark($this->user, ['read'=>true]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -631,7 +631,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesUnstarred() { + public function testMarkAllArticlesUnstarred():void { Arsse::$db->articleMark($this->user, ['starred'=>false]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -642,7 +642,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesStarred() { + public function testMarkAllArticlesStarred():void { Arsse::$db->articleMark($this->user, ['starred'=>true]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -657,7 +657,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesUnreadAndUnstarred() { + public function testMarkAllArticlesUnreadAndUnstarred():void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>false]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -671,7 +671,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesReadAndStarred() { + public function testMarkAllArticlesReadAndStarred():void { Arsse::$db->articleMark($this->user, ['read'=>true,'starred'=>true]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -689,7 +689,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesUnreadAndStarred() { + public function testMarkAllArticlesUnreadAndStarred():void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -707,7 +707,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesReadAndUnstarred() { + public function testMarkAllArticlesReadAndUnstarred():void { Arsse::$db->articleMark($this->user, ['read'=>true,'starred'=>false]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -725,7 +725,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testSetNoteForAllArticles() { + public function testSetNoteForAllArticles():void { Arsse::$db->articleMark($this->user, ['note'=>"New note"]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -744,7 +744,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkATreeFolder() { + public function testMarkATreeFolder():void { Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(7)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -755,7 +755,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkALeafFolder() { + public function testMarkALeafFolder():void { Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(8)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -764,12 +764,12 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAMissingFolder() { + public function testMarkAMissingFolder():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(42)); } - public function testMarkASubscription() { + public function testMarkASubscription():void { Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->subscription(13)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -778,12 +778,12 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAMissingSubscription() { + public function testMarkAMissingSubscription():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(2112)); } - public function testMarkAnArticle() { + public function testMarkAnArticle():void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->article(20)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -792,7 +792,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleArticles() { + public function testMarkMultipleArticles():void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->articles([2,4,7,20])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -802,7 +802,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleArticlessUnreadAndStarred() { + public function testMarkMultipleArticlessUnreadAndStarred():void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true], (new Context)->articles([2,4,7,20])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -815,16 +815,16 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkTooManyMultipleArticles() { + public function testMarkTooManyMultipleArticles():void { $this->assertSame(7, Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true], (new Context)->articles(range(1, Database::LIMIT_SET_SIZE * 3)))); } - public function testMarkAMissingArticle() { + public function testMarkAMissingArticle():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->article(1)); } - public function testMarkAnEdition() { + public function testMarkAnEdition():void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->edition(1001)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -833,7 +833,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleEditions() { + public function testMarkMultipleEditions():void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->editions([2,4,7,20])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -843,13 +843,13 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleMissingEditions() { + public function testMarkMultipleMissingEditions():void { $this->assertSame(0, Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->editions([500,501]))); $state = $this->primeExpectations($this->data, $this->checkTables); $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleEditionsUnread() { + public function testMarkMultipleEditionsUnread():void { Arsse::$db->articleMark($this->user, ['read'=>false], (new Context)->editions([2,4,7,1001])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -860,7 +860,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleEditionsUnreadWithStale() { + public function testMarkMultipleEditionsUnreadWithStale():void { Arsse::$db->articleMark($this->user, ['read'=>false], (new Context)->editions([2,4,7,20])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -869,7 +869,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleEditionsUnreadAndStarredWithStale() { + public function testMarkMultipleEditionsUnreadAndStarredWithStale():void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true], (new Context)->editions([2,4,7,20])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -881,17 +881,17 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkTooManyMultipleEditions() { + public function testMarkTooManyMultipleEditions():void { $this->assertSame(7, Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true], (new Context)->editions(range(1, 51)))); } - public function testMarkAStaleEditionUnread() { + public function testMarkAStaleEditionUnread():void { Arsse::$db->articleMark($this->user, ['read'=>false], (new Context)->edition(20)); // no changes occur $state = $this->primeExpectations($this->data, $this->checkTables); $this->compareExpectations(static::$drv, $state); } - public function testMarkAStaleEditionStarred() { + public function testMarkAStaleEditionStarred():void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->edition(20)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -900,7 +900,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAStaleEditionUnreadAndStarred() { + public function testMarkAStaleEditionUnreadAndStarred():void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true], (new Context)->edition(20)); // only starred is changed $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -909,18 +909,18 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAStaleEditionUnreadAndUnstarred() { + public function testMarkAStaleEditionUnreadAndUnstarred():void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>false], (new Context)->edition(20)); // no changes occur $state = $this->primeExpectations($this->data, $this->checkTables); $this->compareExpectations(static::$drv, $state); } - public function testMarkAMissingEdition() { + public function testMarkAMissingEdition():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->edition(2)); } - public function testMarkByOldestEdition() { + public function testMarkByOldestEdition():void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->oldestEdition(19)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -931,7 +931,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkByLatestEdition() { + public function testMarkByLatestEdition():void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->latestEdition(20)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -944,7 +944,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkByLastMarked() { + public function testMarkByLastMarked():void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->markedSince('2017-01-01T00:00:00Z')); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -955,7 +955,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkByNotLastMarked() { + public function testMarkByNotLastMarked():void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->notMarkedSince('2000-01-01T00:00:00Z')); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -964,55 +964,55 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkArticlesWithoutAuthority() { + public function testMarkArticlesWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleMark($this->user, ['read'=>false]); } - public function testCountArticles() { + public function testCountArticles():void { $this->assertSame(2, Arsse::$db->articleCount("john.doe@example.com", (new Context)->starred(true))); $this->assertSame(4, Arsse::$db->articleCount("john.doe@example.com", (new Context)->folder(1))); $this->assertSame(0, Arsse::$db->articleCount("jane.doe@example.com", (new Context)->starred(true))); $this->assertSame(10, Arsse::$db->articleCount("john.doe@example.com", (new Context)->articles(range(1, Database::LIMIT_SET_SIZE * 3)))); } - public function testCountArticlesWithoutAuthority() { + public function testCountArticlesWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleCount($this->user); } - public function testFetchStarredCounts() { + public function testFetchStarredCounts():void { $exp1 = ['total' => 2, 'unread' => 1, 'read' => 1]; $exp2 = ['total' => 0, 'unread' => 0, 'read' => 0]; $this->assertEquals($exp1, Arsse::$db->articleStarred("john.doe@example.com")); $this->assertEquals($exp2, Arsse::$db->articleStarred("jane.doe@example.com")); } - public function testFetchStarredCountsWithoutAuthority() { + public function testFetchStarredCountsWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleStarred($this->user); } - public function testFetchLatestEdition() { + public function testFetchLatestEdition():void { $this->assertSame(1001, Arsse::$db->editionLatest($this->user)); $this->assertSame(4, Arsse::$db->editionLatest($this->user, (new Context)->subscription(12))); } - public function testFetchLatestEditionOfMissingSubscription() { + public function testFetchLatestEditionOfMissingSubscription():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->editionLatest($this->user, (new Context)->subscription(1)); } - public function testFetchLatestEditionWithoutAuthority() { + public function testFetchLatestEditionWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->editionLatest($this->user); } - public function testListTheLabelsOfAnArticle() { + public function testListTheLabelsOfAnArticle():void { $this->assertEquals([1,2], Arsse::$db->articleLabelsGet("john.doe@example.com", 1)); $this->assertEquals([2], Arsse::$db->articleLabelsGet("john.doe@example.com", 5)); $this->assertEquals([], Arsse::$db->articleLabelsGet("john.doe@example.com", 2)); @@ -1021,18 +1021,18 @@ trait SeriesArticle { $this->assertEquals([], Arsse::$db->articleLabelsGet("john.doe@example.com", 2, true)); } - public function testListTheLabelsOfAMissingArticle() { + public function testListTheLabelsOfAMissingArticle():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->articleLabelsGet($this->user, 101); } - public function testListTheLabelsOfAnArticleWithoutAuthority() { + public function testListTheLabelsOfAnArticleWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleLabelsGet("john.doe@example.com", 1); } - public function testListTheCategoriesOfAnArticle() { + public function testListTheCategoriesOfAnArticle():void { $exp = ["Fascinating", "Logical"]; $this->assertSame($exp, Arsse::$db->articleCategoriesGet($this->user, 19)); $exp = ["Interesting", "Logical"]; @@ -1041,19 +1041,19 @@ trait SeriesArticle { $this->assertSame($exp, Arsse::$db->articleCategoriesGet($this->user, 4)); } - public function testListTheCategoriesOfAMissingArticle() { + public function testListTheCategoriesOfAMissingArticle():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->articleCategoriesGet($this->user, 101); } - public function testListTheCategoriesOfAnArticleWithoutAuthority() { + public function testListTheCategoriesOfAnArticleWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleCategoriesGet($this->user, 19); } /** @dataProvider provideArrayContextOptions */ - public function testUseTooFewValuesInArrayContext(string $option) { + public function testUseTooFewValuesInArrayContext(string $option):void { $this->assertException("tooShort", "Db", "ExceptionInput"); Arsse::$db->articleList($this->user, (new Context)->$option([])); } diff --git a/tests/cases/Database/SeriesCleanup.php b/tests/cases/Database/SeriesCleanup.php index 1b0a9fc6..7482243f 100644 --- a/tests/cases/Database/SeriesCleanup.php +++ b/tests/cases/Database/SeriesCleanup.php @@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\TestCase\Database; use JKingWeb\Arsse\Arsse; trait SeriesCleanup { - protected function setUpSeriesCleanup() { + protected function setUpSeriesCleanup():void { // set up the configuration Arsse::$conf->import([ 'userSessionTimeout' => "PT1H", @@ -147,11 +147,11 @@ trait SeriesCleanup { ]; } - protected function tearDownSeriesCleanup() { + protected function tearDownSeriesCleanup():void { unset($this->data); } - public function testCleanUpOrphanedFeeds() { + public function testCleanUpOrphanedFeeds():void { Arsse::$db->feedCleanup(); $now = gmdate("Y-m-d H:i:s"); $state = $this->primeExpectations($this->data, [ @@ -163,7 +163,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpOrphanedFeedsWithUnlimitedRetention() { + public function testCleanUpOrphanedFeedsWithUnlimitedRetention():void { Arsse::$conf->import([ 'purgeFeeds' => null, ]); @@ -177,7 +177,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpOldArticlesWithStandardRetention() { + public function testCleanUpOldArticlesWithStandardRetention():void { Arsse::$db->articleCleanup(); $state = $this->primeExpectations($this->data, [ 'arsse_articles' => ["id"] @@ -188,7 +188,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpOldArticlesWithUnlimitedReadRetention() { + public function testCleanUpOldArticlesWithUnlimitedReadRetention():void { Arsse::$conf->import([ 'purgeArticlesRead' => null, ]); @@ -202,7 +202,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpOldArticlesWithUnlimitedUnreadRetention() { + public function testCleanUpOldArticlesWithUnlimitedUnreadRetention():void { Arsse::$conf->import([ 'purgeArticlesUnread' => null, ]); @@ -216,7 +216,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpOldArticlesWithUnlimitedRetention() { + public function testCleanUpOldArticlesWithUnlimitedRetention():void { Arsse::$conf->import([ 'purgeArticlesRead' => null, 'purgeArticlesUnread' => null, @@ -228,7 +228,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpExpiredSessions() { + public function testCleanUpExpiredSessions():void { Arsse::$db->sessionCleanup(); $state = $this->primeExpectations($this->data, [ 'arsse_sessions' => ["id"] @@ -239,7 +239,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpExpiredTokens() { + public function testCleanUpExpiredTokens():void { Arsse::$db->tokenCleanup(); $state = $this->primeExpectations($this->data, [ 'arsse_tokens' => ["id", "class"] diff --git a/tests/cases/Database/SeriesFeed.php b/tests/cases/Database/SeriesFeed.php index 8db02351..ce5e074e 100644 --- a/tests/cases/Database/SeriesFeed.php +++ b/tests/cases/Database/SeriesFeed.php @@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\TestCase\Database; use JKingWeb\Arsse\Arsse; trait SeriesFeed { - protected function setUpSeriesFeed() { + protected function setUpSeriesFeed():void { // set up the test data $past = gmdate("Y-m-d H:i:s", strtotime("now - 1 minute")); $future = gmdate("Y-m-d H:i:s", strtotime("now + 1 minute")); @@ -160,15 +160,15 @@ trait SeriesFeed { ]; } - protected function tearDownSeriesFeed() { + protected function tearDownSeriesFeed():void { unset($this->data, $this->matches); } - public function testListLatestItems() { + public function testListLatestItems():void { $this->assertResult($this->matches, Arsse::$db->feedMatchLatest(1, 2)); } - public function testMatchItemsById() { + public function testMatchItemsById():void { $this->assertResult($this->matches, Arsse::$db->feedMatchIds(1, ['804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41'])); foreach ($this->matches as $m) { $exp = [$m]; @@ -179,7 +179,7 @@ trait SeriesFeed { $this->assertResult([['id' => 1]], Arsse::$db->feedMatchIds(1, ['e433653cef2e572eee4215fa299a4a5af9137b2cefd6283c85bd69a32915beda'])); // this ID appears in both feed 1 and feed 2; only one result should be returned } - public function testUpdateAFeed() { + public function testUpdateAFeed():void { // update a valid feed with both new and changed items Arsse::$db->feedUpdate(1); $now = gmdate("Y-m-d H:i:s"); @@ -219,22 +219,22 @@ trait SeriesFeed { $this->compareExpectations(static::$drv, $state); } - public function testUpdateAMissingFeed() { + public function testUpdateAMissingFeed():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->feedUpdate(2112); } - public function testUpdateAnInvalidFeed() { + public function testUpdateAnInvalidFeed():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->feedUpdate(-1); } - public function testUpdateAFeedThrowingExceptions() { + public function testUpdateAFeedThrowingExceptions():void { $this->assertException("invalidUrl", "Feed"); Arsse::$db->feedUpdate(3, true); } - public function testUpdateAFeedWithEnclosuresAndCategories() { + public function testUpdateAFeedWithEnclosuresAndCategories():void { Arsse::$db->feedUpdate(5); $state = $this->primeExpectations($this->data, [ 'arsse_enclosures' => ["url","type"], @@ -254,7 +254,7 @@ trait SeriesFeed { $this->compareExpectations(static::$drv, $state); } - public function testListStaleFeeds() { + public function testListStaleFeeds():void { $this->assertEquals([1,3,4], Arsse::$db->feedListStale()); Arsse::$db->feedUpdate(3); Arsse::$db->feedUpdate(4); diff --git a/tests/cases/Database/SeriesFolder.php b/tests/cases/Database/SeriesFolder.php index 907454b6..9c73a3ea 100644 --- a/tests/cases/Database/SeriesFolder.php +++ b/tests/cases/Database/SeriesFolder.php @@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\TestCase\Database; use JKingWeb\Arsse\Arsse; trait SeriesFolder { - protected function setUpSeriesFolder() { + protected function setUpSeriesFolder():void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -93,11 +93,11 @@ trait SeriesFolder { ]; } - protected function tearDownSeriesFolder() { + protected function tearDownSeriesFolder():void { unset($this->data); } - public function testAddARootFolder() { + public function testAddARootFolder():void { $user = "john.doe@example.com"; $folderID = $this->nextID("arsse_folders"); $this->assertSame($folderID, Arsse::$db->folderAdd($user, ['name' => "Entertainment"])); @@ -107,12 +107,12 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testAddADuplicateRootFolder() { + public function testAddADuplicateRootFolder():void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Politics"]); } - public function testAddANestedFolder() { + public function testAddANestedFolder():void { $user = "john.doe@example.com"; $folderID = $this->nextID("arsse_folders"); $this->assertSame($folderID, Arsse::$db->folderAdd($user, ['name' => "GNOME", 'parent' => 2])); @@ -122,43 +122,43 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testAddANestedFolderToAMissingParent() { + public function testAddANestedFolderToAMissingParent():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => 2112]); } - public function testAddANestedFolderToAnInvalidParent() { + public function testAddANestedFolderToAnInvalidParent():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => "stringFolderId"]); } - public function testAddANestedFolderForTheWrongOwner() { + public function testAddANestedFolderForTheWrongOwner():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => 4]); // folder ID 4 belongs to Jane } - public function testAddAFolderWithAMissingName() { + public function testAddAFolderWithAMissingName():void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", []); } - public function testAddAFolderWithABlankName() { + public function testAddAFolderWithABlankName():void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => ""]); } - public function testAddAFolderWithAWhitespaceName() { + public function testAddAFolderWithAWhitespaceName():void { $this->assertException("whitespace", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => " "]); } - public function testAddAFolderWithoutAuthority() { + public function testAddAFolderWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology"]); } - public function testListRootFolders() { + public function testListRootFolders():void { $exp = [ ['id' => 5, 'name' => "Politics", 'parent' => null, 'children' => 0, 'feeds' => 2], ['id' => 1, 'name' => "Technology", 'parent' => null, 'children' => 2, 'feeds' => 1], @@ -175,7 +175,7 @@ trait SeriesFolder { \Phake::verify(Arsse::$user)->authorize("admin@example.net", "folderList"); } - public function testListFoldersRecursively() { + public function testListFoldersRecursively():void { $exp = [ ['id' => 5, 'name' => "Politics", 'parent' => null, 'children' => 0, 'feeds' => 2], ['id' => 6, 'name' => "Politics", 'parent' => 2, 'children' => 0, 'feeds' => 1], @@ -196,23 +196,23 @@ trait SeriesFolder { \Phake::verify(Arsse::$user)->authorize("jane.doe@example.com", "folderList"); } - public function testListFoldersOfAMissingParent() { + public function testListFoldersOfAMissingParent():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderList("john.doe@example.com", 2112); } - public function testListFoldersOfTheWrongOwner() { + public function testListFoldersOfTheWrongOwner():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderList("john.doe@example.com", 4); // folder ID 4 belongs to Jane } - public function testListFoldersWithoutAuthority() { + public function testListFoldersWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->folderList("john.doe@example.com"); } - public function testRemoveAFolder() { + public function testRemoveAFolder():void { $this->assertTrue(Arsse::$db->folderRemove("john.doe@example.com", 6)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderRemove"); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); @@ -220,7 +220,7 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAFolderTree() { + public function testRemoveAFolderTree():void { $this->assertTrue(Arsse::$db->folderRemove("john.doe@example.com", 1)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderRemove"); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); @@ -230,28 +230,28 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAMissingFolder() { + public function testRemoveAMissingFolder():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderRemove("john.doe@example.com", 2112); } - public function testRemoveAnInvalidFolder() { + public function testRemoveAnInvalidFolder():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->folderRemove("john.doe@example.com", -1); } - public function testRemoveAFolderOfTheWrongOwner() { + public function testRemoveAFolderOfTheWrongOwner():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderRemove("john.doe@example.com", 4); // folder ID 4 belongs to Jane } - public function testRemoveAFolderWithoutAuthority() { + public function testRemoveAFolderWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->folderRemove("john.doe@example.com", 1); } - public function testGetThePropertiesOfAFolder() { + public function testGetThePropertiesOfAFolder():void { $exp = [ 'id' => 6, 'name' => "Politics", @@ -261,32 +261,32 @@ trait SeriesFolder { \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderPropertiesGet"); } - public function testGetThePropertiesOfAMissingFolder() { + public function testGetThePropertiesOfAMissingFolder():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesGet("john.doe@example.com", 2112); } - public function testGetThePropertiesOfAnInvalidFolder() { + public function testGetThePropertiesOfAnInvalidFolder():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesGet("john.doe@example.com", -1); } - public function testGetThePropertiesOfAFolderOfTheWrongOwner() { + public function testGetThePropertiesOfAFolderOfTheWrongOwner():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesGet("john.doe@example.com", 4); // folder ID 4 belongs to Jane } - public function testGetThePropertiesOfAFolderWithoutAuthority() { + public function testGetThePropertiesOfAFolderWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->folderPropertiesGet("john.doe@example.com", 1); } - public function testMakeNoChangesToAFolder() { + public function testMakeNoChangesToAFolder():void { $this->assertFalse(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, [])); } - public function testRenameAFolder() { + public function testRenameAFolder():void { $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => "Opinion"])); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderPropertiesSet"); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); @@ -294,26 +294,26 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testRenameTheRootFolder() { + public function testRenameTheRootFolder():void { $this->assertFalse(Arsse::$db->folderPropertiesSet("john.doe@example.com", null, ['name' => "Opinion"])); } - public function testRenameAFolderToTheEmptyString() { + public function testRenameAFolderToTheEmptyString():void { $this->assertException("missing", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => ""])); } - public function testRenameAFolderToWhitespaceOnly() { + public function testRenameAFolderToWhitespaceOnly():void { $this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => " "])); } - public function testRenameAFolderToAnInvalidValue() { + public function testRenameAFolderToAnInvalidValue():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => []])); } - public function testMoveAFolder() { + public function testMoveAFolder():void { $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => 5])); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderPropertiesSet"); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); @@ -321,57 +321,57 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testMoveTheRootFolder() { + public function testMoveTheRootFolder():void { $this->assertException("circularDependence", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 0, ['parent' => 1]); } - public function testMoveAFolderToItsDescendant() { + public function testMoveAFolderToItsDescendant():void { $this->assertException("circularDependence", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 3]); } - public function testMoveAFolderToItself() { + public function testMoveAFolderToItself():void { $this->assertException("circularDependence", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 1]); } - public function testMoveAFolderToAMissingParent() { + public function testMoveAFolderToAMissingParent():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 2112]); } - public function testMoveAFolderToAnInvalidParent() { + public function testMoveAFolderToAnInvalidParent():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => "ThisFolderDoesNotExist"]); } - public function testCauseAFolderCollision() { + public function testCauseAFolderCollision():void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => null]); } - public function testCauseACompoundFolderCollision() { + public function testCauseACompoundFolderCollision():void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 3, ['parent' => null, 'name' => "Technology"]); } - public function testSetThePropertiesOfAMissingFolder() { + public function testSetThePropertiesOfAMissingFolder():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 2112, ['parent' => null]); } - public function testSetThePropertiesOfAnInvalidFolder() { + public function testSetThePropertiesOfAnInvalidFolder():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", -1, ['parent' => null]); } - public function testSetThePropertiesOfAFolderForTheWrongOwner() { + public function testSetThePropertiesOfAFolderForTheWrongOwner():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 4, ['parent' => null]); // folder ID 4 belongs to Jane } - public function testSetThePropertiesOfAFolderWithoutAuthority() { + public function testSetThePropertiesOfAFolderWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => null]); diff --git a/tests/cases/Database/SeriesLabel.php b/tests/cases/Database/SeriesLabel.php index 677e8e67..0cf55ca8 100644 --- a/tests/cases/Database/SeriesLabel.php +++ b/tests/cases/Database/SeriesLabel.php @@ -11,7 +11,7 @@ use JKingWeb\Arsse\Database; use JKingWeb\Arsse\Context\Context; trait SeriesLabel { - protected function setUpSeriesLabel() { + protected function setUpSeriesLabel():void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -244,11 +244,11 @@ trait SeriesLabel { $this->user = "john.doe@example.com"; } - protected function tearDownSeriesLabel() { + protected function tearDownSeriesLabel():void { unset($this->data, $this->checkLabels, $this->checkMembers, $this->user); } - public function testAddALabel() { + public function testAddALabel():void { $user = "john.doe@example.com"; $labelID = $this->nextID("arsse_labels"); $this->assertSame($labelID, Arsse::$db->labelAdd($user, ['name' => "Entertaining"])); @@ -258,33 +258,33 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testAddADuplicateLabel() { + public function testAddADuplicateLabel():void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->labelAdd("john.doe@example.com", ['name' => "Interesting"]); } - public function testAddALabelWithAMissingName() { + public function testAddALabelWithAMissingName():void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->labelAdd("john.doe@example.com", []); } - public function testAddALabelWithABlankName() { + public function testAddALabelWithABlankName():void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->labelAdd("john.doe@example.com", ['name' => ""]); } - public function testAddALabelWithAWhitespaceName() { + public function testAddALabelWithAWhitespaceName():void { $this->assertException("whitespace", "Db", "ExceptionInput"); Arsse::$db->labelAdd("john.doe@example.com", ['name' => " "]); } - public function testAddALabelWithoutAuthority() { + public function testAddALabelWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelAdd("john.doe@example.com", ['name' => "Boring"]); } - public function testListLabels() { + public function testListLabels():void { $exp = [ ['id' => 2, 'name' => "Fascinating", 'articles' => 3, 'read' => 1], ['id' => 1, 'name' => "Interesting", 'articles' => 2, 'read' => 2], @@ -300,13 +300,13 @@ trait SeriesLabel { \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "labelList"); } - public function testListLabelsWithoutAuthority() { + public function testListLabelsWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelList("john.doe@example.com"); } - public function testRemoveALabel() { + public function testRemoveALabel():void { $this->assertTrue(Arsse::$db->labelRemove("john.doe@example.com", 1)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "labelRemove"); $state = $this->primeExpectations($this->data, $this->checkLabels); @@ -314,7 +314,7 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testRemoveALabelByName() { + public function testRemoveALabelByName():void { $this->assertTrue(Arsse::$db->labelRemove("john.doe@example.com", "Interesting", true)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "labelRemove"); $state = $this->primeExpectations($this->data, $this->checkLabels); @@ -322,33 +322,33 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAMissingLabel() { + public function testRemoveAMissingLabel():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelRemove("john.doe@example.com", 2112); } - public function testRemoveAnInvalidLabel() { + public function testRemoveAnInvalidLabel():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelRemove("john.doe@example.com", -1); } - public function testRemoveAnInvalidLabelByName() { + public function testRemoveAnInvalidLabelByName():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelRemove("john.doe@example.com", [], true); } - public function testRemoveALabelOfTheWrongOwner() { + public function testRemoveALabelOfTheWrongOwner():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelRemove("john.doe@example.com", 3); // label ID 3 belongs to Jane } - public function testRemoveALabelWithoutAuthority() { + public function testRemoveALabelWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelRemove("john.doe@example.com", 1); } - public function testGetThePropertiesOfALabel() { + public function testGetThePropertiesOfALabel():void { $exp = [ 'id' => 2, 'name' => "Fascinating", @@ -360,37 +360,37 @@ trait SeriesLabel { \Phake::verify(Arsse::$user, \Phake::times(2))->authorize("john.doe@example.com", "labelPropertiesGet"); } - public function testGetThePropertiesOfAMissingLabel() { + public function testGetThePropertiesOfAMissingLabel():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesGet("john.doe@example.com", 2112); } - public function testGetThePropertiesOfAnInvalidLabel() { + public function testGetThePropertiesOfAnInvalidLabel():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesGet("john.doe@example.com", -1); } - public function testGetThePropertiesOfAnInvalidLabelByName() { + public function testGetThePropertiesOfAnInvalidLabelByName():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesGet("john.doe@example.com", [], true); } - public function testGetThePropertiesOfALabelOfTheWrongOwner() { + public function testGetThePropertiesOfALabelOfTheWrongOwner():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesGet("john.doe@example.com", 3); // label ID 3 belongs to Jane } - public function testGetThePropertiesOfALabelWithoutAuthority() { + public function testGetThePropertiesOfALabelWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelPropertiesGet("john.doe@example.com", 1); } - public function testMakeNoChangesToALabel() { + public function testMakeNoChangesToALabel():void { $this->assertFalse(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, [])); } - public function testRenameALabel() { + public function testRenameALabel():void { $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Curious"])); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "labelPropertiesSet"); $state = $this->primeExpectations($this->data, $this->checkLabels); @@ -398,7 +398,7 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testRenameALabelByName() { + public function testRenameALabelByName():void { $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", "Interesting", ['name' => "Curious"], true)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "labelPropertiesSet"); $state = $this->primeExpectations($this->data, $this->checkLabels); @@ -406,53 +406,53 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testRenameALabelToTheEmptyString() { + public function testRenameALabelToTheEmptyString():void { $this->assertException("missing", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => ""])); } - public function testRenameALabelToWhitespaceOnly() { + public function testRenameALabelToWhitespaceOnly():void { $this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => " "])); } - public function testRenameALabelToAnInvalidValue() { + public function testRenameALabelToAnInvalidValue():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => []])); } - public function testCauseALabelCollision() { + public function testCauseALabelCollision():void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Fascinating"]); } - public function testSetThePropertiesOfAMissingLabel() { + public function testSetThePropertiesOfAMissingLabel():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesSet("john.doe@example.com", 2112, ['name' => "Exciting"]); } - public function testSetThePropertiesOfAnInvalidLabel() { + public function testSetThePropertiesOfAnInvalidLabel():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesSet("john.doe@example.com", -1, ['name' => "Exciting"]); } - public function testSetThePropertiesOfAnInvalidLabelByName() { + public function testSetThePropertiesOfAnInvalidLabelByName():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesSet("john.doe@example.com", [], ['name' => "Exciting"], true); } - public function testSetThePropertiesOfALabelForTheWrongOwner() { + public function testSetThePropertiesOfALabelForTheWrongOwner():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesSet("john.doe@example.com", 3, ['name' => "Exciting"]); // label ID 3 belongs to Jane } - public function testSetThePropertiesOfALabelWithoutAuthority() { + public function testSetThePropertiesOfALabelWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Exciting"]); } - public function testListLabelledArticles() { + public function testListLabelledArticles():void { $exp = [1,19]; $this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", 1)); $this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", "Interesting", true)); @@ -464,23 +464,23 @@ trait SeriesLabel { $this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", "Lonely", true)); } - public function testListLabelledArticlesForAMissingLabel() { + public function testListLabelledArticlesForAMissingLabel():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelArticlesGet("john.doe@example.com", 3); } - public function testListLabelledArticlesForAnInvalidLabel() { + public function testListLabelledArticlesForAnInvalidLabel():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelArticlesGet("john.doe@example.com", -1); } - public function testListLabelledArticlesWithoutAuthority() { + public function testListLabelledArticlesWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelArticlesGet("john.doe@example.com", 1); } - public function testApplyALabelToArticles() { + public function testApplyALabelToArticles():void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5])); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][4][3] = 1; @@ -488,14 +488,14 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testClearALabelFromArticles() { + public function testClearALabelFromArticles():void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([1,5]), Database::ASSOC_REMOVE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][0][3] = 0; $this->compareExpectations(static::$drv, $state); } - public function testApplyALabelToArticlesByName() { + public function testApplyALabelToArticlesByName():void { Arsse::$db->labelArticlesSet("john.doe@example.com", "Interesting", (new Context)->articles([2,5]), Database::ASSOC_ADD, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][4][3] = 1; @@ -503,26 +503,26 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testClearALabelFromArticlesByName() { + public function testClearALabelFromArticlesByName():void { Arsse::$db->labelArticlesSet("john.doe@example.com", "Interesting", (new Context)->articles([1,5]), Database::ASSOC_REMOVE, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][0][3] = 0; $this->compareExpectations(static::$drv, $state); } - public function testApplyALabelToNoArticles() { + public function testApplyALabelToNoArticles():void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000])); $state = $this->primeExpectations($this->data, $this->checkMembers); $this->compareExpectations(static::$drv, $state); } - public function testClearALabelFromNoArticles() { + public function testClearALabelFromNoArticles():void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]), Database::ASSOC_REMOVE); $state = $this->primeExpectations($this->data, $this->checkMembers); $this->compareExpectations(static::$drv, $state); } - public function testReplaceArticlesOfALabel() { + public function testReplaceArticlesOfALabel():void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5]), Database::ASSOC_REPLACE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][0][3] = 0; @@ -532,7 +532,7 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testPurgeArticlesOfALabel() { + public function testPurgeArticlesOfALabel():void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]), Database::ASSOC_REPLACE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][0][3] = 0; @@ -540,7 +540,7 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testApplyALabelToArticlesWithoutAuthority() { + public function testApplyALabelToArticlesWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5])); diff --git a/tests/cases/Database/SeriesMeta.php b/tests/cases/Database/SeriesMeta.php index 485c7155..2a617c6f 100644 --- a/tests/cases/Database/SeriesMeta.php +++ b/tests/cases/Database/SeriesMeta.php @@ -10,7 +10,7 @@ use JKingWeb\Arsse\Test\Database; use JKingWeb\Arsse\Arsse; trait SeriesMeta { - protected function setUpSeriesMeta() { + protected function setUpSeriesMeta():void { $dataBare = [ 'arsse_meta' => [ 'columns' => [ @@ -31,18 +31,18 @@ trait SeriesMeta { $this->primeDatabase(static::$drv, $dataBare); } - protected function tearDownSeriesMeta() { + protected function tearDownSeriesMeta():void { unset($this->data); } - public function testAddANewValue() { + public function testAddANewValue():void { $this->assertTrue(Arsse::$db->metaSet("favourite", "Cygnus X-1")); $state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]); $state['arsse_meta']['rows'][] = ["favourite","Cygnus X-1"]; $this->compareExpectations(static::$drv, $state); } - public function testAddANewTypedValue() { + public function testAddANewTypedValue():void { $this->assertTrue(Arsse::$db->metaSet("answer", 42, "int")); $this->assertTrue(Arsse::$db->metaSet("true", true, "bool")); $this->assertTrue(Arsse::$db->metaSet("false", false, "bool")); @@ -55,14 +55,14 @@ trait SeriesMeta { $this->compareExpectations(static::$drv, $state); } - public function testChangeAnExistingValue() { + public function testChangeAnExistingValue():void { $this->assertTrue(Arsse::$db->metaSet("album", "Hemispheres")); $state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]); $state['arsse_meta']['rows'][1][1] = "Hemispheres"; $this->compareExpectations(static::$drv, $state); } - public function testRemoveAValue() { + public function testRemoveAValue():void { $this->assertTrue(Arsse::$db->metaRemove("album")); $this->assertFalse(Arsse::$db->metaRemove("album")); $state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]); @@ -70,7 +70,7 @@ trait SeriesMeta { $this->compareExpectations(static::$drv, $state); } - public function testRetrieveAValue() { + public function testRetrieveAValue():void { $this->assertSame("".Database::SCHEMA_VERSION, Arsse::$db->metaGet("schema_version")); $this->assertSame("A Farewell to Kings", Arsse::$db->metaGet("album")); $this->assertSame(null, Arsse::$db->metaGet("this_key_does_not_exist")); diff --git a/tests/cases/Database/SeriesMiscellany.php b/tests/cases/Database/SeriesMiscellany.php index cb324b4a..03009eff 100644 --- a/tests/cases/Database/SeriesMiscellany.php +++ b/tests/cases/Database/SeriesMiscellany.php @@ -10,22 +10,22 @@ use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\Database; trait SeriesMiscellany { - protected function setUpSeriesMiscellany() { + protected function setUpSeriesMiscellany():void { static::setConf([ 'dbDriver' => static::$dbDriverClass, ]); } - protected function tearDownSeriesMiscellany() { + protected function tearDownSeriesMiscellany():void { } - public function testInitializeDatabase() { + public function testInitializeDatabase():void { static::dbRaze(static::$drv); $d = new Database(true); $this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion()); } - public function testManuallyInitializeDatabase() { + public function testManuallyInitializeDatabase():void { static::dbRaze(static::$drv); $d = new Database(false); $this->assertSame(0, $d->driverSchemaVersion()); @@ -34,11 +34,11 @@ trait SeriesMiscellany { $this->assertFalse($d->driverSchemaUpdate()); } - public function testCheckCharacterSetAcceptability() { + public function testCheckCharacterSetAcceptability():void { $this->assertIsBool(Arsse::$db->driverCharsetAcceptable()); } - public function testPerformMaintenance() { + public function testPerformMaintenance():void { $this->assertTrue(Arsse::$db->driverMaintenance()); } } diff --git a/tests/cases/Database/SeriesSession.php b/tests/cases/Database/SeriesSession.php index 6322d72d..7e5b7c4a 100644 --- a/tests/cases/Database/SeriesSession.php +++ b/tests/cases/Database/SeriesSession.php @@ -10,7 +10,7 @@ use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\Misc\Date; trait SeriesSession { - protected function setUpSeriesSession() { + protected function setUpSeriesSession():void { // set up the configuration static::setConf([ 'userSessionTimeout' => "PT1H", @@ -49,11 +49,11 @@ trait SeriesSession { ]; } - protected function tearDownSeriesSession() { + protected function tearDownSeriesSession():void { unset($this->data); } - public function testResumeAValidSession() { + public function testResumeAValidSession():void { $exp1 = [ 'id' => "80fa94c1a11f11e78667001e673b2560", 'user' => "jane.doe@example.com" @@ -74,22 +74,22 @@ trait SeriesSession { $this->assertArraySubset($exp1, Arsse::$db->sessionResume("80fa94c1a11f11e78667001e673b2560")); } - public function testResumeAMissingSession() { + public function testResumeAMissingSession():void { $this->assertException("invalid", "User", "ExceptionSession"); Arsse::$db->sessionResume("thisSessionDoesNotExist"); } - public function testResumeAnExpiredSession() { + public function testResumeAnExpiredSession():void { $this->assertException("invalid", "User", "ExceptionSession"); Arsse::$db->sessionResume("27c6de8da13311e78667001e673b2560"); } - public function testResumeAStaleSession() { + public function testResumeAStaleSession():void { $this->assertException("invalid", "User", "ExceptionSession"); Arsse::$db->sessionResume("ab3b3eb8a13311e78667001e673b2560"); } - public function testCreateASession() { + public function testCreateASession():void { $user = "jane.doe@example.com"; $id = Arsse::$db->sessionCreate($user); $now = time(); @@ -98,13 +98,13 @@ trait SeriesSession { $this->compareExpectations(static::$drv, $state); } - public function testCreateASessionWithoutAuthority() { + public function testCreateASessionWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->sessionCreate("jane.doe@example.com"); } - public function testDestroyASession() { + public function testDestroyASession():void { $user = "jane.doe@example.com"; $id = "80fa94c1a11f11e78667001e673b2560"; $this->assertTrue(Arsse::$db->sessionDestroy($user, $id)); @@ -115,7 +115,7 @@ trait SeriesSession { $this->assertFalse(Arsse::$db->sessionDestroy($user, $id)); } - public function testDestroyAllSessions() { + public function testDestroyAllSessions():void { $user = "jane.doe@example.com"; $this->assertTrue(Arsse::$db->sessionDestroy($user)); $state = $this->primeExpectations($this->data, ['arsse_sessions' => ["id", "created", "expires", "user"]]); @@ -125,13 +125,13 @@ trait SeriesSession { $this->compareExpectations(static::$drv, $state); } - public function testDestroyASessionForTheWrongUser() { + public function testDestroyASessionForTheWrongUser():void { $user = "john.doe@example.com"; $id = "80fa94c1a11f11e78667001e673b2560"; $this->assertFalse(Arsse::$db->sessionDestroy($user, $id)); } - public function testDestroyASessionWithoutAuthority() { + public function testDestroyASessionWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->sessionDestroy("jane.doe@example.com", "80fa94c1a11f11e78667001e673b2560"); diff --git a/tests/cases/Database/SeriesSubscription.php b/tests/cases/Database/SeriesSubscription.php index 001de89d..8f6f3043 100644 --- a/tests/cases/Database/SeriesSubscription.php +++ b/tests/cases/Database/SeriesSubscription.php @@ -11,7 +11,7 @@ use JKingWeb\Arsse\Test\Database; use JKingWeb\Arsse\Feed\Exception as FeedException; trait SeriesSubscription { - public function setUpSeriesSubscription() { + public function setUpSeriesSubscription():void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -143,11 +143,11 @@ trait SeriesSubscription { $this->user = "john.doe@example.com"; } - protected function tearDownSeriesSubscription() { + protected function tearDownSeriesSubscription():void { unset($this->data, $this->user); } - public function testAddASubscriptionToAnExistingFeed() { + public function testAddASubscriptionToAnExistingFeed():void { $url = "http://example.com/feed1"; $subID = $this->nextID("arsse_subscriptions"); \Phake::when(Arsse::$db)->feedUpdate->thenReturn(true); @@ -162,7 +162,7 @@ trait SeriesSubscription { $this->compareExpectations(static::$drv, $state); } - public function testAddASubscriptionToANewFeed() { + public function testAddASubscriptionToANewFeed():void { $url = "http://example.org/feed1"; $feedID = $this->nextID("arsse_feeds"); $subID = $this->nextID("arsse_subscriptions"); @@ -179,7 +179,7 @@ trait SeriesSubscription { $this->compareExpectations(static::$drv, $state); } - public function testAddASubscriptionToANewFeedViaDiscovery() { + public function testAddASubscriptionToANewFeedViaDiscovery():void { $url = "http://localhost:8000/Feed/Discovery/Valid"; $discovered = "http://localhost:8000/Feed/Discovery/Feed"; $feedID = $this->nextID("arsse_feeds"); @@ -197,7 +197,7 @@ trait SeriesSubscription { $this->compareExpectations(static::$drv, $state); } - public function testAddASubscriptionToAnInvalidFeed() { + public function testAddASubscriptionToAnInvalidFeed():void { $url = "http://example.org/feed1"; $feedID = $this->nextID("arsse_feeds"); \Phake::when(Arsse::$db)->feedUpdate->thenThrow(new FeedException($url, new \PicoFeed\Client\InvalidUrlException())); @@ -215,19 +215,19 @@ trait SeriesSubscription { } } - public function testAddADuplicateSubscription() { + public function testAddADuplicateSubscription():void { $url = "http://example.com/feed2"; $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionAdd($this->user, $url); } - public function testAddADuplicateSubscriptionWithEquivalentUrl() { + public function testAddADuplicateSubscriptionWithEquivalentUrl():void { $url = "http://EXAMPLE.COM/feed2"; $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionAdd($this->user, $url); } - public function testAddADuplicateSubscriptionViaRedirection() { + public function testAddADuplicateSubscriptionViaRedirection():void { $url = "http://localhost:8000/Feed/Parsing/Valid"; Arsse::$db->subscriptionAdd($this->user, $url); $subID = $this->nextID("arsse_subscriptions"); @@ -235,14 +235,14 @@ trait SeriesSubscription { $this->assertSame($subID, Arsse::$db->subscriptionAdd($this->user, $url)); } - public function testAddASubscriptionWithoutAuthority() { + public function testAddASubscriptionWithoutAuthority():void { $url = "http://example.com/feed1"; \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionAdd($this->user, $url); } - public function testRemoveASubscription() { + public function testRemoveASubscription():void { $this->assertTrue(Arsse::$db->subscriptionRemove($this->user, 1)); \Phake::verify(Arsse::$user)->authorize($this->user, "subscriptionRemove"); $state = $this->primeExpectations($this->data, [ @@ -253,29 +253,29 @@ trait SeriesSubscription { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAMissingSubscription() { + public function testRemoveAMissingSubscription():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionRemove($this->user, 2112); } - public function testRemoveAnInvalidSubscription() { + public function testRemoveAnInvalidSubscription():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionRemove($this->user, -1); } - public function testRemoveASubscriptionForTheWrongOwner() { + public function testRemoveASubscriptionForTheWrongOwner():void { $this->user = "jane.doe@example.com"; $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionRemove($this->user, 1); } - public function testRemoveASubscriptionWithoutAuthority() { + public function testRemoveASubscriptionWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionRemove($this->user, 1); } - public function testListSubscriptions() { + public function testListSubscriptions():void { $exp = [ [ 'url' => "http://example.com/feed2", @@ -303,7 +303,7 @@ trait SeriesSubscription { $this->assertArraySubset($exp[1], Arsse::$db->subscriptionPropertiesGet($this->user, 3)); } - public function testListSubscriptionsInAFolder() { + public function testListSubscriptionsInAFolder():void { $exp = [ [ 'url' => "http://example.com/feed2", @@ -318,7 +318,7 @@ trait SeriesSubscription { $this->assertResult($exp, Arsse::$db->subscriptionList($this->user, null, false)); } - public function testListSubscriptionsWithoutRecursion() { + public function testListSubscriptionsWithoutRecursion():void { $exp = [ [ 'url' => "http://example.com/feed3", @@ -333,50 +333,50 @@ trait SeriesSubscription { $this->assertResult($exp, Arsse::$db->subscriptionList($this->user, 2)); } - public function testListSubscriptionsInAMissingFolder() { + public function testListSubscriptionsInAMissingFolder():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionList($this->user, 4); } - public function testListSubscriptionsWithoutAuthority() { + public function testListSubscriptionsWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionList($this->user); } - public function testCountSubscriptions() { + public function testCountSubscriptions():void { $this->assertSame(2, Arsse::$db->subscriptionCount($this->user)); $this->assertSame(1, Arsse::$db->subscriptionCount($this->user, 2)); } - public function testCountSubscriptionsInAMissingFolder() { + public function testCountSubscriptionsInAMissingFolder():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionCount($this->user, 4); } - public function testCountSubscriptionsWithoutAuthority() { + public function testCountSubscriptionsWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionCount($this->user); } - public function testGetThePropertiesOfAMissingSubscription() { + public function testGetThePropertiesOfAMissingSubscription():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesGet($this->user, 2112); } - public function testGetThePropertiesOfAnInvalidSubscription() { + public function testGetThePropertiesOfAnInvalidSubscription():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesGet($this->user, -1); } - public function testGetThePropertiesOfASubscriptionWithoutAuthority() { + public function testGetThePropertiesOfASubscriptionWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionPropertiesGet($this->user, 1); } - public function testSetThePropertiesOfASubscription() { + public function testSetThePropertiesOfASubscription():void { Arsse::$db->subscriptionPropertiesSet($this->user, 1, [ 'title' => "Ook Ook", 'folder' => 3, @@ -400,56 +400,56 @@ trait SeriesSubscription { $this->compareExpectations(static::$drv, $state); } - public function testMoveASubscriptionToAMissingFolder() { + public function testMoveASubscriptionToAMissingFolder():void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['folder' => 4]); } - public function testMoveASubscriptionToTheRootFolder() { + public function testMoveASubscriptionToTheRootFolder():void { $this->assertTrue(Arsse::$db->subscriptionPropertiesSet($this->user, 3, ['folder' => null])); } - public function testRenameASubscriptionToABlankTitle() { + public function testRenameASubscriptionToABlankTitle():void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => ""]); } - public function testRenameASubscriptionToAWhitespaceTitle() { + public function testRenameASubscriptionToAWhitespaceTitle():void { $this->assertException("whitespace", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => " "]); } - public function testRenameASubscriptionToFalse() { + public function testRenameASubscriptionToFalse():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => false]); } - public function testRenameASubscriptionToZero() { + public function testRenameASubscriptionToZero():void { $this->assertTrue(Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => 0])); } - public function testRenameASubscriptionToAnArray() { + public function testRenameASubscriptionToAnArray():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => []]); } - public function testSetThePropertiesOfAMissingSubscription() { + public function testSetThePropertiesOfAMissingSubscription():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 2112, ['folder' => null]); } - public function testSetThePropertiesOfAnInvalidSubscription() { + public function testSetThePropertiesOfAnInvalidSubscription():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, -1, ['folder' => null]); } - public function testSetThePropertiesOfASubscriptionWithoutAuthority() { + public function testSetThePropertiesOfASubscriptionWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['folder' => null]); } - public function testRetrieveTheFaviconOfASubscription() { + public function testRetrieveTheFaviconOfASubscription():void { $exp = "http://example.com/favicon.ico"; $this->assertSame($exp, Arsse::$db->subscriptionFavicon(1)); $this->assertSame($exp, Arsse::$db->subscriptionFavicon(2)); @@ -465,7 +465,7 @@ trait SeriesSubscription { $this->assertSame('', Arsse::$db->subscriptionFavicon(-2112)); } - public function testRetrieveTheFaviconOfASubscriptionWithUser() { + public function testRetrieveTheFaviconOfASubscriptionWithUser():void { $exp = "http://example.com/favicon.ico"; $user = "john.doe@example.com"; $this->assertSame($exp, Arsse::$db->subscriptionFavicon(1, $user)); @@ -479,7 +479,7 @@ trait SeriesSubscription { $this->assertSame('', Arsse::$db->subscriptionFavicon(4, $user)); } - public function testRetrieveTheFaviconOfASubscriptionWithUserWithoutAuthority() { + public function testRetrieveTheFaviconOfASubscriptionWithUserWithoutAuthority():void { $exp = "http://example.com/favicon.ico"; $user = "john.doe@example.com"; \Phake::when(Arsse::$user)->authorize->thenReturn(false); @@ -487,36 +487,36 @@ trait SeriesSubscription { Arsse::$db->subscriptionFavicon(-2112, $user); } - public function testListTheTagsOfASubscription() { + public function testListTheTagsOfASubscription():void { $this->assertEquals([1,2], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 1)); $this->assertEquals([2], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 3)); $this->assertEquals(["Fascinating","Interesting"], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 1, true)); $this->assertEquals(["Fascinating"], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 3, true)); } - public function testListTheTagsOfAMissingSubscription() { + public function testListTheTagsOfAMissingSubscription():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionTagsGet($this->user, 101); } - public function testListTheTagsOfASubscriptionWithoutAuthority() { + public function testListTheTagsOfASubscriptionWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionTagsGet("john.doe@example.com", 1); } - public function testGetRefreshTimeOfASubscription() { + public function testGetRefreshTimeOfASubscription():void { $user = "john.doe@example.com"; $this->assertTime(strtotime("now + 1 hour"), Arsse::$db->subscriptionRefreshed($user)); $this->assertTime(strtotime("now - 1 hour"), Arsse::$db->subscriptionRefreshed($user, 1)); } - public function testGetRefreshTimeOfAMissingSubscription() { + public function testGetRefreshTimeOfAMissingSubscription():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertTime(strtotime("now - 1 hour"), Arsse::$db->subscriptionRefreshed("john.doe@example.com", 2)); } - public function testGetRefreshTimeOfASubscriptionWithoutAuthority() { + public function testGetRefreshTimeOfASubscriptionWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); $this->assertTime(strtotime("now + 1 hour"), Arsse::$db->subscriptionRefreshed("john.doe@example.com")); diff --git a/tests/cases/Database/SeriesTag.php b/tests/cases/Database/SeriesTag.php index 6c103136..f2617c45 100644 --- a/tests/cases/Database/SeriesTag.php +++ b/tests/cases/Database/SeriesTag.php @@ -10,7 +10,7 @@ use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\Database; trait SeriesTag { - protected function setUpSeriesTag() { + protected function setUpSeriesTag():void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -104,11 +104,11 @@ trait SeriesTag { $this->user = "john.doe@example.com"; } - protected function tearDownSeriesTag() { + protected function tearDownSeriesTag():void { unset($this->data, $this->checkTags, $this->checkMembers, $this->user); } - public function testAddATag() { + public function testAddATag():void { $user = "john.doe@example.com"; $tagID = $this->nextID("arsse_tags"); $this->assertSame($tagID, Arsse::$db->tagAdd($user, ['name' => "Entertaining"])); @@ -118,33 +118,33 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testAddADuplicateTag() { + public function testAddADuplicateTag():void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->tagAdd("john.doe@example.com", ['name' => "Interesting"]); } - public function testAddATagWithAMissingName() { + public function testAddATagWithAMissingName():void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->tagAdd("john.doe@example.com", []); } - public function testAddATagWithABlankName() { + public function testAddATagWithABlankName():void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->tagAdd("john.doe@example.com", ['name' => ""]); } - public function testAddATagWithAWhitespaceName() { + public function testAddATagWithAWhitespaceName():void { $this->assertException("whitespace", "Db", "ExceptionInput"); Arsse::$db->tagAdd("john.doe@example.com", ['name' => " "]); } - public function testAddATagWithoutAuthority() { + public function testAddATagWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagAdd("john.doe@example.com", ['name' => "Boring"]); } - public function testListTags() { + public function testListTags():void { $exp = [ ['id' => 2, 'name' => "Fascinating"], ['id' => 1, 'name' => "Interesting"], @@ -160,13 +160,13 @@ trait SeriesTag { \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "tagList"); } - public function testListTagsWithoutAuthority() { + public function testListTagsWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagList("john.doe@example.com"); } - public function testRemoveATag() { + public function testRemoveATag():void { $this->assertTrue(Arsse::$db->tagRemove("john.doe@example.com", 1)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "tagRemove"); $state = $this->primeExpectations($this->data, $this->checkTags); @@ -174,7 +174,7 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testRemoveATagByName() { + public function testRemoveATagByName():void { $this->assertTrue(Arsse::$db->tagRemove("john.doe@example.com", "Interesting", true)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "tagRemove"); $state = $this->primeExpectations($this->data, $this->checkTags); @@ -182,33 +182,33 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAMissingTag() { + public function testRemoveAMissingTag():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagRemove("john.doe@example.com", 2112); } - public function testRemoveAnInvalidTag() { + public function testRemoveAnInvalidTag():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagRemove("john.doe@example.com", -1); } - public function testRemoveAnInvalidTagByName() { + public function testRemoveAnInvalidTagByName():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagRemove("john.doe@example.com", [], true); } - public function testRemoveATagOfTheWrongOwner() { + public function testRemoveATagOfTheWrongOwner():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagRemove("john.doe@example.com", 3); // tag ID 3 belongs to Jane } - public function testRemoveATagWithoutAuthority() { + public function testRemoveATagWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagRemove("john.doe@example.com", 1); } - public function testGetThePropertiesOfATag() { + public function testGetThePropertiesOfATag():void { $exp = [ 'id' => 2, 'name' => "Fascinating", @@ -218,37 +218,37 @@ trait SeriesTag { \Phake::verify(Arsse::$user, \Phake::times(2))->authorize("john.doe@example.com", "tagPropertiesGet"); } - public function testGetThePropertiesOfAMissingTag() { + public function testGetThePropertiesOfAMissingTag():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesGet("john.doe@example.com", 2112); } - public function testGetThePropertiesOfAnInvalidTag() { + public function testGetThePropertiesOfAnInvalidTag():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesGet("john.doe@example.com", -1); } - public function testGetThePropertiesOfAnInvalidTagByName() { + public function testGetThePropertiesOfAnInvalidTagByName():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesGet("john.doe@example.com", [], true); } - public function testGetThePropertiesOfATagOfTheWrongOwner() { + public function testGetThePropertiesOfATagOfTheWrongOwner():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesGet("john.doe@example.com", 3); // tag ID 3 belongs to Jane } - public function testGetThePropertiesOfATagWithoutAuthority() { + public function testGetThePropertiesOfATagWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagPropertiesGet("john.doe@example.com", 1); } - public function testMakeNoChangesToATag() { + public function testMakeNoChangesToATag():void { $this->assertFalse(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, [])); } - public function testRenameATag() { + public function testRenameATag():void { $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Curious"])); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "tagPropertiesSet"); $state = $this->primeExpectations($this->data, $this->checkTags); @@ -256,7 +256,7 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testRenameATagByName() { + public function testRenameATagByName():void { $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", "Interesting", ['name' => "Curious"], true)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "tagPropertiesSet"); $state = $this->primeExpectations($this->data, $this->checkTags); @@ -264,53 +264,53 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testRenameATagToTheEmptyString() { + public function testRenameATagToTheEmptyString():void { $this->assertException("missing", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => ""])); } - public function testRenameATagToWhitespaceOnly() { + public function testRenameATagToWhitespaceOnly():void { $this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => " "])); } - public function testRenameATagToAnInvalidValue() { + public function testRenameATagToAnInvalidValue():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => []])); } - public function testCauseATagCollision() { + public function testCauseATagCollision():void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Fascinating"]); } - public function testSetThePropertiesOfAMissingTag() { + public function testSetThePropertiesOfAMissingTag():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesSet("john.doe@example.com", 2112, ['name' => "Exciting"]); } - public function testSetThePropertiesOfAnInvalidTag() { + public function testSetThePropertiesOfAnInvalidTag():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesSet("john.doe@example.com", -1, ['name' => "Exciting"]); } - public function testSetThePropertiesOfAnInvalidTagByName() { + public function testSetThePropertiesOfAnInvalidTagByName():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesSet("john.doe@example.com", [], ['name' => "Exciting"], true); } - public function testSetThePropertiesOfATagForTheWrongOwner() { + public function testSetThePropertiesOfATagForTheWrongOwner():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesSet("john.doe@example.com", 3, ['name' => "Exciting"]); // tag ID 3 belongs to Jane } - public function testSetThePropertiesOfATagWithoutAuthority() { + public function testSetThePropertiesOfATagWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Exciting"]); } - public function testListTaggedSubscriptions() { + public function testListTaggedSubscriptions():void { $exp = [1,5]; $this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 1)); $this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", "Interesting", true)); @@ -322,23 +322,23 @@ trait SeriesTag { $this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", "Lonely", true)); } - public function testListTaggedSubscriptionsForAMissingTag() { + public function testListTaggedSubscriptionsForAMissingTag():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 3); } - public function testListTaggedSubscriptionsForAnInvalidTag() { + public function testListTaggedSubscriptionsForAnInvalidTag():void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagSubscriptionsGet("john.doe@example.com", -1); } - public function testListTaggedSubscriptionsWithoutAuthority() { + public function testListTaggedSubscriptionsWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 1); } - public function testApplyATagToSubscriptions() { + public function testApplyATagToSubscriptions():void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4]); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][1][2] = 1; @@ -346,14 +346,14 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testClearATagFromSubscriptions() { + public function testClearATagFromSubscriptions():void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [1,3], Database::ASSOC_REMOVE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][0][2] = 0; $this->compareExpectations(static::$drv, $state); } - public function testApplyATagToSubscriptionsByName() { + public function testApplyATagToSubscriptionsByName():void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [3,4], Database::ASSOC_ADD, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][1][2] = 1; @@ -361,26 +361,26 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testClearATagFromSubscriptionsByName() { + public function testClearATagFromSubscriptionsByName():void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [1,3], Database::ASSOC_REMOVE, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][0][2] = 0; $this->compareExpectations(static::$drv, $state); } - public function testApplyATagToNoSubscriptionsByName() { + public function testApplyATagToNoSubscriptionsByName():void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [], Database::ASSOC_ADD, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $this->compareExpectations(static::$drv, $state); } - public function testClearATagFromNoSubscriptionsByName() { + public function testClearATagFromNoSubscriptionsByName():void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [], Database::ASSOC_REMOVE, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $this->compareExpectations(static::$drv, $state); } - public function testReplaceSubscriptionsOfATag() { + public function testReplaceSubscriptionsOfATag():void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4], Database::ASSOC_REPLACE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][0][2] = 0; @@ -390,7 +390,7 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testPurgeSubscriptionsOfATag() { + public function testPurgeSubscriptionsOfATag():void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [], Database::ASSOC_REPLACE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][0][2] = 0; @@ -398,13 +398,13 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testApplyATagToSubscriptionsWithoutAuthority() { + public function testApplyATagToSubscriptionsWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4]); } - public function testSummarizeTags() { + public function testSummarizeTags():void { $exp = [ ['id' => 1, 'name' => "Interesting", 'subscription' => 1], ['id' => 1, 'name' => "Interesting", 'subscription' => 5], @@ -415,7 +415,7 @@ trait SeriesTag { $this->assertResult($exp, Arsse::$db->tagSummarize("john.doe@example.com")); } - public function testSummarizeTagsWithoutAuthority() { + public function testSummarizeTagsWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagSummarize("john.doe@example.com"); diff --git a/tests/cases/Database/SeriesToken.php b/tests/cases/Database/SeriesToken.php index 6bce88a5..ca37c1d8 100644 --- a/tests/cases/Database/SeriesToken.php +++ b/tests/cases/Database/SeriesToken.php @@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\TestCase\Database; use JKingWeb\Arsse\Arsse; trait SeriesToken { - protected function setUpSeriesToken() { + protected function setUpSeriesToken():void { // set up the test data $past = gmdate("Y-m-d H:i:s", strtotime("now - 1 minute")); $future = gmdate("Y-m-d H:i:s", strtotime("now + 1 minute")); @@ -43,11 +43,11 @@ trait SeriesToken { ]; } - protected function tearDownSeriesToken() { + protected function tearDownSeriesToken():void { unset($this->data); } - public function testLookUpAValidToken() { + public function testLookUpAValidToken():void { $exp1 = [ 'id' => "80fa94c1a11f11e78667001e673b2560", 'class' => "fever.login", @@ -71,22 +71,22 @@ trait SeriesToken { $this->assertArraySubset($exp1, Arsse::$db->tokenLookup("fever.login", "80fa94c1a11f11e78667001e673b2560")); } - public function testLookUpAMissingToken() { + public function testLookUpAMissingToken():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tokenLookup("class", "thisTokenDoesNotExist"); } - public function testLookUpAnExpiredToken() { + public function testLookUpAnExpiredToken():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tokenLookup("fever.login", "27c6de8da13311e78667001e673b2560"); } - public function testLookUpATokenOfTheWrongClass() { + public function testLookUpATokenOfTheWrongClass():void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tokenLookup("some.class", "80fa94c1a11f11e78667001e673b2560"); } - public function testCreateAToken() { + public function testCreateAToken():void { $user = "jane.doe@example.com"; $state = $this->primeExpectations($this->data, ['arsse_tokens' => ["id", "class", "expires", "user"]]); $id = Arsse::$db->tokenCreate($user, "fever.login"); @@ -100,18 +100,18 @@ trait SeriesToken { $this->compareExpectations(static::$drv, $state); } - public function testCreateATokenForAMissingUser() { + public function testCreateATokenForAMissingUser():void { $this->assertException("doesNotExist", "User"); Arsse::$db->tokenCreate("fever.login", "jane.doe@example.biz"); } - public function testCreateATokenWithoutAuthority() { + public function testCreateATokenWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tokenCreate("fever.login", "jane.doe@example.com"); } - public function testRevokeAToken() { + public function testRevokeAToken():void { $user = "jane.doe@example.com"; $id = "80fa94c1a11f11e78667001e673b2560"; $this->assertTrue(Arsse::$db->tokenRevoke($user, "fever.login", $id)); @@ -122,7 +122,7 @@ trait SeriesToken { $this->assertFalse(Arsse::$db->tokenRevoke($user, "fever.login", $id)); } - public function testRevokeAllTokens() { + public function testRevokeAllTokens():void { $user = "jane.doe@example.com"; $state = $this->primeExpectations($this->data, ['arsse_tokens' => ["id", "expires", "user"]]); $this->assertTrue(Arsse::$db->tokenRevoke($user, "fever.login")); @@ -136,7 +136,7 @@ trait SeriesToken { $this->assertFalse(Arsse::$db->tokenRevoke($user, "unknown.class")); } - public function testRevokeATokenWithoutAuthority() { + public function testRevokeATokenWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tokenRevoke("jane.doe@example.com", "fever.login"); diff --git a/tests/cases/Database/SeriesUser.php b/tests/cases/Database/SeriesUser.php index 265151b2..4a0abb39 100644 --- a/tests/cases/Database/SeriesUser.php +++ b/tests/cases/Database/SeriesUser.php @@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\TestCase\Database; use JKingWeb\Arsse\Arsse; trait SeriesUser { - protected function setUpSeriesUser() { + protected function setUpSeriesUser():void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -25,11 +25,11 @@ trait SeriesUser { ]; } - protected function tearDownSeriesUser() { + protected function tearDownSeriesUser():void { unset($this->data); } - public function testCheckThatAUserExists() { + public function testCheckThatAUserExists():void { $this->assertTrue(Arsse::$db->userExists("jane.doe@example.com")); $this->assertFalse(Arsse::$db->userExists("jane.doe@example.org")); \Phake::verify(Arsse::$user)->authorize("jane.doe@example.com", "userExists"); @@ -37,31 +37,31 @@ trait SeriesUser { $this->compareExpectations(static::$drv, $this->data); } - public function testCheckThatAUserExistsWithoutAuthority() { + public function testCheckThatAUserExistsWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userExists("jane.doe@example.com"); } - public function testGetAPassword() { + public function testGetAPassword():void { $hash = Arsse::$db->userPasswordGet("admin@example.net"); $this->assertSame('$2y$10$PbcG2ZR3Z8TuPzM7aHTF8.v61dtCjzjK78gdZJcp4UePE8T9jEgBW', $hash); \Phake::verify(Arsse::$user)->authorize("admin@example.net", "userPasswordGet"); $this->assertTrue(password_verify("secret", $hash)); } - public function testGetThePasswordOfAMissingUser() { + public function testGetThePasswordOfAMissingUser():void { $this->assertException("doesNotExist", "User"); Arsse::$db->userPasswordGet("john.doe@example.org"); } - public function testGetAPasswordWithoutAuthority() { + public function testGetAPasswordWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userPasswordGet("admin@example.net"); } - public function testAddANewUser() { + public function testAddANewUser():void { $this->assertTrue(Arsse::$db->userAdd("john.doe@example.org", "")); \Phake::verify(Arsse::$user)->authorize("john.doe@example.org", "userAdd"); $state = $this->primeExpectations($this->data, ['arsse_users' => ['id']]); @@ -69,18 +69,18 @@ trait SeriesUser { $this->compareExpectations(static::$drv, $state); } - public function testAddAnExistingUser() { + public function testAddAnExistingUser():void { $this->assertException("alreadyExists", "User"); Arsse::$db->userAdd("john.doe@example.com", ""); } - public function testAddANewUserWithoutAuthority() { + public function testAddANewUserWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userAdd("john.doe@example.org", ""); } - public function testRemoveAUser() { + public function testRemoveAUser():void { $this->assertTrue(Arsse::$db->userRemove("admin@example.net")); \Phake::verify(Arsse::$user)->authorize("admin@example.net", "userRemove"); $state = $this->primeExpectations($this->data, ['arsse_users' => ['id']]); @@ -88,24 +88,24 @@ trait SeriesUser { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAMissingUser() { + public function testRemoveAMissingUser():void { $this->assertException("doesNotExist", "User"); Arsse::$db->userRemove("john.doe@example.org"); } - public function testRemoveAUserWithoutAuthority() { + public function testRemoveAUserWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userRemove("admin@example.net"); } - public function testListAllUsers() { + public function testListAllUsers():void { $users = ["admin@example.net", "jane.doe@example.com", "john.doe@example.com"]; $this->assertSame($users, Arsse::$db->userList()); \Phake::verify(Arsse::$user)->authorize("", "userList"); } - public function testListAllUsersWithoutAuthority() { + public function testListAllUsersWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userList(); @@ -114,7 +114,7 @@ trait SeriesUser { /** * @depends testGetAPassword */ - public function testSetAPassword() { + public function testSetAPassword():void { $user = "john.doe@example.com"; $pass = "secret"; $this->assertEquals("", Arsse::$db->userPasswordGet($user)); @@ -125,19 +125,19 @@ trait SeriesUser { $this->assertTrue(password_verify($pass, $hash), "Failed verifying password of $user '$pass' against hash '$hash'."); } - public function testUnsetAPassword() { + public function testUnsetAPassword():void { $user = "john.doe@example.com"; $this->assertEquals("", Arsse::$db->userPasswordGet($user)); $this->assertTrue(Arsse::$db->userPasswordSet($user, null)); $this->assertNull(Arsse::$db->userPasswordGet($user)); } - public function testSetThePasswordOfAMissingUser() { + public function testSetThePasswordOfAMissingUser():void { $this->assertException("doesNotExist", "User"); Arsse::$db->userPasswordSet("john.doe@example.org", "secret"); } - public function testSetAPasswordWithoutAuthority() { + public function testSetAPasswordWithoutAuthority():void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userPasswordSet("john.doe@example.com", "secret"); diff --git a/tests/cases/Database/TestDatabase.php b/tests/cases/Database/TestDatabase.php index 3ae4f5b2..6f2249fe 100644 --- a/tests/cases/Database/TestDatabase.php +++ b/tests/cases/Database/TestDatabase.php @@ -28,7 +28,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideInClauses */ - public function testGenerateInClause(string $clause, array $values, array $inV, string $inT) { + public function testGenerateInClause(string $clause, array $values, array $inV, string $inT):void { $types = array_fill(0, sizeof($values), $inT); $exp = [$clause, $types, $values]; $this->assertSame($exp, $this->db->generateIn($inV, $inT)); @@ -62,7 +62,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideSearchClauses */ - public function testGenerateSearchClause(string $clause, array $values, array $inV, array $inC, bool $inAny) { + public function testGenerateSearchClause(string $clause, array $values, array $inV, array $inC, bool $inAny):void { // this is not an exhaustive test; integration tests already cover the ins and outs of the functionality $types = array_fill(0, sizeof($values), "str"); $exp = [$clause, $types, $values]; diff --git a/tests/cases/Db/BaseDriver.php b/tests/cases/Db/BaseDriver.php index 59165a1b..990f4872 100644 --- a/tests/cases/Db/BaseDriver.php +++ b/tests/cases/Db/BaseDriver.php @@ -76,112 +76,112 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { # TESTS - public function testFetchDriverName() { + public function testFetchDriverName():void { $class = get_class($this->drv); $this->assertTrue(strlen($class::driverName()) > 0); } - public function testFetchSchemaId() { + public function testFetchSchemaId():void { $class = get_class($this->drv); $this->assertTrue(strlen($class::schemaID()) > 0); } - public function testCheckCharacterSetAcceptability() { + public function testCheckCharacterSetAcceptability():void { $this->assertTrue($this->drv->charsetAcceptable()); } - public function testTranslateAToken() { + public function testTranslateAToken():void { $this->assertRegExp("/^[a-z][a-z0-9]*$/i", $this->drv->sqlToken("greatest")); $this->assertRegExp("/^\"?[a-z][a-z0-9_\-]*\"?$/i", $this->drv->sqlToken("nocase")); $this->assertRegExp("/^[a-z][a-z0-9]*$/i", $this->drv->sqlToken("like")); $this->assertSame("distinct", $this->drv->sqlToken("distinct")); } - public function testExecAValidStatement() { + public function testExecAValidStatement():void { $this->assertTrue($this->drv->exec($this->create)); } - public function testExecAnInvalidStatement() { + public function testExecAnInvalidStatement():void { $this->assertException("engineErrorGeneral", "Db"); $this->drv->exec("And the meek shall inherit the earth..."); } - public function testExecMultipleStatements() { + public function testExecMultipleStatements():void { $this->assertTrue($this->drv->exec("$this->create; INSERT INTO arsse_test(id) values(2112)")); $this->assertEquals(2112, $this->query("SELECT id from arsse_test")); } - public function testExecTimeout() { + public function testExecTimeout():void { $this->exec($this->create); $this->exec($this->lock); $this->assertException("general", "Db", "ExceptionTimeout"); $this->drv->exec("INSERT INTO arsse_meta(\"key\", value) values('lock', '1')"); } - public function testExecConstraintViolation() { + public function testExecConstraintViolation():void { $this->drv->exec("CREATE TABLE arsse_test(id varchar(255) not null)"); $this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->drv->exec(static::$insertDefaultValues); } - public function testExecTypeViolation() { + public function testExecTypeViolation():void { $this->drv->exec($this->create); $this->assertException("typeViolation", "Db", "ExceptionInput"); $this->drv->exec("INSERT INTO arsse_test(id) values('ook')"); } - public function testMakeAValidQuery() { + public function testMakeAValidQuery():void { $this->assertInstanceOf(Result::class, $this->drv->query("SELECT 1")); } - public function testMakeAnInvalidQuery() { + public function testMakeAnInvalidQuery():void { $this->assertException("engineErrorGeneral", "Db"); $this->drv->query("Apollo was astonished; Dionysus thought me mad"); } - public function testQueryConstraintViolation() { + public function testQueryConstraintViolation():void { $this->drv->exec("CREATE TABLE arsse_test(id integer not null)"); $this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->drv->query(static::$insertDefaultValues); } - public function testQueryTypeViolation() { + public function testQueryTypeViolation():void { $this->drv->exec($this->create); $this->assertException("typeViolation", "Db", "ExceptionInput"); $this->drv->query("INSERT INTO arsse_test(id) values('ook')"); } - public function testPrepareAValidQuery() { + public function testPrepareAValidQuery():void { $s = $this->drv->prepare("SELECT ?, ?", "int", "int"); $this->assertInstanceOf(Statement::class, $s); } - public function testPrepareAnInvalidQuery() { + public function testPrepareAnInvalidQuery():void { $this->assertException("engineErrorGeneral", "Db"); $s = $this->drv->prepare("This is an invalid query", "int", "int")->run(); } - public function testCreateASavepoint() { + public function testCreateASavepoint():void { $this->assertEquals(1, $this->drv->savepointCreate()); $this->assertEquals(2, $this->drv->savepointCreate()); $this->assertEquals(3, $this->drv->savepointCreate()); } - public function testReleaseASavepoint() { + public function testReleaseASavepoint():void { $this->assertEquals(1, $this->drv->savepointCreate()); $this->assertEquals(true, $this->drv->savepointRelease()); $this->assertException("savepointInvalid", "Db"); $this->drv->savepointRelease(); } - public function testUndoASavepoint() { + public function testUndoASavepoint():void { $this->assertEquals(1, $this->drv->savepointCreate()); $this->assertEquals(true, $this->drv->savepointUndo()); $this->assertException("savepointInvalid", "Db"); $this->drv->savepointUndo(); } - public function testManipulateSavepoints() { + public function testManipulateSavepoints():void { $this->assertEquals(1, $this->drv->savepointCreate()); $this->assertEquals(2, $this->drv->savepointCreate()); $this->assertEquals(3, $this->drv->savepointCreate()); @@ -198,7 +198,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->drv->savepointRelease(2); } - public function testManipulateSavepointsSomeMore() { + public function testManipulateSavepointsSomeMore():void { $this->assertEquals(1, $this->drv->savepointCreate()); $this->assertEquals(2, $this->drv->savepointCreate()); $this->assertEquals(3, $this->drv->savepointCreate()); @@ -209,7 +209,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->drv->savepointUndo(2); } - public function testBeginATransaction() { + public function testBeginATransaction():void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr = $this->drv->begin(); @@ -221,7 +221,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(0, $this->query($select)); } - public function testCommitATransaction() { + public function testCommitATransaction():void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr = $this->drv->begin(); @@ -233,7 +233,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(1, $this->query($select)); } - public function testRollbackATransaction() { + public function testRollbackATransaction():void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr = $this->drv->begin(); @@ -245,7 +245,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(0, $this->query($select)); } - public function testBeginChainedTransactions() { + public function testBeginChainedTransactions():void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -258,7 +258,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(0, $this->query($select)); } - public function testCommitChainedTransactions() { + public function testCommitChainedTransactions():void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -275,7 +275,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(2, $this->query($select)); } - public function testCommitChainedTransactionsOutOfOrder() { + public function testCommitChainedTransactionsOutOfOrder():void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -291,7 +291,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $tr2->commit(); } - public function testRollbackChainedTransactions() { + public function testRollbackChainedTransactions():void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -310,7 +310,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(0, $this->query($select)); } - public function testRollbackChainedTransactionsOutOfOrder() { + public function testRollbackChainedTransactionsOutOfOrder():void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -329,7 +329,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(0, $this->query($select)); } - public function testPartiallyRollbackChainedTransactions() { + public function testPartiallyRollbackChainedTransactions():void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -348,7 +348,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(1, $this->query($select)); } - public function testFetchSchemaVersion() { + public function testFetchSchemaVersion():void { $this->assertSame(0, $this->drv->schemaVersion()); $this->drv->exec(str_replace("#", "1", $this->setVersion)); $this->assertSame(1, $this->drv->schemaVersion()); @@ -361,7 +361,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $this->drv->schemaVersion()); } - public function testLockTheDatabase() { + public function testLockTheDatabase():void { // PostgreSQL doesn't actually lock the whole database, only the metadata table // normally the application will first query this table to ensure the schema version is correct, // so the effect is usually the same @@ -370,7 +370,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->exec($this->lock); } - public function testUnlockTheDatabase() { + public function testUnlockTheDatabase():void { $this->drv->savepointCreate(true); $this->drv->savepointRelease(); $this->drv->savepointCreate(true); @@ -378,11 +378,11 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertTrue($this->exec(str_replace("#", "3", $this->setVersion))); } - public function testProduceAStringLiteral() { + public function testProduceAStringLiteral():void { $this->assertSame("'It''s a string!'", $this->drv->literalString("It's a string!")); } - public function testPerformMaintenance() { + public function testPerformMaintenance():void { // this performs maintenance in the absence of tables; see BaseUpdate.php for another test with tables $this->assertTrue($this->drv->maintenance()); } diff --git a/tests/cases/Db/BaseResult.php b/tests/cases/Db/BaseResult.php index 0fa84dcc..844b8b80 100644 --- a/tests/cases/Db/BaseResult.php +++ b/tests/cases/Db/BaseResult.php @@ -46,18 +46,18 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testConstructResult() { + public function testConstructResult():void { $this->assertInstanceOf(Result::class, new $this->resultClass(...$this->makeResult("SELECT 1"))); } - public function testGetChangeCountAndLastInsertId() { + public function testGetChangeCountAndLastInsertId():void { $this->makeResult(static::$createMeta); $r = new $this->resultClass(...$this->makeResult("INSERT INTO arsse_meta(\"key\",value) values('test', 1)")); $this->assertSame(1, $r->changes()); $this->assertSame(0, $r->lastId()); } - public function testGetChangeCountAndLastInsertIdBis() { + public function testGetChangeCountAndLastInsertIdBis():void { $this->makeResult(static::$createTest); $r = new $this->resultClass(...$this->makeResult(static::$insertDefault)); $this->assertSame(1, $r->changes()); @@ -67,7 +67,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(2, $r->lastId()); } - public function testIterateOverResults() { + public function testIterateOverResults():void { $exp = [0 => 1, 1 => 2, 2 => 3]; $exp = static::$stringOutput ? $this->stringify($exp) : $exp; foreach (new $this->resultClass(...$this->makeResult("SELECT 1 as col union select 2 as col union select 3 as col")) as $index => $row) { @@ -76,7 +76,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $rows); } - public function testIterateOverResultsTwice() { + public function testIterateOverResultsTwice():void { $exp = [0 => 1, 1 => 2, 2 => 3]; $exp = static::$stringOutput ? $this->stringify($exp) : $exp; $result = new $this->resultClass(...$this->makeResult("SELECT 1 as col union select 2 as col union select 3 as col")); @@ -90,7 +90,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testGetSingleValues() { + public function testGetSingleValues():void { $exp = [1867, 1970, 2112]; $exp = static::$stringOutput ? $this->stringify($exp) : $exp; $test = new $this->resultClass(...$this->makeResult("SELECT 1867 as year union all select 1970 as year union all select 2112 as year")); @@ -100,7 +100,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getValue()); } - public function testGetFirstValuesOnly() { + public function testGetFirstValuesOnly():void { $exp = [1867, 1970, 2112]; $exp = static::$stringOutput ? $this->stringify($exp) : $exp; $test = new $this->resultClass(...$this->makeResult("SELECT 1867 as year, 19 as century union all select 1970 as year, 20 as century union all select 2112 as year, 22 as century")); @@ -110,7 +110,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getValue()); } - public function testGetRows() { + public function testGetRows():void { $exp = [ ['album' => '2112', 'track' => '2112'], ['album' => 'Clockwork Angels', 'track' => 'The Wreckers'], @@ -121,7 +121,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getRow()); } - public function testGetAllRows() { + public function testGetAllRows():void { $exp = [ ['album' => '2112', 'track' => '2112'], ['album' => 'Clockwork Angels', 'track' => 'The Wreckers'], diff --git a/tests/cases/Db/BaseStatement.php b/tests/cases/Db/BaseStatement.php index 6aa81cf3..25364fdd 100644 --- a/tests/cases/Db/BaseStatement.php +++ b/tests/cases/Db/BaseStatement.php @@ -46,12 +46,12 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testConstructStatement() { + public function testConstructStatement():void { $this->assertInstanceOf(Statement::class, new $this->statementClass(...$this->makeStatement("SELECT ? as value"))); } /** @dataProvider provideBindings */ - public function testBindATypedValue($value, string $type, string $exp) { + public function testBindATypedValue($value, string $type, string $exp):void { if ($exp === "null") { $query = "SELECT (? is null) as pass"; } else { @@ -65,7 +65,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideBinaryBindings */ - public function testHandleBinaryData($value, string $type, string $exp) { + public function testHandleBinaryData($value, string $type, string $exp):void { if (in_array(static::$implementation, ["PostgreSQL", "PDO PostgreSQL"])) { $this->markTestIncomplete("Correct handling of binary data with PostgreSQL is not currently implemented"); } @@ -81,13 +81,13 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertTrue((bool) $act); } - public function testBindMissingValue() { + public function testBindMissingValue():void { $s = new $this->statementClass(...$this->makeStatement("SELECT ? as value", ["int"])); $val = $s->runArray()->getRow()['value']; $this->assertSame(null, $val); } - public function testBindMultipleValues() { + public function testBindMultipleValues():void { $exp = [ 'one' => "A", 'two' => "B", @@ -97,7 +97,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $val); } - public function testBindRecursively() { + public function testBindRecursively():void { $exp = [ 'one' => "A", 'two' => "B", @@ -109,20 +109,20 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $val); } - public function testBindWithoutType() { + public function testBindWithoutType():void { $this->assertException("paramTypeMissing", "Db"); $s = new $this->statementClass(...$this->makeStatement("SELECT ? as value", [])); $s->runArray([1]); } - public function testViolateConstraint() { + public function testViolateConstraint():void { (new $this->statementClass(...$this->makeStatement("CREATE TABLE if not exists arsse_meta(\"key\" varchar(255) primary key not null, value text)")))->run(); $s = new $this->statementClass(...$this->makeStatement("INSERT INTO arsse_meta(\"key\") values(?)", ["str"])); $this->assertException("constraintViolation", "Db", "ExceptionInput"); $s->runArray([null]); } - public function testMismatchTypes() { + public function testMismatchTypes():void { (new $this->statementClass(...$this->makeStatement("CREATE TABLE if not exists arsse_feeds(id integer primary key not null, url text not null)")))->run(); $s = new $this->statementClass(...$this->makeStatement("INSERT INTO arsse_feeds(id,url) values(?,?)", ["str", "str"])); $this->assertException("typeViolation", "Db", "ExceptionInput"); diff --git a/tests/cases/Db/BaseUpdate.php b/tests/cases/Db/BaseUpdate.php index 0c78dccb..f9e129dd 100644 --- a/tests/cases/Db/BaseUpdate.php +++ b/tests/cases/Db/BaseUpdate.php @@ -58,43 +58,43 @@ class BaseUpdate extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testLoadMissingFile() { + public function testLoadMissingFile():void { $this->assertException("updateFileMissing", "Db"); $this->drv->schemaUpdate(1, $this->base); } - public function testLoadUnreadableFile() { + public function testLoadUnreadableFile():void { touch($this->path."0.sql"); chmod($this->path."0.sql", 0000); $this->assertException("updateFileUnreadable", "Db"); $this->drv->schemaUpdate(1, $this->base); } - public function testLoadCorruptFile() { + public function testLoadCorruptFile():void { file_put_contents($this->path."0.sql", "This is a corrupt file"); $this->assertException("updateFileError", "Db"); $this->drv->schemaUpdate(1, $this->base); } - public function testLoadIncompleteFile() { + public function testLoadIncompleteFile():void { file_put_contents($this->path."0.sql", "create table arsse_meta(\"key\" varchar(255) primary key not null, value text);"); $this->assertException("updateFileIncomplete", "Db"); $this->drv->schemaUpdate(1, $this->base); } - public function testLoadEmptyFile() { + public function testLoadEmptyFile():void { file_put_contents($this->path."0.sql", ""); $this->assertException("updateFileIncomplete", "Db"); $this->drv->schemaUpdate(1, $this->base); } - public function testLoadCorrectFile() { + public function testLoadCorrectFile():void { file_put_contents($this->path."0.sql", static::$minimal1); $this->drv->schemaUpdate(1, $this->base); $this->assertEquals(1, $this->drv->schemaVersion()); } - public function testPerformPartialUpdate() { + public function testPerformPartialUpdate():void { file_put_contents($this->path."0.sql", static::$minimal1); file_put_contents($this->path."1.sql", "UPDATE arsse_meta set value = '1' where \"key\" = 'schema_version'"); $this->assertException("updateFileIncomplete", "Db"); @@ -106,31 +106,31 @@ class BaseUpdate extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testPerformSequentialUpdate() { + public function testPerformSequentialUpdate():void { file_put_contents($this->path."0.sql", static::$minimal1); file_put_contents($this->path."1.sql", static::$minimal2); $this->drv->schemaUpdate(2, $this->base); $this->assertEquals(2, $this->drv->schemaVersion()); } - public function testPerformActualUpdate() { + public function testPerformActualUpdate():void { $this->drv->schemaUpdate(Database::SCHEMA_VERSION); $this->assertEquals(Database::SCHEMA_VERSION, $this->drv->schemaVersion()); } - public function testDeclineManualUpdate() { + public function testDeclineManualUpdate():void { // turn auto-updating off Arsse::$conf->dbAutoUpdate = false; $this->assertException("updateManual", "Db"); $this->drv->schemaUpdate(Database::SCHEMA_VERSION); } - public function testDeclineDowngrade() { + public function testDeclineDowngrade():void { $this->assertException("updateTooNew", "Db"); $this->drv->schemaUpdate(-1, $this->base); } - public function testPerformMaintenance() { + public function testPerformMaintenance():void { $this->drv->schemaUpdate(Database::SCHEMA_VERSION); $this->assertTrue($this->drv->maintenance()); } diff --git a/tests/cases/Db/MySQL/TestCreation.php b/tests/cases/Db/MySQL/TestCreation.php index 5f9200c9..6b0bbdf4 100644 --- a/tests/cases/Db/MySQL/TestCreation.php +++ b/tests/cases/Db/MySQL/TestCreation.php @@ -19,7 +19,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testFailToConnect() { + public function testFailToConnect():void { // for the sake of simplicity we don't distinguish between failure modes, but the MySQL-supplied error messages do self::setConf([ 'dbMySQLHost' => "example.invalid", diff --git a/tests/cases/Db/MySQL/TestStatement.php b/tests/cases/Db/MySQL/TestStatement.php index 4fcf2ef6..c044c03f 100644 --- a/tests/cases/Db/MySQL/TestStatement.php +++ b/tests/cases/Db/MySQL/TestStatement.php @@ -34,7 +34,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement { } } - public function testBindLongString() { + public function testBindLongString():void { // this test requires some set-up to be effective static::$interface->query("CREATE TABLE arsse_test(`value` longtext not null) character set utf8mb4"); // we'll use an unrealistic packet size of 1 byte to trigger special handling for strings which are too long for the maximum packet size diff --git a/tests/cases/Db/MySQLPDO/TestCreation.php b/tests/cases/Db/MySQLPDO/TestCreation.php index 56973eff..856e3488 100644 --- a/tests/cases/Db/MySQLPDO/TestCreation.php +++ b/tests/cases/Db/MySQLPDO/TestCreation.php @@ -19,7 +19,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testFailToConnect() { + public function testFailToConnect():void { // for the sake of simplicity we don't distinguish between failure modes, but the MySQL-supplied error messages do self::setConf([ 'dbMySQLHost' => "example.invalid", diff --git a/tests/cases/Db/PostgreSQL/TestCreation.php b/tests/cases/Db/PostgreSQL/TestCreation.php index bfd58a6d..fcfea3fe 100644 --- a/tests/cases/Db/PostgreSQL/TestCreation.php +++ b/tests/cases/Db/PostgreSQL/TestCreation.php @@ -20,7 +20,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideConnectionStrings */ - public function testGenerateConnectionString(bool $pdo, string $user, string $pass, string $db, string $host, int $port, string $service, string $exp) { + public function testGenerateConnectionString(bool $pdo, string $user, string $pass, string $db, string $host, int $port, string $service, string $exp):void { self::setConf(); $timeout = (string) ceil(Arsse::$conf->dbTimeoutConnect ?? 0); $postfix = "application_name='arsse' client_encoding='UTF8' connect_timeout='$timeout'"; @@ -62,7 +62,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testFailToConnect() { + public function testFailToConnect():void { // we cannnot distinguish between different connection failure modes self::setConf([ 'dbPostgreSQLHost' => "example.invalid", diff --git a/tests/cases/Db/PostgreSQLPDO/TestCreation.php b/tests/cases/Db/PostgreSQLPDO/TestCreation.php index cb1b9cae..003dbe52 100644 --- a/tests/cases/Db/PostgreSQLPDO/TestCreation.php +++ b/tests/cases/Db/PostgreSQLPDO/TestCreation.php @@ -20,7 +20,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideConnectionStrings */ - public function testGenerateConnectionString(bool $pdo, string $user, string $pass, string $db, string $host, int $port, string $service, string $exp) { + public function testGenerateConnectionString(bool $pdo, string $user, string $pass, string $db, string $host, int $port, string $service, string $exp):void { self::setConf(); $timeout = (string) ceil(Arsse::$conf->dbTimeoutConnect ?? 0); $postfix = "application_name='arsse' client_encoding='UTF8' connect_timeout='$timeout'"; @@ -62,7 +62,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testFailToConnect() { + public function testFailToConnect():void { // PDO dies not distinguish between different connection failure modes self::setConf([ 'dbPostgreSQLHost' => "example.invalid", diff --git a/tests/cases/Db/SQLite3/TestCreation.php b/tests/cases/Db/SQLite3/TestCreation.php index 59a7d5b8..2eef1f31 100644 --- a/tests/cases/Db/SQLite3/TestCreation.php +++ b/tests/cases/Db/SQLite3/TestCreation.php @@ -112,79 +112,79 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testFailToCreateDatabase() { + public function testFailToCreateDatabase():void { Arsse::$conf->dbSQLite3File = $this->path."Cmain/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToCreateJournal() { + public function testFailToCreateJournal():void { Arsse::$conf->dbSQLite3File = $this->path."Cwal/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToCreateSharedMmeory() { + public function testFailToCreateSharedMmeory():void { Arsse::$conf->dbSQLite3File = $this->path."Cshm/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToReadDatabase() { + public function testFailToReadDatabase():void { Arsse::$conf->dbSQLite3File = $this->path."Rmain/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToReadJournal() { + public function testFailToReadJournal():void { Arsse::$conf->dbSQLite3File = $this->path."Rwal/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToReadSharedMmeory() { + public function testFailToReadSharedMmeory():void { Arsse::$conf->dbSQLite3File = $this->path."Rshm/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToWriteToDatabase() { + public function testFailToWriteToDatabase():void { Arsse::$conf->dbSQLite3File = $this->path."Wmain/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToWriteToJournal() { + public function testFailToWriteToJournal():void { Arsse::$conf->dbSQLite3File = $this->path."Wwal/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToWriteToSharedMmeory() { + public function testFailToWriteToSharedMmeory():void { Arsse::$conf->dbSQLite3File = $this->path."Wshm/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToAccessDatabase() { + public function testFailToAccessDatabase():void { Arsse::$conf->dbSQLite3File = $this->path."Amain/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testFailToAccessJournal() { + public function testFailToAccessJournal():void { Arsse::$conf->dbSQLite3File = $this->path."Awal/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testFailToAccessSharedMmeory() { + public function testFailToAccessSharedMmeory():void { Arsse::$conf->dbSQLite3File = $this->path."Ashm/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testAssumeDatabaseCorruption() { + public function testAssumeDatabaseCorruption():void { Arsse::$conf->dbSQLite3File = $this->path."corrupt/arsse.db"; $this->assertException("fileCorrupt", "Db"); new Driver; diff --git a/tests/cases/Db/SQLite3PDO/TestCreation.php b/tests/cases/Db/SQLite3PDO/TestCreation.php index d700d194..dde9dd7b 100644 --- a/tests/cases/Db/SQLite3PDO/TestCreation.php +++ b/tests/cases/Db/SQLite3PDO/TestCreation.php @@ -114,79 +114,79 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testFailToCreateDatabase() { + public function testFailToCreateDatabase():void { Arsse::$conf->dbSQLite3File = $this->path."Cmain/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToCreateJournal() { + public function testFailToCreateJournal():void { Arsse::$conf->dbSQLite3File = $this->path."Cwal/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToCreateSharedMmeory() { + public function testFailToCreateSharedMmeory():void { Arsse::$conf->dbSQLite3File = $this->path."Cshm/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToReadDatabase() { + public function testFailToReadDatabase():void { Arsse::$conf->dbSQLite3File = $this->path."Rmain/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToReadJournal() { + public function testFailToReadJournal():void { Arsse::$conf->dbSQLite3File = $this->path."Rwal/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToReadSharedMmeory() { + public function testFailToReadSharedMmeory():void { Arsse::$conf->dbSQLite3File = $this->path."Rshm/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToWriteToDatabase() { + public function testFailToWriteToDatabase():void { Arsse::$conf->dbSQLite3File = $this->path."Wmain/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToWriteToJournal() { + public function testFailToWriteToJournal():void { Arsse::$conf->dbSQLite3File = $this->path."Wwal/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToWriteToSharedMmeory() { + public function testFailToWriteToSharedMmeory():void { Arsse::$conf->dbSQLite3File = $this->path."Wshm/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToAccessDatabase() { + public function testFailToAccessDatabase():void { Arsse::$conf->dbSQLite3File = $this->path."Amain/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testFailToAccessJournal() { + public function testFailToAccessJournal():void { Arsse::$conf->dbSQLite3File = $this->path."Awal/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testFailToAccessSharedMmeory() { + public function testFailToAccessSharedMmeory():void { Arsse::$conf->dbSQLite3File = $this->path."Ashm/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testAssumeDatabaseCorruption() { + public function testAssumeDatabaseCorruption():void { Arsse::$conf->dbSQLite3File = $this->path."corrupt/arsse.db"; $this->assertException("fileCorrupt", "Db"); new Driver; diff --git a/tests/cases/Db/TestResultAggregate.php b/tests/cases/Db/TestResultAggregate.php index cb450ac8..0dad2194 100644 --- a/tests/cases/Db/TestResultAggregate.php +++ b/tests/cases/Db/TestResultAggregate.php @@ -7,7 +7,7 @@ use JKingWeb\Arsse\Test\Result; /** @covers \JKingWeb\Arsse\Db\ResultAggregate */ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { - public function testGetChangeCountAndLastInsertId() { + public function testGetChangeCountAndLastInsertId():void { $in = [ new Result([], 3, 4), new Result([], 27, 10), @@ -18,7 +18,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(2112, $r->lastId()); } - public function testIterateOverResults() { + public function testIterateOverResults():void { $in = [ new Result([['col' => 1]]), new Result([['col' => 2]]), @@ -31,7 +31,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals([0 => 1, 1 => 2, 2 => 3], $rows); } - public function testIterateOverResultsTwice() { + public function testIterateOverResultsTwice():void { $in = [ new Result([['col' => 1]]), new Result([['col' => 2]]), @@ -49,7 +49,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testGetSingleValues() { + public function testGetSingleValues():void { $test = new ResultAggregate(...[ new Result([['year' => 1867]]), new Result([['year' => 1970]]), @@ -61,7 +61,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getValue()); } - public function testGetFirstValuesOnly() { + public function testGetFirstValuesOnly():void { $test = new ResultAggregate(...[ new Result([['year' => 1867, 'century' => 19]]), new Result([['year' => 1970, 'century' => 20]]), @@ -73,7 +73,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getValue()); } - public function testGetRows() { + public function testGetRows():void { $test = new ResultAggregate(...[ new Result([['album' => '2112', 'track' => '2112']]), new Result([['album' => 'Clockwork Angels', 'track' => 'The Wreckers']]), @@ -87,7 +87,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getRow()); } - public function testGetAllRows() { + public function testGetAllRows():void { $test = new ResultAggregate(...[ new Result([['album' => '2112', 'track' => '2112']]), new Result([['album' => 'Clockwork Angels', 'track' => 'The Wreckers']]), diff --git a/tests/cases/Db/TestResultEmpty.php b/tests/cases/Db/TestResultEmpty.php index 03df4d40..c9a799f9 100644 --- a/tests/cases/Db/TestResultEmpty.php +++ b/tests/cases/Db/TestResultEmpty.php @@ -6,13 +6,13 @@ use JKingWeb\Arsse\Db\ResultEmpty; /** @covers \JKingWeb\Arsse\Db\ResultEmpty */ class TestResultEmpty extends \JKingWeb\Arsse\Test\AbstractTest { - public function testGetChangeCountAndLastInsertId() { + public function testGetChangeCountAndLastInsertId():void { $r = new ResultEmpty; $this->assertEquals(0, $r->changes()); $this->assertEquals(0, $r->lastId()); } - public function testIterateOverResults() { + public function testIterateOverResults():void { $rows = []; foreach (new ResultEmpty as $index => $row) { $rows[$index] = $row['col']; @@ -20,17 +20,17 @@ class TestResultEmpty extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals([], $rows); } - public function testGetSingleValues() { + public function testGetSingleValues():void { $test = new ResultEmpty; $this->assertSame(null, $test->getValue()); } - public function testGetRows() { + public function testGetRows():void { $test = new ResultEmpty; $this->assertSame(null, $test->getRow()); } - public function testGetAllRows() { + public function testGetAllRows():void { $test = new ResultEmpty; $rows = []; $this->assertEquals($rows, $test->getAll()); diff --git a/tests/cases/Db/TestTransaction.php b/tests/cases/Db/TestTransaction.php index b189addc..5c045c82 100644 --- a/tests/cases/Db/TestTransaction.php +++ b/tests/cases/Db/TestTransaction.php @@ -23,7 +23,7 @@ class TestTransaction extends \JKingWeb\Arsse\Test\AbstractTest { $this->drv = $drv; } - public function testManipulateTransactions() { + public function testManipulateTransactions():void { $tr1 = new Transaction($this->drv); $tr2 = new Transaction($this->drv); \Phake::verify($this->drv, \Phake::times(2))->savepointCreate; @@ -35,7 +35,7 @@ class TestTransaction extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($this->drv)->savepointUndo(2); } - public function testCloseTransactions() { + public function testCloseTransactions():void { $tr1 = new Transaction($this->drv); $tr2 = new Transaction($this->drv); $this->assertTrue($tr1->isPending()); @@ -50,7 +50,7 @@ class TestTransaction extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($this->drv)->savepointUndo(2); } - public function testIgnoreRollbackErrors() { + public function testIgnoreRollbackErrors():void { \Phake::when($this->drv)->savepointUndo->thenThrow(new Exception("savepointStale")); $tr1 = new Transaction($this->drv); $tr2 = new Transaction($this->drv); diff --git a/tests/cases/Exception/TestException.php b/tests/cases/Exception/TestException.php index 739f0522..4c888a67 100644 --- a/tests/cases/Exception/TestException.php +++ b/tests/cases/Exception/TestException.php @@ -28,7 +28,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(true); } - public function testBaseClass() { + public function testBaseClass():void { $this->assertException("unknown"); throw new Exception("unknown"); } @@ -36,7 +36,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testBaseClass */ - public function testBaseClassWithoutMessage() { + public function testBaseClassWithoutMessage():void { $this->assertException("unknown"); throw new Exception(); } @@ -44,7 +44,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testBaseClass */ - public function testDerivedClass() { + public function testDerivedClass():void { $this->assertException("fileMissing", "Lang"); throw new LangException("fileMissing"); } @@ -52,7 +52,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testDerivedClass */ - public function testDerivedClassWithMessageParameters() { + public function testDerivedClassWithMessageParameters():void { $this->assertException("fileMissing", "Lang"); throw new LangException("fileMissing", "en"); } @@ -60,7 +60,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testBaseClass */ - public function testBaseClassWithUnknownCode() { + public function testBaseClassWithUnknownCode():void { $this->assertException("uncoded"); throw new Exception("testThisExceptionMessageDoesNotExist"); } @@ -68,13 +68,13 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testBaseClassWithUnknownCode */ - public function testDerivedClassWithMissingMessage() { + public function testDerivedClassWithMissingMessage():void { $this->assertException("uncoded"); throw new LangException("testThisExceptionMessageDoesNotExist"); } /** @covers \JKingWeb\Arsse\ExceptionFatal */ - public function testFatalException() { + public function testFatalException():void { $this->expectException('JKingWeb\Arsse\ExceptionFatal'); throw new \JKingWeb\Arsse\ExceptionFatal(""); } diff --git a/tests/cases/Feed/TestFeed.php b/tests/cases/Feed/TestFeed.php index 04d2194b..e6962c54 100644 --- a/tests/cases/Feed/TestFeed.php +++ b/tests/cases/Feed/TestFeed.php @@ -98,7 +98,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { Arsse::$db = \Phake::mock(Database::class); } - public function testParseAFeed() { + public function testParseAFeed():void { // test that various properties are set on the feed and on items $f = new Feed(null, $this->base."Parsing/Valid"); $this->assertTrue(isset($f->lastModified)); @@ -141,37 +141,37 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($categories, $f->data->items[5]->categories); } - public function testDiscoverAFeedSuccessfully() { + public function testDiscoverAFeedSuccessfully():void { $this->assertSame($this->base."Discovery/Feed", Feed::discover($this->base."Discovery/Valid")); $this->assertSame($this->base."Discovery/Feed", Feed::discover($this->base."Discovery/Feed")); } - public function testDiscoverAFeedUnsuccessfully() { + public function testDiscoverAFeedUnsuccessfully():void { $this->assertException("subscriptionNotFound", "Feed"); Feed::discover($this->base."Discovery/Invalid"); } - public function testParseEntityExpansionAttack() { + public function testParseEntityExpansionAttack():void { $this->assertException("xmlEntity", "Feed"); new Feed(null, $this->base."Parsing/XEEAttack"); } - public function testParseExternalEntityAttack() { + public function testParseExternalEntityAttack():void { $this->assertException("xmlEntity", "Feed"); new Feed(null, $this->base."Parsing/XXEAttack"); } - public function testParseAnUnsupportedFeed() { + public function testParseAnUnsupportedFeed():void { $this->assertException("unsupportedFeedFormat", "Feed"); new Feed(null, $this->base."Parsing/Unsupported"); } - public function testParseAMalformedFeed() { + public function testParseAMalformedFeed():void { $this->assertException("malformedXml", "Feed"); new Feed(null, $this->base."Parsing/Malformed"); } - public function testDeduplicateFeedItems() { + public function testDeduplicateFeedItems():void { // duplicates with dates lead to the newest match being kept $t = strtotime("2002-05-19T15:21:36Z"); $f = new Feed(null, $this->base."Deduplication/Permalink-Dates"); @@ -198,7 +198,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame("http://example.com/1", $f->newItems[0]->url); } - public function testHandleCacheHeadersOn304() { + public function testHandleCacheHeadersOn304():void { // upon 304, the client should re-use the caching header values it supplied the server $t = time(); $e = "78567a"; @@ -216,7 +216,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($e, $f->resource->getETag()); } - public function testHandleCacheHeadersOn200() { + public function testHandleCacheHeadersOn200():void { // these tests should trust the server-returned time, even in cases of obviously incorrect results $t = time() - 2000; $f = new Feed(null, $this->base."Caching/200Past"); @@ -244,7 +244,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertTime($t, $f->lastModified); } - public function testComputeNextFetchOnError() { + public function testComputeNextFetchOnError():void { for ($a = 0; $a < 100; $a++) { if ($a < 3) { $this->assertTime("now + 5 minutes", Feed::nextFetchOnError($a)); @@ -257,7 +257,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provide304Timestamps */ - public function testComputeNextFetchFrom304(string $t, string $exp) { + public function testComputeNextFetchFrom304(string $t, string $exp):void { $t = $t ? strtotime($t) : ""; $f = new Feed(null, $this->base."NextFetch/NotModified?t=$t", Date::transform($t, "http")); $exp = strtotime($exp); @@ -279,13 +279,13 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testComputeNextFetchFrom304WithoutDate() { + public function testComputeNextFetchFrom304WithoutDate():void { $f = new Feed(null, $this->base."NextFetch/NotModifiedEtag"); $exp = strtotime("now + 3 hours"); $this->assertTime($exp, $f->nextFetch); } - public function testComputeNextFetchFrom200() { + public function testComputeNextFetchFrom200():void { // if less than half an hour, check in 15 minutes $f = new Feed(null, $this->base."NextFetch/30m"); $exp = strtotime("now + 15 minutes"); @@ -312,7 +312,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertTime($exp, $f->nextFetch); } - public function testMatchLatestArticles() { + public function testMatchLatestArticles():void { \Phake::when(Arsse::$db)->feedMatchLatest(1, $this->anything())->thenReturn(new Result($this->latest)); $f = new Feed(1, $this->base."Matching/1"); $this->assertCount(0, $f->newItems); @@ -328,7 +328,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertCount(2, $f->changedItems); } - public function testMatchHistoricalArticles() { + public function testMatchHistoricalArticles():void { \Phake::when(Arsse::$db)->feedMatchLatest(1, $this->anything())->thenReturn(new Result($this->latest)); \Phake::when(Arsse::$db)->feedMatchIds(1, $this->anything(), $this->anything(), $this->anything(), $this->anything())->thenReturn(new Result($this->others)); $f = new Feed(1, $this->base."Matching/5"); @@ -336,7 +336,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertCount(0, $f->changedItems); } - public function testScrapeFullContent() { + public function testScrapeFullContent():void { // first make sure that the absence of scraping works as expected $f = new Feed(null, $this->base."Scraping/Feed"); $exp = "

Partial content

"; diff --git a/tests/cases/Feed/TestFetching.php b/tests/cases/Feed/TestFetching.php index f2f7ce6a..05b79b40 100644 --- a/tests/cases/Feed/TestFetching.php +++ b/tests/cases/Feed/TestFetching.php @@ -27,48 +27,48 @@ class TestFetching extends \JKingWeb\Arsse\Test\AbstractTest { self::setConf(); } - public function testHandle400() { + public function testHandle400():void { $this->assertException("unsupportedFeedFormat", "Feed"); new Feed(null, $this->base."Fetching/Error?code=400"); } - public function testHandle401() { + public function testHandle401():void { $this->assertException("unauthorized", "Feed"); new Feed(null, $this->base."Fetching/Error?code=401"); } - public function testHandle403() { + public function testHandle403():void { $this->assertException("forbidden", "Feed"); new Feed(null, $this->base."Fetching/Error?code=403"); } - public function testHandle404() { + public function testHandle404():void { $this->assertException("invalidUrl", "Feed"); new Feed(null, $this->base."Fetching/Error?code=404"); } - public function testHandle500() { + public function testHandle500():void { $this->assertException("unsupportedFeedFormat", "Feed"); new Feed(null, $this->base."Fetching/Error?code=500"); } - public function testHandleARedirectLoop() { + public function testHandleARedirectLoop():void { $this->assertException("maxRedirect", "Feed"); new Feed(null, $this->base."Fetching/EndlessLoop?i=0"); } - public function testHandleAnOverlyLargeFeed() { + public function testHandleAnOverlyLargeFeed():void { Arsse::$conf->fetchSizeLimit = 512; $this->assertException("maxSize", "Feed"); new Feed(null, $this->base."Fetching/TooLarge"); } - public function testHandleACertificateError() { + public function testHandleACertificateError():void { $this->assertException("invalidCertificate", "Feed"); new Feed(null, "https://localhost:8000/"); } - public function testHandleATimeout() { + public function testHandleATimeout():void { Arsse::$conf->fetchTimeout = 1; $this->assertException("timeout", "Feed"); new Feed(null, $this->base."Fetching/Timeout"); diff --git a/tests/cases/ImportExport/TestFile.php b/tests/cases/ImportExport/TestFile.php index cd520d21..36b45b57 100644 --- a/tests/cases/ImportExport/TestFile.php +++ b/tests/cases/ImportExport/TestFile.php @@ -45,7 +45,7 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideFileExports */ - public function testExportToAFile(string $file, string $user, bool $flat, $exp) { + public function testExportToAFile(string $file, string $user, bool $flat, $exp):void { $path = $this->path.$file; try { if ($exp instanceof \JKingWeb\Arsse\AbstractException) { @@ -84,7 +84,7 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideFileImports */ - public function testImportFromAFile(string $file, string $user, bool $flat, bool $replace, $exp) { + public function testImportFromAFile(string $file, string $user, bool $flat, bool $replace, $exp):void { $path = $this->path.$file; try { if ($exp instanceof \JKingWeb\Arsse\AbstractException) { diff --git a/tests/cases/ImportExport/TestImportExport.php b/tests/cases/ImportExport/TestImportExport.php index 04e92121..269b3515 100644 --- a/tests/cases/ImportExport/TestImportExport.php +++ b/tests/cases/ImportExport/TestImportExport.php @@ -146,13 +146,13 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testImportForAMissingUser() { + public function testImportForAMissingUser():void { \Phake::when(Arsse::$user)->exists->thenReturn(false); $this->assertException("doesNotExist", "User"); $this->proc->import("john.doe@example.com", "", false, false); } - public function testImportWithInvalidFolder() { + public function testImportWithInvalidFolder():void { $in = [[ ], [1 => ['id' => 1, 'name' => "", 'parent' => 0], @@ -162,7 +162,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->proc->import("john.doe@example.com", "", false, false); } - public function testImportWithDuplicateFolder() { + public function testImportWithDuplicateFolder():void { $in = [[ ], [1 => ['id' => 1, 'name' => "New", 'parent' => 0], @@ -173,7 +173,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->proc->import("john.doe@example.com", "", false, false); } - public function testMakeNoEffectiveChanges() { + public function testMakeNoEffectiveChanges():void { $in = [[ ['url' => "http://localhost:8000/Import/nasa-jpl", 'title' => "NASA JPL", 'folder' => 3, 'tags' => ["tech"]], ['url' => "http://localhost:8000/Import/ars", 'title' => "Ars Technica", 'folder' => 2, 'tags' => ["frequent", "tech"]], @@ -197,7 +197,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->compareExpectations($this->drv, $exp); } - public function testModifyASubscription() { + public function testModifyASubscription():void { $in = [[ ['url' => "http://localhost:8000/Import/nasa-jpl", 'title' => "NASA JPL", 'folder' => 3, 'tags' => ["tech"]], ['url' => "http://localhost:8000/Import/ars", 'title' => "Ars Technica", 'folder' => 2, 'tags' => ["frequent", "tech"]], @@ -222,7 +222,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->compareExpectations($this->drv, $exp); } - public function testImportAFeed() { + public function testImportAFeed():void { $in = [[ ['url' => "http://localhost:8000/Import/some-feed", 'title' => "Some Feed", 'folder' => 0, 'tags' => ["frequent", "cryptic"]], //one existing tag and one new one ], []]; @@ -237,7 +237,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->compareExpectations($this->drv, $exp); } - public function testImportAFeedWithAnInvalidTag() { + public function testImportAFeedWithAnInvalidTag():void { $in = [[ ['url' => "http://localhost:8000/Import/some-feed", 'title' => "Some Feed", 'folder' => 0, 'tags' => [""]], ], []]; @@ -246,7 +246,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->proc->import("john.doe@example.com", "", false, false); } - public function testReplaceData() { + public function testReplaceData():void { $in = [[ ['url' => "http://localhost:8000/Import/some-feed", 'title' => "Some Feed", 'folder' => 1, 'tags' => ["frequent", "cryptic"]], ], [1 => diff --git a/tests/cases/ImportExport/TestOPML.php b/tests/cases/ImportExport/TestOPML.php index 61f6b364..294da40f 100644 --- a/tests/cases/ImportExport/TestOPML.php +++ b/tests/cases/ImportExport/TestOPML.php @@ -86,28 +86,28 @@ OPML_EXPORT_SERIALIZATION; \Phake::when(Arsse::$user)->exists->thenReturn(true); } - public function testExportToOpml() { + public function testExportToOpml():void { \Phake::when(Arsse::$db)->folderList("john.doe@example.com")->thenReturn(new Result($this->folders)); \Phake::when(Arsse::$db)->subscriptionList("john.doe@example.com")->thenReturn(new Result($this->subscriptions)); \Phake::when(Arsse::$db)->tagSummarize("john.doe@example.com")->thenReturn(new Result($this->tags)); $this->assertXmlStringEqualsXmlString($this->serialization, (new OPML)->export("john.doe@example.com")); } - public function testExportToFlatOpml() { + public function testExportToFlatOpml():void { \Phake::when(Arsse::$db)->folderList("john.doe@example.com")->thenReturn(new Result($this->folders)); \Phake::when(Arsse::$db)->subscriptionList("john.doe@example.com")->thenReturn(new Result($this->subscriptions)); \Phake::when(Arsse::$db)->tagSummarize("john.doe@example.com")->thenReturn(new Result($this->tags)); $this->assertXmlStringEqualsXmlString($this->serializationFlat, (new OPML)->export("john.doe@example.com", true)); } - public function testExportToOpmlAMissingUser() { + public function testExportToOpmlAMissingUser():void { \Phake::when(Arsse::$user)->exists->thenReturn(false); $this->assertException("doesNotExist", "User"); (new OPML)->export("john.doe@example.com"); } /** @dataProvider provideParserData */ - public function testParseOpmlForImport(string $file, bool $flat, $exp) { + public function testParseOpmlForImport(string $file, bool $flat, $exp):void { $data = file_get_contents(\JKingWeb\Arsse\DOCROOT."Import/OPML/$file"); // set up a partial mock to make the ImportExport::parse() method visible $parser = \Phake::makeVisible(\Phake::partialMock(OPML::class)); diff --git a/tests/cases/Lang/TestBasic.php b/tests/cases/Lang/TestBasic.php index de4b54c4..16bec4b6 100644 --- a/tests/cases/Lang/TestBasic.php +++ b/tests/cases/Lang/TestBasic.php @@ -16,14 +16,14 @@ class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest { public $path; public $l; - public function testListLanguages() { + public function testListLanguages():void { $this->assertCount(sizeof($this->files), $this->l->list("en")); } /** * @depends testListLanguages */ - public function testSetLanguage() { + public function testSetLanguage():void { $this->assertEquals("en", $this->l->set("en")); $this->assertEquals("en_ca", $this->l->set("en_ca")); $this->assertEquals("de", $this->l->set("de_ch")); @@ -36,7 +36,7 @@ class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testSetLanguage */ - public function testLoadInternalStrings() { + public function testLoadInternalStrings():void { $this->assertEquals("", $this->l->set("", true)); $this->assertCount(sizeof(TestClass::REQUIRED), $this->l->dump()); } @@ -44,7 +44,7 @@ class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testLoadInternalStrings */ - public function testLoadDefaultLanguage() { + public function testLoadDefaultLanguage():void { $this->assertEquals(TestClass::DEFAULT, $this->l->set(TestClass::DEFAULT, true)); $str = $this->l->dump(); $this->assertArrayHasKey('Exception.JKingWeb/Arsse/Exception.uncoded', $str); @@ -54,7 +54,7 @@ class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testLoadDefaultLanguage */ - public function testLoadSupplementaryLanguage() { + public function testLoadSupplementaryLanguage():void { $this->l->set(TestClass::DEFAULT, true); $this->assertEquals("ja", $this->l->set("ja", true)); $str = $this->l->dump(); diff --git a/tests/cases/Lang/TestComplex.php b/tests/cases/Lang/TestComplex.php index 3b976a7d..7de2bf40 100644 --- a/tests/cases/Lang/TestComplex.php +++ b/tests/cases/Lang/TestComplex.php @@ -16,11 +16,11 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { public $path; public $l; - public function setUpSeries() { + public function setUpSeries():void { $this->l->set(TestClass::DEFAULT, true); } - public function testLazyLoad() { + public function testLazyLoad():void { $this->l->set("ja"); $this->assertArrayNotHasKey('Test.absentText', $this->l->dump()); } @@ -28,14 +28,14 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testLazyLoad */ - public function testGetWantedAndLoadedLocale() { + public function testGetWantedAndLoadedLocale():void { $this->l->set("en", true); $this->l->set("ja"); $this->assertEquals("ja", $this->l->get()); $this->assertEquals("en", $this->l->get(true)); } - public function testLoadCascadeOfFiles() { + public function testLoadCascadeOfFiles():void { $this->l->set("ja", true); $this->assertEquals("de", $this->l->set("de", true)); $str = $this->l->dump(); @@ -46,11 +46,11 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testLoadCascadeOfFiles */ - public function testLoadSubtag() { + public function testLoadSubtag():void { $this->assertEquals("en_ca", $this->l->set("en_ca", true)); } - public function testFetchAMessage() { + public function testFetchAMessage():void { $this->l->set("de"); $this->assertEquals('und der Stein der Weisen', $this->l->msg('Test.presentText')); } @@ -58,7 +58,7 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testFetchAMessage */ - public function testFetchAMessageWithMissingParameters() { + public function testFetchAMessageWithMissingParameters():void { $this->l->set("en_ca", true); $this->assertEquals('{0} and {1}', $this->l->msg('Test.presentText')); } @@ -66,7 +66,7 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testFetchAMessage */ - public function testFetchAMessageWithSingleNumericParameter() { + public function testFetchAMessageWithSingleNumericParameter():void { $this->l->set("en_ca", true); $this->assertEquals('Default language file "en" missing', $this->l->msg('Exception.JKingWeb/Arsse/Lang/Exception.defaultFileMissing', TestClass::DEFAULT)); } @@ -74,7 +74,7 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testFetchAMessage */ - public function testFetchAMessageWithMultipleNumericParameters() { + public function testFetchAMessageWithMultipleNumericParameters():void { $this->l->set("en_ca", true); $this->assertEquals('Happy Rotter and the Philosopher\'s Stone', $this->l->msg('Test.presentText', ['Happy Rotter', 'the Philosopher\'s Stone'])); } @@ -82,14 +82,14 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testFetchAMessage */ - public function testFetchAMessageWithNamedParameters() { + public function testFetchAMessageWithNamedParameters():void { $this->assertEquals('Message string "Test.absentText" missing from all loaded language files (en)', $this->l->msg('Exception.JKingWeb/Arsse/Lang/Exception.stringMissing', ['msgID' => 'Test.absentText', 'fileList' => 'en'])); } /** * @depends testFetchAMessage */ - public function testReloadDefaultStrings() { + public function testReloadDefaultStrings():void { $this->l->set("de", true); $this->l->set("en", true); $this->assertEquals('and the Philosopher\'s Stone', $this->l->msg('Test.presentText')); @@ -98,7 +98,7 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testFetchAMessage */ - public function testReloadGeneralTagAfterSubtag() { + public function testReloadGeneralTagAfterSubtag():void { $this->l->set("en", true); $this->l->set("en_us", true); $this->assertEquals('and the Sorcerer\'s Stone', $this->l->msg('Test.presentText')); diff --git a/tests/cases/Lang/TestErrors.php b/tests/cases/Lang/TestErrors.php index 86e29393..e8774846 100644 --- a/tests/cases/Lang/TestErrors.php +++ b/tests/cases/Lang/TestErrors.php @@ -16,65 +16,65 @@ class TestErrors extends \JKingWeb\Arsse\Test\AbstractTest { public $path; public $l; - public function setUpSeries() { + public function setUpSeries():void { $this->l->set("", true); } - public function testLoadEmptyFile() { + public function testLoadEmptyFile():void { $this->assertException("fileCorrupt", "Lang"); $this->l->set("fr_ca", true); } - public function testLoadFileWhichDoesNotReturnAnArray() { + public function testLoadFileWhichDoesNotReturnAnArray():void { $this->assertException("fileCorrupt", "Lang"); $this->l->set("it", true); } - public function testLoadFileWhichIsNotPhp() { + public function testLoadFileWhichIsNotPhp():void { $this->assertException("fileCorrupt", "Lang"); $this->l->set("ko", true); } - public function testLoadFileWhichIsCorrupt() { + public function testLoadFileWhichIsCorrupt():void { $this->assertException("fileCorrupt", "Lang"); $this->l->set("zh", true); } - public function testLoadFileWithooutReadPermission() { + public function testLoadFileWithooutReadPermission():void { $this->assertException("fileUnreadable", "Lang"); $this->l->set("ru", true); } - public function testLoadSubtagOfMissingLanguage() { + public function testLoadSubtagOfMissingLanguage():void { $this->assertException("fileMissing", "Lang"); $this->l->set("pt_br", true); } - public function testFetchInvalidMessage() { + public function testFetchInvalidMessage():void { $this->assertException("stringInvalid", "Lang"); $this->l->set("vi", true); $txt = $this->l->msg('Test.presentText'); } - public function testFetchMissingMessage() { + public function testFetchMissingMessage():void { $this->assertException("stringMissing", "Lang"); $txt = $this->l->msg('Test.absentText'); } - public function testLoadMissingDefaultLanguage() { + public function testLoadMissingDefaultLanguage():void { unlink($this->path.TestClass::DEFAULT.".php"); $this->assertException("defaultFileMissing", "Lang"); $this->l->set("fr", true); } - public function testLoadMissingLanguageWhenFetching() { + public function testLoadMissingLanguageWhenFetching():void { $this->l->set("en_ca"); unlink($this->path.TestClass::DEFAULT.".php"); $this->assertException("fileMissing", "Lang"); $this->l->msg('Test.presentText'); } - public function testLoadMissingDefaultLanguageWhenFetching() { + public function testLoadMissingDefaultLanguageWhenFetching():void { unlink($this->path.TestClass::DEFAULT.".php"); $this->l = new TestClass($this->path); $this->assertException("stringMissing", "Lang"); diff --git a/tests/cases/Misc/TestContext.php b/tests/cases/Misc/TestContext.php index f32f11e4..8ebb5151 100644 --- a/tests/cases/Misc/TestContext.php +++ b/tests/cases/Misc/TestContext.php @@ -11,7 +11,7 @@ use JKingWeb\Arsse\Misc\ValueInfo; /** @covers \JKingWeb\Arsse\Context\Context */ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { - public function testVerifyInitialState() { + public function testVerifyInitialState():void { $c = new Context; foreach ((new \ReflectionObject($c))->getMethods(\ReflectionMethod::IS_PUBLIC) as $m) { if ($m->isStatic() || strpos($m->name, "__") === 0) { @@ -23,7 +23,7 @@ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testSetContextOptions() { + public function testSetContextOptions():void { $v = [ 'reverse' => true, 'limit' => 10, @@ -85,7 +85,7 @@ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testCleanIdArrayValues() { + public function testCleanIdArrayValues():void { $methods = ["articles", "editions", "tags", "labels", "subscriptions"]; $in = [1, "2", 3.5, 4.0, 4, "ook", 0, -20, true, false, null, new \DateTime(), -1.0]; $out = [1, 2, 4]; @@ -95,7 +95,7 @@ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testCleanFolderIdArrayValues() { + public function testCleanFolderIdArrayValues():void { $methods = ["folders", "foldersShallow"]; $in = [1, "2", 3.5, 4.0, 4, "ook", 0, -20, true, false, null, new \DateTime(), -1.0]; $out = [1, 2, 4, 0]; @@ -105,7 +105,7 @@ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testCleanStringArrayValues() { + public function testCleanStringArrayValues():void { $methods = ["searchTerms", "annotationTerms", "titleTerms", "authorTerms", "tagNames", "labelNames"]; $now = new \DateTime; $in = [1, 3.0, "ook", 0, true, false, null, $now, ""]; @@ -116,7 +116,7 @@ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testCloneAContext() { + public function testCloneAContext():void { $c1 = new Context; $c2 = clone $c1; $this->assertEquals($c1, $c2); diff --git a/tests/cases/Misc/TestDate.php b/tests/cases/Misc/TestDate.php index f2eb2be3..229c3108 100644 --- a/tests/cases/Misc/TestDate.php +++ b/tests/cases/Misc/TestDate.php @@ -14,7 +14,7 @@ class TestDate extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testNormalizeADate() { + public function testNormalizeADate():void { $exp = new \DateTimeImmutable("2018-01-01T00:00:00Z"); $this->assertEquals($exp, Date::normalize(1514764800)); $this->assertEquals($exp, Date::normalize("2018-01-01T00:00:00")); @@ -26,7 +26,7 @@ class TestDate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertNull(Date::normalize("2018-01-01T00:00:00Z", "http")); } - public function testFormatADate() { + public function testFormatADate():void { $test = new \DateTimeImmutable("2018-01-01T00:00:00Z"); $this->assertNull(Date::transform(null, "http")); $this->assertNull(Date::transform("ook", "http")); @@ -40,7 +40,7 @@ class TestDate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(1514764800.265579, Date::transform("2018-01-01T00:00:00.265579Z", "float", "iso8601m")); } - public function testMoveDateForward() { + public function testMoveDateForward():void { $test = new \DateTimeImmutable("2018-01-01T00:00:00Z"); $this->assertNull(Date::add("P1D", null)); $this->assertNull(Date::add("P1D", "ook")); @@ -49,7 +49,7 @@ class TestDate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertNull(Date::add("ook", $test)); } - public function testMoveDateBack() { + public function testMoveDateBack():void { $test = new \DateTimeImmutable("2018-01-01T00:00:00Z"); $this->assertNull(Date::sub("P1D", null)); $this->assertNull(Date::sub("P1D", "ook")); diff --git a/tests/cases/Misc/TestHTTP.php b/tests/cases/Misc/TestHTTP.php index 8430ddaa..d951af7c 100644 --- a/tests/cases/Misc/TestHTTP.php +++ b/tests/cases/Misc/TestHTTP.php @@ -12,14 +12,14 @@ use Psr\Http\Message\ResponseInterface; /** @covers \JKingWeb\Arsse\Misc\HTTP */ class TestHTTP extends \JKingWeb\Arsse\Test\AbstractTest { /** @dataProvider provideMediaTypes */ - public function testMatchMediaType(string $header, array $types, bool $exp) { + public function testMatchMediaType(string $header, array $types, bool $exp):void { $msg = (new \Laminas\Diactoros\Request)->withHeader("Content-Type", $header); $this->assertSame($exp, HTTP::matchType($msg, ...$types)); $msg = (new \Laminas\Diactoros\Response)->withHeader("Content-Type", $header); $this->assertSame($exp, HTTP::matchType($msg, ...$types)); } - public function provideMediaTypes() { + public function provideMediaTypes(): array { return [ ["application/json", ["application/json"], true], ["APPLICATION/JSON", ["application/json"], true], diff --git a/tests/cases/Misc/TestQuery.php b/tests/cases/Misc/TestQuery.php index a1588f1b..d784d91e 100644 --- a/tests/cases/Misc/TestQuery.php +++ b/tests/cases/Misc/TestQuery.php @@ -11,14 +11,14 @@ use JKingWeb\Arsse\Misc\ValueInfo; /** @covers \JKingWeb\Arsse\Misc\Query */ class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest { - public function testBasicQuery() { + public function testBasicQuery():void { $q = new Query("select * from table where a = ?", "int", 3); $this->assertSame("select * from table where a = ?", $q->getQuery()); $this->assertSame(["int"], $q->getTypes()); $this->assertSame([3], $q->getValues()); } - public function testWhereQuery() { + public function testWhereQuery():void { // simple where clause $q = (new Query("select * from table"))->setWhere("a = ?", "int", 3); $this->assertSame("select * from table WHERE a = ?", $q->getQuery()); @@ -46,21 +46,21 @@ class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame([2, 4, 1, 3], $q->getValues()); } - public function testGroupedQuery() { + public function testGroupedQuery():void { $q = (new Query("select col1, col2, count(*) as count from table"))->setGroup("col1", "col2"); $this->assertSame("select col1, col2, count(*) as count from table GROUP BY col1, col2", $q->getQuery()); $this->assertSame([], $q->getTypes()); $this->assertSame([], $q->getValues()); } - public function testOrderedQuery() { + public function testOrderedQuery():void { $q = (new Query("select col1, col2, col3 from table"))->setOrder("col1 desc", "col2")->setOrder("col3 asc"); $this->assertSame("select col1, col2, col3 from table ORDER BY col1 desc, col2, col3 asc", $q->getQuery()); $this->assertSame([], $q->getTypes()); $this->assertSame([], $q->getValues()); } - public function testLimitedQuery() { + public function testLimitedQuery():void { // no offset $q = (new Query("select * from table"))->setLimit(5); $this->assertSame("select * from table LIMIT 5", $q->getQuery()); @@ -78,7 +78,7 @@ class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame([], $q->getValues()); } - public function testQueryWithCommonTableExpression() { + public function testQueryWithCommonTableExpression():void { $q = (new Query("select * from table where a in (select * from cte where a = ?)", "int", 1))->setCTE("cte", "select * from other_table where a = ? and b = ?", ["str", "str"], [2, 3]); $this->assertSame("WITH RECURSIVE cte as (select * from other_table where a = ? and b = ?) select * from table where a in (select * from cte where a = ?)", $q->getQuery()); $this->assertSame(["str", "str", "int"], $q->getTypes()); @@ -90,7 +90,7 @@ class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame([2, 3, 4, 5, 1], $q->getValues()); } - public function testQueryWithPushedCommonTableExpression() { + public function testQueryWithPushedCommonTableExpression():void { $q = (new Query("select * from table1"))->setWhere("a between ? and ?", ["datetime", "datetime"], [1, 2]) ->setCTE("cte1", "select * from table2 where a = ? and b = ?", ["str", "str"], [3, 4]) ->pushCTE("cte2") @@ -100,7 +100,7 @@ class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame([3, 4, 1, 2, 5], $q->getValues()); } - public function testComplexQuery() { + public function testComplexQuery():void { $q = (new query("select *, ? as const from table", "datetime", 1)) ->setWhereNot("b = ?", "bool", 2) ->setGroup("col1", "col2") diff --git a/tests/cases/Misc/TestURL.php b/tests/cases/Misc/TestURL.php index 06b509db..7cf1554f 100644 --- a/tests/cases/Misc/TestURL.php +++ b/tests/cases/Misc/TestURL.php @@ -15,7 +15,7 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideNormalizations */ - public function testNormalizeAUrl(string $url, string $exp, string $user = null, string $pass = null) { + public function testNormalizeAUrl(string $url, string $exp, string $user = null, string $pass = null):void { $this->assertSame($exp, URL::normalize($url, $user, $pass)); } @@ -77,7 +77,7 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideQueries */ - public function testAppendQueryParameters(string $url, string $query, string $exp) { + public function testAppendQueryParameters(string $url, string $query, string $exp):void { $this->assertSame($exp, URL::queryAppend($url, $query)); } @@ -93,11 +93,11 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideAbsolutes */ - public function testDetermineAbsoluteness(bool $exp, string $url) { + public function testDetermineAbsoluteness(bool $exp, string $url):void { $this->assertSame($exp, URL::absolute($url)); } - public function provideAbsolutes() { + public function provideAbsolutes(): array { return [ [true, "http://example.com/"], [true, "HTTP://example.com/"], diff --git a/tests/cases/Misc/TestValueInfo.php b/tests/cases/Misc/TestValueInfo.php index 729b0f25..b3b48ca4 100644 --- a/tests/cases/Misc/TestValueInfo.php +++ b/tests/cases/Misc/TestValueInfo.php @@ -16,7 +16,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testGetIntegerInfo() { + public function testGetIntegerInfo():void { $tests = [ [null, I::NULL], ["", I::NULL], @@ -91,7 +91,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, I::int($value), "Test returned ".decbin(I::int($value))." for value: ".var_export($value, true)); } } - public function testGetStringInfo() { + public function testGetStringInfo():void { $tests = [ [null, I::NULL], ["", I::VALID | I::EMPTY], @@ -162,7 +162,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testValidateDatabaseIdentifier() { + public function testValidateDatabaseIdentifier():void { $tests = [ [null, false, true], ["", false, true], @@ -234,7 +234,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testValidateBoolean() { + public function testValidateBoolean():void { $tests = [ [null, null], ["", false], @@ -310,7 +310,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideSimpleNormalizationValues */ - public function testNormalizeSimpleValues($input, string $typeName, $exp, bool $pass, bool $strict, bool $drop) { + public function testNormalizeSimpleValues($input, string $typeName, $exp, bool $pass, bool $strict, bool $drop):void { $assert = function($exp, $act, string $msg) { if (is_null($exp)) { $this->assertNull($act, $msg); @@ -366,7 +366,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideDateNormalizationValues */ - public function testNormalizeDateValues($input, $format, $exp, bool $strict, bool $drop) { + public function testNormalizeDateValues($input, $format, $exp, bool $strict, bool $drop):void { if ($strict && $drop) { $modeName = "strict drop"; $modeConst = I::M_STRICT | I::M_DROP; @@ -397,7 +397,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testNormalizeComplexValues() { + public function testNormalizeComplexValues():void { // Array-mode tests $tests = [ [I::T_INT | I::M_DROP, [1, 2, 2.2, 3], [1,2,null,3] ], @@ -640,7 +640,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { return $out; } - public function testFlattenArray() { + public function testFlattenArray():void { $arr = [1, [2, 3, [4, 5]], 6, [[7, 8], 9, 10]]; $exp = range(1, 10); $this->assertSame($exp, I::flatten($arr)); diff --git a/tests/cases/REST/Fever/TestAPI.php b/tests/cases/REST/Fever/TestAPI.php index f7cd3c53..fd892b06 100644 --- a/tests/cases/REST/Fever/TestAPI.php +++ b/tests/cases/REST/Fever/TestAPI.php @@ -173,7 +173,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideTokenAuthenticationRequests */ - public function testAuthenticateAUserToken(bool $httpRequired, bool $tokenEnforced, string $httpUser = null, array $dataPost, array $dataGet, ResponseInterface $exp) { + public function testAuthenticateAUserToken(bool $httpRequired, bool $tokenEnforced, string $httpUser = null, array $dataPost, array $dataGet, ResponseInterface $exp):void { self::setConf([ 'userHTTPAuthRequired' => $httpRequired, 'userSessionEnforced' => $tokenEnforced, @@ -244,7 +244,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testListGroups() { + public function testListGroups():void { \Phake::when(Arsse::$db)->tagList(Arsse::$user->id)->thenReturn(new Result([ ['id' => 1, 'name' => "Fascinating", 'subscriptions' => 2], ['id' => 2, 'name' => "Interesting", 'subscriptions' => 2], @@ -271,7 +271,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function testListFeeds() { + public function testListFeeds():void { \Phake::when(Arsse::$db)->subscriptionList(Arsse::$user->id)->thenReturn(new Result([ ['id' => 1, 'feed' => 5, 'title' => "Ankh-Morpork News", 'url' => "http://example.com/feed", 'source' => "http://example.com/", 'edited' => "2019-01-01 21:12:00", 'favicon' => "http://example.com/favicon.ico"], ['id' => 2, 'feed' => 9, 'title' => "Ook, Ook Eek Ook!", 'url' => "http://example.net/feed", 'source' => "http://example.net/", 'edited' => "1988-06-24 12:21:00", 'favicon' => ""], @@ -299,7 +299,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideItemListContexts */ - public function testListItems(string $url, Context $c, bool $desc) { + public function testListItems(string $url, Context $c, bool $desc):void { $fields = ["id", "subscription", "title", "author", "content", "url", "starred", "unread", "published_date"]; $order = [$desc ? "id desc" : "id"]; \Phake::when(Arsse::$db)->articleList->thenReturn(new Result($this->articles['db'])); @@ -329,7 +329,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testListItemIds() { + public function testListItemIds():void { $saved = [['id' => 1],['id' => 2],['id' => 3]]; $unread = [['id' => 4],['id' => 5],['id' => 6]]; \Phake::when(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->starred(true))->thenReturn(new Result($saved)); @@ -344,7 +344,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->h->dispatch($this->req("api&unread_item_ids"))); } - public function testListHotLinks() { + public function testListHotLinks():void { // hot links are not actually implemented, so an empty array should be all we get $exp = new JsonResponse([ 'links' => [] @@ -353,7 +353,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideMarkingContexts */ - public function testSetMarks(string $post, Context $c, array $data, array $out) { + public function testSetMarks(string $post, Context $c, array $data, array $out):void { $saved = [['id' => 1],['id' => 2],['id' => 3]]; $unread = [['id' => 4],['id' => 5],['id' => 6]]; \Phake::when(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->starred(true))->thenReturn(new Result($saved)); @@ -371,7 +371,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideMarkingContexts */ - public function testSetMarksWithQuery(string $get, Context $c, array $data, array $out) { + public function testSetMarksWithQuery(string $get, Context $c, array $data, array $out):void { $saved = [['id' => 1],['id' => 2],['id' => 3]]; $unread = [['id' => 4],['id' => 5],['id' => 6]]; \Phake::when(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->starred(true))->thenReturn(new Result($saved)); @@ -427,7 +427,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideInvalidRequests */ - public function testSendInvalidRequests(ServerRequest $req, ResponseInterface $exp) { + public function testSendInvalidRequests(ServerRequest $req, ResponseInterface $exp):void { $this->assertMessage($exp, $this->h->dispatch($req)); } @@ -439,7 +439,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testMakeABaseQuery() { + public function testMakeABaseQuery():void { $this->h = \Phake::partialMock(API::class); \Phake::when($this->h)->logIn->thenReturn(true); \Phake::when(Arsse::$db)->subscriptionRefreshed(Arsse::$user->id)->thenReturn(new \DateTimeImmutable("2000-01-01T00:00:00Z")); @@ -467,7 +467,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function testUndoReadMarks() { + public function testUndoReadMarks():void { $unread = [['id' => 4],['id' => 5],['id' => 6]]; $out = ['unread_item_ids' => "4,5,6"]; \Phake::when(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->limit(1), ["marked_date"], ["marked_date desc"])->thenReturn(new Result([['marked_date' => "2000-01-01 00:00:00"]])); @@ -483,7 +483,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->articleMark; // only called one time, above } - public function testOutputToXml() { + public function testOutputToXml():void { \Phake::when($this->h)->processRequest->thenReturn([ 'items' => $this->articles['rest'], 'total_items' => 1024, @@ -493,13 +493,13 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function testListFeedIcons() { + public function testListFeedIcons():void { $act = $this->h->dispatch($this->req("api&favicons")); $exp = new JsonResponse(['favicons' => [['id' => 0, 'data' => API::GENERIC_ICON_TYPE.",".API::GENERIC_ICON_DATA]]]); $this->assertMessage($exp, $act); } - public function testAnswerOptionsRequest() { + public function testAnswerOptionsRequest():void { $act = $this->h->dispatch($this->req("api", "", "OPTIONS")); $exp = new EmptyResponse(204, [ 'Allow' => "POST", diff --git a/tests/cases/REST/Fever/TestUser.php b/tests/cases/REST/Fever/TestUser.php index 481057a2..695ea933 100644 --- a/tests/cases/REST/Fever/TestUser.php +++ b/tests/cases/REST/Fever/TestUser.php @@ -36,7 +36,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider providePasswordCreations */ - public function testRegisterAUserPassword(string $user, string $password = null, $exp) { + public function testRegisterAUserPassword(string $user, string $password = null, $exp):void { \Phake::when(Arsse::$user)->generatePassword->thenReturn("RANDOM_PASSWORD"); \Phake::when(Arsse::$db)->tokenCreate->thenReturnCallback(function($user, $class, $id = null) { return $id ?? "RANDOM_TOKEN"; @@ -66,7 +66,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testUnregisterAUser() { + public function testUnregisterAUser():void { \Phake::when(Arsse::$db)->tokenRevoke->thenReturn(3); $this->assertTrue($this->u->unregister("jane.doe@example.com")); \Phake::verify(Arsse::$db)->tokenRevoke("jane.doe@example.com", "fever.login"); @@ -76,7 +76,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserAuthenticationRequests */ - public function testAuthenticateAUserName(string $user, string $password, bool $exp) { + public function testAuthenticateAUserName(string $user, string $password, bool $exp):void { \Phake::when(Arsse::$db)->tokenLookup->thenThrow(new ExceptionInput("constraintViolation")); \Phake::when(Arsse::$db)->tokenLookup("fever.login", md5("jane.doe@example.com:secret"))->thenReturn(['user' => "jane.doe@example.com"]); \Phake::when(Arsse::$db)->tokenLookup("fever.login", md5("john.doe@example.com:superman"))->thenReturn(['user' => "john.doe@example.com"]); diff --git a/tests/cases/REST/NextcloudNews/TestV1_2.php b/tests/cases/REST/NextcloudNews/TestV1_2.php index 9aa3c8e9..25b98a82 100644 --- a/tests/cases/REST/NextcloudNews/TestV1_2.php +++ b/tests/cases/REST/NextcloudNews/TestV1_2.php @@ -333,18 +333,18 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { return $value; } - public function testSendAuthenticationChallenge() { + public function testSendAuthenticationChallenge():void { $exp = new EmptyResponse(401); $this->assertMessage($exp, $this->req("GET", "/", "", [], false)); } /** @dataProvider provideInvalidPaths */ - public function testRespondToInvalidPaths($path, $method, $code, $allow = null) { + public function testRespondToInvalidPaths($path, $method, $code, $allow = null):void { $exp = new EmptyResponse($code, $allow ? ['Allow' => $allow] : []); $this->assertMessage($exp, $this->req($method, $path)); } - public function provideInvalidPaths() { + public function provideInvalidPaths(): array { return [ ["/", "GET", 404], ["/", "POST", 404], @@ -371,7 +371,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testRespondToInvalidInputTypes() { + public function testRespondToInvalidInputTypes():void { $exp = new EmptyResponse(415, ['Accept' => "application/json"]); $this->assertMessage($exp, $this->req("PUT", "/folders/1", '', ['Content-Type' => "application/xml"])); $exp = new EmptyResponse(400); @@ -380,7 +380,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideOptionsRequests */ - public function testRespondToOptionsRequests(string $url, string $allow, string $accept) { + public function testRespondToOptionsRequests(string $url, string $allow, string $accept):void { $exp = new EmptyResponse(204, [ 'Allow' => $allow, 'Accept' => $accept, @@ -388,7 +388,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("OPTIONS", $url)); } - public function provideOptionsRequests() { + public function provideOptionsRequests(): array { return [ ["/feeds", "HEAD,GET,POST", "application/json"], ["/feeds/2112", "DELETE", "application/json"], @@ -396,7 +396,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testListFolders() { + public function testListFolders():void { $list = [ ['id' => 1, 'name' => "Software", 'parent' => null], ['id' => 12, 'name' => "Hardware", 'parent' => null], @@ -411,7 +411,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideFolderCreations */ - public function testAddAFolder(array $input, bool $body, $output, ResponseInterface $exp) { + public function testAddAFolder(array $input, bool $body, $output, ResponseInterface $exp):void { if ($output instanceof ExceptionInput) { \Phake::when(Arsse::$db)->folderAdd->thenThrow($output); } else { @@ -428,7 +428,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideFolderCreations() { + public function provideFolderCreations(): array { return [ [['name' => "Software"], true, 1, new Response(['folders' => [['id'=> 1, 'name' => "Software"]]])], [['name' => "Software"], false, 1, new Response(['folders' => [['id'=> 1, 'name' => "Software"]]])], @@ -441,7 +441,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testRemoveAFolder() { + public function testRemoveAFolder():void { \Phake::when(Arsse::$db)->folderRemove(Arsse::$user->id, 1)->thenReturn(true)->thenThrow(new ExceptionInput("subjectMissing")); $exp = new EmptyResponse(204); $this->assertMessage($exp, $this->req("DELETE", "/folders/1")); @@ -452,7 +452,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideFolderRenamings */ - public function testRenameAFolder(array $input, int $id, $output, ResponseInterface $exp) { + public function testRenameAFolder(array $input, int $id, $output, ResponseInterface $exp):void { if ($output instanceof ExceptionInput) { \Phake::when(Arsse::$db)->folderPropertiesSet->thenThrow($output); } else { @@ -463,7 +463,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->folderPropertiesSet(Arsse::$user->id, $id, $input); } - public function provideFolderRenamings() { + public function provideFolderRenamings(): array { return [ [['name' => "Software"], 1, true, new EmptyResponse(204)], [['name' => "Software"], 2, new ExceptionInput("constraintViolation"), new EmptyResponse(409)], @@ -474,7 +474,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testRetrieveServerVersion() { + public function testRetrieveServerVersion():void { $exp = new Response([ 'version' => V1_2::VERSION, 'arsse_version' => Arsse::VERSION, @@ -482,7 +482,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("GET", "/version")); } - public function testListSubscriptions() { + public function testListSubscriptions():void { $exp1 = [ 'feeds' => [], 'starredCount' => 0, @@ -502,7 +502,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideNewSubscriptions */ - public function testAddASubscription(array $input, $id, int $latestEdition, array $output, $moveOutcome, ResponseInterface $exp) { + public function testAddASubscription(array $input, $id, int $latestEdition, array $output, $moveOutcome, ResponseInterface $exp):void { if ($id instanceof \Exception) { \Phake::when(Arsse::$db)->subscriptionAdd->thenThrow($id); } else { @@ -533,7 +533,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideNewSubscriptions() { + public function provideNewSubscriptions(): array { $feedException = new \JKingWeb\Arsse\Feed\Exception("", new \PicoFeed\Reader\SubscriptionNotFoundException); return [ [['url' => "http://example.com/news.atom", 'folderId' => 3], 2112, 0, $this->feeds['db'][0], new ExceptionInput("idMissing"), new Response(['feeds' => [$this->feeds['rest'][0]]])], @@ -545,7 +545,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testRemoveASubscription() { + public function testRemoveASubscription():void { \Phake::when(Arsse::$db)->subscriptionRemove(Arsse::$user->id, 1)->thenReturn(true)->thenThrow(new ExceptionInput("subjectMissing")); $exp = new EmptyResponse(204); $this->assertMessage($exp, $this->req("DELETE", "/feeds/1")); @@ -555,7 +555,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db, \Phake::times(2))->subscriptionRemove(Arsse::$user->id, 1); } - public function testMoveASubscription() { + public function testMoveASubscription():void { $in = [ ['folderId' => 0], ['folderId' => 42], @@ -583,7 +583,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("PUT", "/feeds/1/move", json_encode($in[5]))); } - public function testRenameASubscription() { + public function testRenameASubscription():void { $in = [ ['feedTitle' => null], ['feedTitle' => "Ook"], @@ -613,7 +613,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("PUT", "/feeds/1/rename", json_encode($in[6]))); } - public function testListStaleFeeds() { + public function testListStaleFeeds():void { $out = [ [ 'id' => 42, @@ -629,7 +629,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("GET", "/feeds/all")); } - public function testUpdateAFeed() { + public function testUpdateAFeed():void { $in = [ ['feedId' => 42], // valid ['feedId' => 2112], // feed does not exist @@ -650,7 +650,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("GET", "/feeds/update", json_encode($in[4]))); } - public function testListArticles() { + public function testListArticles():void { $t = new \DateTime; $in = [ ['type' => 0, 'id' => 42], // type=0 => subscription/feed @@ -704,7 +704,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->limit(5), $this->anything(), ["edition desc"]); } - public function testMarkAFolderRead() { + public function testMarkAFolderRead():void { $read = ['read' => true]; $in = json_encode(['newestItemId' => 2112]); \Phake::when(Arsse::$db)->articleMark(Arsse::$user->id, $read, (new Context)->folder(1)->latestEdition(2112))->thenReturn(42); @@ -719,7 +719,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("PUT", "/folders/42/read", $in)); } - public function testMarkASubscriptionRead() { + public function testMarkASubscriptionRead():void { $read = ['read' => true]; $in = json_encode(['newestItemId' => 2112]); \Phake::when(Arsse::$db)->articleMark(Arsse::$user->id, $read, (new Context)->subscription(1)->latestEdition(2112))->thenReturn(42); @@ -734,7 +734,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("PUT", "/feeds/42/read", $in)); } - public function testMarkAllItemsRead() { + public function testMarkAllItemsRead():void { $read = ['read' => true]; $in = json_encode(['newestItemId' => 2112]); \Phake::when(Arsse::$db)->articleMark(Arsse::$user->id, $read, (new Context)->latestEdition(2112))->thenReturn(42); @@ -746,7 +746,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("PUT", "/items/read?newestItemId=ook")); } - public function testChangeMarksOfASingleArticle() { + public function testChangeMarksOfASingleArticle():void { $read = ['read' => true]; $unread = ['read' => false]; $star = ['starred' => true]; @@ -772,7 +772,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db, \Phake::times(8))->articleMark(Arsse::$user->id, $this->anything(), $this->anything()); } - public function testChangeMarksOfMultipleArticles() { + public function testChangeMarksOfMultipleArticles():void { $read = ['read' => true]; $unread = ['read' => false]; $star = ['starred' => true]; @@ -827,7 +827,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db, \Phake::atLeast(1))->articleMark(Arsse::$user->id, $unstar, (new Context)->articles($in[1])); } - public function testQueryTheServerStatus() { + public function testQueryTheServerStatus():void { $interval = Arsse::$conf->serviceFrequency; $valid = (new \DateTimeImmutable("now", new \DateTimezone("UTC")))->sub($interval); $invalid = $valid->sub($interval)->sub($interval); @@ -847,21 +847,21 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("GET", "/status")); } - public function testCleanUpBeforeUpdate() { + public function testCleanUpBeforeUpdate():void { \Phake::when(Arsse::$db)->feedCleanup()->thenReturn(true); $exp = new EmptyResponse(204); $this->assertMessage($exp, $this->req("GET", "/cleanup/before-update")); \Phake::verify(Arsse::$db)->feedCleanup(); } - public function testCleanUpAfterUpdate() { + public function testCleanUpAfterUpdate():void { \Phake::when(Arsse::$db)->articleCleanup()->thenReturn(true); $exp = new EmptyResponse(204); $this->assertMessage($exp, $this->req("GET", "/cleanup/after-update")); \Phake::verify(Arsse::$db)->articleCleanup(); } - public function testQueryTheUserStatus() { + public function testQueryTheUserStatus():void { $act = $this->req("GET", "/user"); $exp = new Response([ 'userId' => Arsse::$user->id, @@ -872,7 +872,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function testPreferJsonOverQueryParameters() { + public function testPreferJsonOverQueryParameters():void { $in = ['name' => "Software"]; $url = "/folders?name=Hardware"; $out1 = ['id' => 1, 'name' => "Software"]; @@ -885,7 +885,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("POST", "/folders?name=Hardware", json_encode($in))); } - public function testMeldJsonAndQueryParameters() { + public function testMeldJsonAndQueryParameters():void { $in = ['oldestFirst' => true]; $url = "/items?type=2"; \Phake::when(Arsse::$db)->articleList->thenReturn(new Result([])); diff --git a/tests/cases/REST/NextcloudNews/TestVersions.php b/tests/cases/REST/NextcloudNews/TestVersions.php index 7c65ddbf..ba849c59 100644 --- a/tests/cases/REST/NextcloudNews/TestVersions.php +++ b/tests/cases/REST/NextcloudNews/TestVersions.php @@ -25,24 +25,24 @@ class TestVersions extends \JKingWeb\Arsse\Test\AbstractTest { return (new Versions)->dispatch($req); } - public function testFetchVersionList() { + public function testFetchVersionList():void { $exp = new Response(['apiLevels' => ['v1-2']]); $this->assertMessage($exp, $this->req("GET", "/")); $this->assertMessage($exp, $this->req("GET", "/")); $this->assertMessage($exp, $this->req("GET", "/")); } - public function testRespondToOptionsRequest() { + public function testRespondToOptionsRequest():void { $exp = new EmptyResponse(204, ['Allow' => "HEAD,GET"]); $this->assertMessage($exp, $this->req("OPTIONS", "/")); } - public function testUseIncorrectMethod() { + public function testUseIncorrectMethod():void { $exp = new EmptyResponse(405, ['Allow' => "HEAD,GET"]); $this->assertMessage($exp, $this->req("POST", "/")); } - public function testUseIncorrectPath() { + public function testUseIncorrectPath():void { $exp = new EmptyResponse(404); $this->assertMessage($exp, $this->req("GET", "/ook")); $this->assertMessage($exp, $this->req("OPTIONS", "/ook")); diff --git a/tests/cases/REST/TestREST.php b/tests/cases/REST/TestREST.php index 249e80c1..821ab308 100644 --- a/tests/cases/REST/TestREST.php +++ b/tests/cases/REST/TestREST.php @@ -25,7 +25,7 @@ use Laminas\Diactoros\Response\EmptyResponse; class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { /** @dataProvider provideApiMatchData */ - public function testMatchAUrlToAnApi($apiList, string $input, array $exp) { + public function testMatchAUrlToAnApi($apiList, string $input, array $exp):void { $r = new REST($apiList); try { $out = $r->apiMatch($input); @@ -61,7 +61,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideAuthenticableRequests */ - public function testAuthenticateRequests(array $serverParams, array $expAttr) { + public function testAuthenticateRequests(array $serverParams, array $expAttr):void { $r = new REST(); // create a mock user manager Arsse::$user = \Phake::mock(User::class); @@ -93,7 +93,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testSendAuthenticationChallenges() { + public function testSendAuthenticationChallenges():void { self::setConf(); $r = new REST(); $in = new EmptyResponse(401); @@ -106,7 +106,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUnnormalizedOrigins */ - public function testNormalizeOrigins(string $origin, string $exp, array $ports = null) { + public function testNormalizeOrigins(string $origin, string $exp, array $ports = null):void { $r = new REST(); $act = $r->corsNormalizeOrigin($origin, $ports); $this->assertSame($exp, $act); @@ -149,7 +149,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideCorsNegotiations */ - public function testNegotiateCors($origin, bool $exp, string $allowed = null, string $denied = null) { + public function testNegotiateCors($origin, bool $exp, string $allowed = null, string $denied = null):void { self::setConf(); $r = \Phake::partialMock(REST::class); \Phake::when($r)->corsNormalizeOrigin->thenReturnCallback(function($origin) { @@ -187,7 +187,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideCorsHeaders */ - public function testAddCorsHeaders(string $reqMethod, array $reqHeaders, array $resHeaders, array $expHeaders) { + public function testAddCorsHeaders(string $reqMethod, array $reqHeaders, array $resHeaders, array $expHeaders):void { $r = new REST(); $req = new Request("", $reqMethod, "php://memory", $reqHeaders); $res = new EmptyResponse(204, $resHeaders); @@ -251,7 +251,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUnnormalizedResponses */ - public function testNormalizeHttpResponses(ResponseInterface $res, ResponseInterface $exp, RequestInterface $req = null) { + public function testNormalizeHttpResponses(ResponseInterface $res, ResponseInterface $exp, RequestInterface $req = null):void { $r = \Phake::partialMock(REST::class); \Phake::when($r)->corsNegotiate->thenReturn(true); \Phake::when($r)->challenge->thenReturnCallback(function($res) { @@ -286,7 +286,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testCreateHandlers() { + public function testCreateHandlers():void { $r = new REST(); foreach (REST::API_LIST as $api) { $class = $api['class']; @@ -295,7 +295,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideMockRequests */ - public function testDispatchRequests(ServerRequest $req, string $method, bool $called, string $class = "", string $target ="") { + public function testDispatchRequests(ServerRequest $req, string $method, bool $called, string $class = "", string $target =""):void { $r = \Phake::partialMock(REST::class); \Phake::when($r)->normalizeResponse->thenReturnCallback(function($res) { return $res; diff --git a/tests/cases/REST/TinyTinyRSS/TestAPI.php b/tests/cases/REST/TinyTinyRSS/TestAPI.php index f25c4ccb..b6be644a 100644 --- a/tests/cases/REST/TinyTinyRSS/TestAPI.php +++ b/tests/cases/REST/TinyTinyRSS/TestAPI.php @@ -133,7 +133,7 @@ LONG_STRING; return $this->h->dispatch($req); } - protected function reqAuth($data, $user) { + protected function reqAuth($data, $user): ResponseInterface { return $this->req($data, "POST", "", null, $user); } @@ -178,7 +178,7 @@ LONG_STRING; self::clearData(); } - public function testHandleInvalidPaths() { + public function testHandleInvalidPaths():void { $exp = $this->respErr("MALFORMED_INPUT", [], null); $this->assertMessage($exp, $this->req(null, "POST", "", "")); $this->assertMessage($exp, $this->req(null, "POST", "/", "")); @@ -187,7 +187,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req(null, "POST", "/bad/path", "")); } - public function testHandleOptionsRequest() { + public function testHandleOptionsRequest():void { $exp = new EmptyResponse(204, [ 'Allow' => "POST", 'Accept' => "application/json, text/json", @@ -195,14 +195,14 @@ LONG_STRING; $this->assertMessage($exp, $this->req(null, "OPTIONS", "", "")); } - public function testHandleInvalidData() { + public function testHandleInvalidData():void { $exp = $this->respErr("MALFORMED_INPUT", [], null); $this->assertMessage($exp, $this->req(null, "POST", "", "This is not valid JSON data")); $this->assertMessage($exp, $this->req(null, "POST", "", "")); // lack of data is also an error } /** @dataProvider provideLoginRequests */ - public function testLogIn(array $conf, $httpUser, array $data, $sessions) { + public function testLogIn(array $conf, $httpUser, array $data, $sessions):void { Arsse::$user->id = null; self::setConf($conf); \Phake::when(Arsse::$user)->auth->thenReturn(false); @@ -236,7 +236,7 @@ LONG_STRING; } /** @dataProvider provideResumeRequests */ - public function testValidateASession(array $conf, $httpUser, string $data, $result) { + public function testValidateASession(array $conf, $httpUser, string $data, $result):void { Arsse::$user->id = null; self::setConf($conf); \Phake::when(Arsse::$db)->sessionResume("PriestsOfSyrinx")->thenReturn([ @@ -273,7 +273,7 @@ LONG_STRING; return $this->generateLoginRequests("isLoggedIn"); } - public function generateLoginRequests(string $type) { + public function generateLoginRequests(string $type): array { $john = "john.doe@example.com"; $johnGood = [ 'user' => $john, @@ -520,7 +520,7 @@ LONG_STRING; } } - public function testHandleGenericError() { + public function testHandleGenericError():void { \Phake::when(Arsse::$user)->auth(Arsse::$user->id, $this->anything())->thenThrow(new \JKingWeb\Arsse\Db\ExceptionTimeout("general")); $data = [ 'op' => "login", @@ -531,7 +531,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($data)); } - public function testLogOut() { + public function testLogOut():void { \Phake::when(Arsse::$db)->sessionDestroy->thenReturn(true); $data = [ 'op' => "logout", @@ -542,7 +542,7 @@ LONG_STRING; \Phake::verify(Arsse::$db)->sessionDestroy(Arsse::$user->id, "PriestsOfSyrinx"); } - public function testHandleUnknownMethods() { + public function testHandleUnknownMethods():void { $exp = $this->respErr("UNKNOWN_METHOD", ['method' => "thisMethodDoesNotExist"]); $data = [ 'op' => "thisMethodDoesNotExist", @@ -551,7 +551,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($data)); } - public function testHandleMixedCaseMethods() { + public function testHandleMixedCaseMethods():void { $data = [ 'op' => "isLoggedIn", 'sid' => "PriestsOfSyrinx", @@ -566,7 +566,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($data)); } - public function testRetrieveServerVersion() { + public function testRetrieveServerVersion():void { $data = [ 'op' => "getVersion", 'sid' => "PriestsOfSyrinx", @@ -578,7 +578,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($data)); } - public function testRetrieveProtocolLevel() { + public function testRetrieveProtocolLevel():void { $data = [ 'op' => "getApiLevel", 'sid' => "PriestsOfSyrinx", @@ -587,7 +587,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($data)); } - public function testAddACategory() { + public function testAddACategory():void { $in = [ ['op' => "addCategory", 'sid' => "PriestsOfSyrinx", 'caption' => "Software"], ['op' => "addCategory", 'sid' => "PriestsOfSyrinx", 'caption' => "Hardware", 'parent_id' => 1], @@ -638,7 +638,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($in[5])); } - public function testRemoveACategory() { + public function testRemoveACategory():void { $in = [ ['op' => "removeCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 42], ['op' => "removeCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 2112], @@ -661,7 +661,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(3))->folderRemove(Arsse::$user->id, $this->anything()); } - public function testMoveACategory() { + public function testMoveACategory():void { $in = [ ['op' => "moveCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 42, 'parent_id' => 1], ['op' => "moveCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 2112, 'parent_id' => 2], @@ -713,7 +713,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(5))->folderPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything()); } - public function testRenameACategory() { + public function testRenameACategory():void { $in = [ ['op' => "renameCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 42, 'caption' => "Ook"], ['op' => "renameCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 2112, 'caption' => "Eek"], @@ -753,7 +753,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(3))->folderPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything()); } - public function testAddASubscription() { + public function testAddASubscription():void { $in = [ ['op' => "subscribeToFeed", 'sid' => "PriestsOfSyrinx", 'feed_url' => "http://example.com/0"], ['op' => "subscribeToFeed", 'sid' => "PriestsOfSyrinx", 'feed_url' => "http://example.com/1", 'category_id' => 42], @@ -828,7 +828,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(0))->subscriptionPropertiesSet(Arsse::$user->id, 4, ['folder' => 1]); } - public function testRemoveASubscription() { + public function testRemoveASubscription():void { $in = [ ['op' => "unsubscribeFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 42], ['op' => "unsubscribeFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 2112], @@ -850,7 +850,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(5))->subscriptionRemove(Arsse::$user->id, $this->anything()); } - public function testMoveASubscription() { + public function testMoveASubscription():void { $in = [ ['op' => "moveFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 42, 'category_id' => 1], ['op' => "moveFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 2112, 'category_id' => 2], @@ -892,7 +892,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(4))->subscriptionPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything()); } - public function testRenameASubscription() { + public function testRenameASubscription():void { $in = [ ['op' => "renameFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 42, 'caption' => "Ook"], ['op' => "renameFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 2112, 'caption' => "Eek"], @@ -934,7 +934,7 @@ LONG_STRING; \Phake::verify(Arsse::$db)->subscriptionPropertiesSet(...$db[2]); } - public function testRetrieveTheGlobalUnreadCount() { + public function testRetrieveTheGlobalUnreadCount():void { $in = ['op' => "getUnread", 'sid' => "PriestsOfSyrinx"]; \Phake::when(Arsse::$db)->subscriptionList(Arsse::$user->id)->thenReturn(new Result($this->v([ ['id' => 1, 'unread' => 2112], @@ -945,7 +945,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($in)); } - public function testRetrieveTheServerConfiguration() { + public function testRetrieveTheServerConfiguration():void { $in = ['op' => "getConfig", 'sid' => "PriestsOfSyrinx"]; $interval = Arsse::$conf->serviceFrequency; $valid = (new \DateTimeImmutable("now", new \DateTimezone("UTC")))->sub($interval); @@ -960,7 +960,7 @@ LONG_STRING; $this->assertMessage($this->respGood($exp[1]), $this->req($in)); } - public function testUpdateAFeed() { + public function testUpdateAFeed():void { $in = [ ['op' => "updateFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 1], ['op' => "updateFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 2], @@ -980,7 +980,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($in[3])); } - public function testAddALabel() { + public function testAddALabel():void { $in = [ ['op' => "addLabel", 'sid' => "PriestsOfSyrinx", 'caption' => "Software"], ['op' => "addLabel", 'sid' => "PriestsOfSyrinx", 'caption' => "Hardware",], @@ -1025,7 +1025,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($in[4])); } - public function testRemoveALabel() { + public function testRemoveALabel():void { $in = [ ['op' => "removeLabel", 'sid' => "PriestsOfSyrinx", 'label_id' => -1042], ['op' => "removeLabel", 'sid' => "PriestsOfSyrinx", 'label_id' => -2112], @@ -1053,7 +1053,7 @@ LONG_STRING; \Phake::verify(Arsse::$db)->labelRemove(Arsse::$user->id, 1088); } - public function testRenameALabel() { + public function testRenameALabel():void { $in = [ ['op' => "renameLabel", 'sid' => "PriestsOfSyrinx", 'label_id' => -1042, 'caption' => "Ook"], ['op' => "renameLabel", 'sid' => "PriestsOfSyrinx", 'label_id' => -2112, 'caption' => "Eek"], @@ -1099,7 +1099,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(6))->labelPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything()); } - public function testRetrieveCategoryLists() { + public function testRetrieveCategoryLists():void { $in = [ ['op' => "getCategories", 'sid' => "PriestsOfSyrinx", 'include_empty' => true], ['op' => "getCategories", 'sid' => "PriestsOfSyrinx"], @@ -1171,7 +1171,7 @@ LONG_STRING; } } - public function testRetrieveCounterList() { + public function testRetrieveCounterList():void { $in = ['op' => "getCounters", 'sid' => "PriestsOfSyrinx"]; \Phake::when(Arsse::$db)->folderList($this->anything())->thenReturn(new Result($this->v($this->folders))); \Phake::when(Arsse::$db)->subscriptionList($this->anything())->thenReturn(new Result($this->v($this->subscriptions))); @@ -1206,7 +1206,7 @@ LONG_STRING; $this->assertMessage($this->respGood($exp), $this->req($in)); } - public function testRetrieveTheLabelList() { + public function testRetrieveTheLabelList():void { $in = [ ['op' => "getLabels", 'sid' => "PriestsOfSyrinx"], ['op' => "getLabels", 'sid' => "PriestsOfSyrinx", 'article_id' => 1], @@ -1251,7 +1251,7 @@ LONG_STRING; } } - public function testAssignArticlesToALabel() { + public function testAssignArticlesToALabel():void { $list = [ range(1, 100), range(1, 50), @@ -1289,7 +1289,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($in[6])); } - public function testRetrieveFeedTree() { + public function testRetrieveFeedTree():void { $in = [ ['op' => "getFeedTree", 'sid' => "PriestsOfSyrinx", 'include_empty' => true], ['op' => "getFeedTree", 'sid' => "PriestsOfSyrinx"], @@ -1306,7 +1306,7 @@ LONG_STRING; $this->assertMessage($this->respGood($exp), $this->req($in[1])); } - public function testMarkFeedsAsRead() { + public function testMarkFeedsAsRead():void { $in1 = [ // no-ops ['op' => "catchupFeed", 'sid' => "PriestsOfSyrinx"], @@ -1357,7 +1357,7 @@ LONG_STRING; \Phake::verify(Arsse::$db)->articleMark($this->anything(), ['read' => true], $this->equalTo((new Context)->modifiedSince($t), 2)); // within two seconds } - public function testRetrieveFeedList() { + public function testRetrieveFeedList():void { $in1 = [ ['op' => "getFeeds", 'sid' => "PriestsOfSyrinx"], ['op' => "getFeeds", 'sid' => "PriestsOfSyrinx", 'cat_id' => -1], @@ -1519,7 +1519,7 @@ LONG_STRING; return $out; } - public function testChangeArticles() { + public function testChangeArticles():void { $in = [ ['op' => "updateArticle", 'sid' => "PriestsOfSyrinx"], ['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1"], @@ -1604,7 +1604,7 @@ LONG_STRING; } } - public function testListArticles() { + public function testListArticles():void { $in = [ // error conditions ['op' => "getArticle", 'sid' => "PriestsOfSyrinx"], @@ -1693,7 +1693,7 @@ LONG_STRING; $this->assertMessage($this->respGood([$exp[0]]), $this->req($in[5])); } - public function testRetrieveCompactHeadlines() { + public function testRetrieveCompactHeadlines():void { $in1 = [ // erroneous input ['op' => "getCompactHeadlines", 'sid' => "PriestsOfSyrinx"], @@ -1779,7 +1779,7 @@ LONG_STRING; } } - public function testRetrieveFullHeadlines() { + public function testRetrieveFullHeadlines():void { $in1 = [ // empty results ['op' => "getHeadlines", 'sid' => "PriestsOfSyrinx", 'feed_id' => 0], @@ -1895,7 +1895,7 @@ LONG_STRING; } } - public function testRetrieveFullHeadlinesCheckingExtraFields() { + public function testRetrieveFullHeadlinesCheckingExtraFields():void { $in = [ // empty results ['op' => "getHeadlines", 'sid' => "PriestsOfSyrinx", 'feed_id' => -4], diff --git a/tests/cases/REST/TinyTinyRSS/TestIcon.php b/tests/cases/REST/TinyTinyRSS/TestIcon.php index fd330945..a90bd98d 100644 --- a/tests/cases/REST/TinyTinyRSS/TestIcon.php +++ b/tests/cases/REST/TinyTinyRSS/TestIcon.php @@ -40,15 +40,15 @@ class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest { return $this->h->dispatch($req); } - protected function reqAuth(string $target, string $method = "GET") { + protected function reqAuth(string $target, string $method = "GET"): ResponseInterface { return $this->req($target, $method, $this->user); } - protected function reqAuthFailed(string $target, string $method = "GET") { + protected function reqAuthFailed(string $target, string $method = "GET"): ResponseInterface { return $this->req($target, $method, ""); } - public function testRetrieveFavion() { + public function testRetrieveFavion():void { \Phake::when(Arsse::$db)->subscriptionFavicon->thenReturn(""); \Phake::when(Arsse::$db)->subscriptionFavicon(42, $this->anything())->thenReturn("http://example.com/favicon.ico"); \Phake::when(Arsse::$db)->subscriptionFavicon(2112, $this->anything())->thenReturn("http://example.net/logo.png"); @@ -71,7 +71,7 @@ class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("2112.ico", "PUT")); } - public function testRetrieveFavionWithHttpAuthentication() { + public function testRetrieveFavionWithHttpAuthentication():void { $url = "http://example.org/icon.gif\r\nLocation: http://bad.example.com/"; \Phake::when(Arsse::$db)->subscriptionFavicon->thenReturn(""); \Phake::when(Arsse::$db)->subscriptionFavicon(42, $this->user)->thenReturn($url); diff --git a/tests/cases/REST/TinyTinyRSS/TestSearch.php b/tests/cases/REST/TinyTinyRSS/TestSearch.php index 82720bf9..890a6bb1 100644 --- a/tests/cases/REST/TinyTinyRSS/TestSearch.php +++ b/tests/cases/REST/TinyTinyRSS/TestSearch.php @@ -118,7 +118,7 @@ class TestSearch extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideSearchStrings */ - public function testApplySearchToContext(string $search, $exp) { + public function testApplySearchToContext(string $search, $exp):void { $act = Search::parse($search); $this->assertEquals($exp, $act); } diff --git a/tests/cases/Service/TestSerial.php b/tests/cases/Service/TestSerial.php index 73381374..4031c80e 100644 --- a/tests/cases/Service/TestSerial.php +++ b/tests/cases/Service/TestSerial.php @@ -19,16 +19,16 @@ class TestSerial extends \JKingWeb\Arsse\Test\AbstractTest { Arsse::$db = \Phake::mock(Database::class); } - public function testConstruct() { + public function testConstruct():void { $this->assertTrue(Driver::requirementsMet()); $this->assertInstanceOf(DriverInterface::class, new Driver); } - public function testFetchDriverName() { + public function testFetchDriverName():void { $this->assertTrue(strlen(Driver::driverName()) > 0); } - public function testEnqueueFeeds() { + public function testEnqueueFeeds():void { $d = new Driver; $this->assertSame(3, $d->queue(1, 2, 3)); $this->assertSame(5, $d->queue(4, 5)); @@ -36,7 +36,7 @@ class TestSerial extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(1, $d->queue(5)); } - public function testRefreshFeeds() { + public function testRefreshFeeds():void { $d = new Driver; $d->queue(1, 4, 3); $this->assertSame(Arsse::$conf->serviceQueueWidth, $d->exec()); diff --git a/tests/cases/Service/TestService.php b/tests/cases/Service/TestService.php index 08114888..55930602 100644 --- a/tests/cases/Service/TestService.php +++ b/tests/cases/Service/TestService.php @@ -22,14 +22,14 @@ class TestService extends \JKingWeb\Arsse\Test\AbstractTest { $this->srv = new Service(); } - public function testCheckIn() { + public function testCheckIn():void { $now = time(); $this->srv->checkIn(); \Phake::verify(Arsse::$db)->metaSet("service_last_checkin", \Phake::capture($then), "datetime"); $this->assertTime($now, $then); } - public function testReportHavingCheckedIn() { + public function testReportHavingCheckedIn():void { // the mock's metaGet() returns null by default $this->assertFalse(Service::hasCheckedIn()); $interval = Arsse::$conf->serviceFrequency; @@ -40,27 +40,27 @@ class TestService extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertFalse(Service::hasCheckedIn()); } - public function testPerformPreCleanup() { + public function testPerformPreCleanup():void { $this->assertTrue(Service::cleanupPre()); \Phake::verify(Arsse::$db)->feedCleanup(); \Phake::verify(Arsse::$db)->sessionCleanup(); } - public function testPerformShortPostCleanup() { + public function testPerformShortPostCleanup():void { \Phake::when(Arsse::$db)->articleCleanup()->thenReturn(0); $this->assertTrue(Service::cleanupPost()); \Phake::verify(Arsse::$db)->articleCleanup(); \Phake::verify(Arsse::$db, \Phake::times(0))->driverMaintenance(); } - public function testPerformFullPostCleanup() { + public function testPerformFullPostCleanup():void { \Phake::when(Arsse::$db)->articleCleanup()->thenReturn(1); $this->assertTrue(Service::cleanupPost()); \Phake::verify(Arsse::$db)->articleCleanup(); \Phake::verify(Arsse::$db)->driverMaintenance(); } - public function testRefreshFeeds() { + public function testRefreshFeeds():void { // set up mock database actions \Phake::when(Arsse::$db)->metaSet->thenReturn(true); \Phake::when(Arsse::$db)->feedCleanup->thenReturn(true); diff --git a/tests/cases/Service/TestSubprocess.php b/tests/cases/Service/TestSubprocess.php index 332b4544..9562048c 100644 --- a/tests/cases/Service/TestSubprocess.php +++ b/tests/cases/Service/TestSubprocess.php @@ -18,16 +18,16 @@ class TestSubprocess extends \JKingWeb\Arsse\Test\AbstractTest { self::setConf(); } - public function testConstruct() { + public function testConstruct():void { $this->assertTrue(Driver::requirementsMet()); $this->assertInstanceOf(DriverInterface::class, new Driver); } - public function testFetchDriverName() { + public function testFetchDriverName():void { $this->assertTrue(strlen(Driver::driverName()) > 0); } - public function testEnqueueFeeds() { + public function testEnqueueFeeds():void { $d = new Driver; $this->assertSame(3, $d->queue(1, 2, 3)); $this->assertSame(5, $d->queue(4, 5)); @@ -35,7 +35,7 @@ class TestSubprocess extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(1, $d->queue(5)); } - public function testRefreshFeeds() { + public function testRefreshFeeds():void { $d = \Phake::partialMock(Driver::class); \Phake::when($d)->execCmd->thenReturnCallback(function(string $cmd) { // FIXME: Does this work in Windows? diff --git a/tests/cases/TestArsse.php b/tests/cases/TestArsse.php index 9fbe0821..a6b28e7c 100644 --- a/tests/cases/TestArsse.php +++ b/tests/cases/TestArsse.php @@ -22,7 +22,7 @@ class TestArsse extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testLoadExistingData() { + public function testLoadExistingData():void { $lang = Arsse::$lang = \Phake::mock(Lang::class); $db = Arsse::$db = \Phake::mock(Database::class); $user = Arsse::$user = \Phake::mock(User::class); @@ -36,7 +36,7 @@ class TestArsse extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($lang)->set("test"); } - public function testLoadNewData() { + public function testLoadNewData():void { if (!\JKingWeb\Arsse\Db\SQLite3\Driver::requirementsMet() && !\JKingWeb\Arsse\Db\SQLite3\PDODriver::requirementsMet()) { $this->markTestSkipped("A functional SQLite interface is required for this test"); } diff --git a/tests/cases/User/TestInternal.php b/tests/cases/User/TestInternal.php index b72cf9a3..ea1221b3 100644 --- a/tests/cases/User/TestInternal.php +++ b/tests/cases/User/TestInternal.php @@ -21,11 +21,11 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::when(Arsse::$db)->begin->thenReturn(\Phake::mock(\JKingWeb\Arsse\Db\Transaction::class)); } - public function testConstruct() { + public function testConstruct():void { $this->assertInstanceOf(DriverInterface::class, new Driver); } - public function testFetchDriverName() { + public function testFetchDriverName():void { $this->assertTrue(strlen(Driver::driverName()) > 0); } @@ -33,7 +33,7 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { * @dataProvider provideAuthentication * @group slow */ - public function testAuthenticateAUser(bool $authorized, string $user, $password, bool $exp) { + public function testAuthenticateAUser(bool $authorized, string $user, $password, bool $exp):void { if ($authorized) { \Phake::when(Arsse::$db)->userPasswordGet("john.doe@example.com")->thenReturn('$2y$10$1zbqRJhxM8uUjeSBPp4IhO90xrqK0XjEh9Z16iIYEFRV4U.zeAFom'); // hash of "secret" \Phake::when(Arsse::$db)->userPasswordGet("jane.doe@example.com")->thenReturn('$2y$10$bK1ljXfTSyc2D.NYvT.Eq..OpehLRXVbglW.23ihVuyhgwJCd.7Im'); // hash of "superman" @@ -74,12 +74,12 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testAuthorizeAnAction() { + public function testAuthorizeAnAction():void { \Phake::verifyNoFurtherInteraction(Arsse::$db); $this->assertTrue((new Driver)->authorize("someone", "something")); } - public function testListUsers() { + public function testListUsers():void { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; \Phake::when(Arsse::$db)->userList->thenReturn([$john, $jane])->thenReturn([$jane, $john]); @@ -89,7 +89,7 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db, \Phake::times(2))->userList; } - public function testCheckThatAUserExists() { + public function testCheckThatAUserExists():void { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; \Phake::when(Arsse::$db)->userExists($john)->thenReturn(true); @@ -101,7 +101,7 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->userExists($jane); } - public function testAddAUser() { + public function testAddAUser():void { $john = "john.doe@example.com"; \Phake::when(Arsse::$db)->userAdd->thenReturnCallback(function($user, $pass) { return $pass; @@ -114,7 +114,7 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->userAdd; } - public function testRemoveAUser() { + public function testRemoveAUser():void { $john = "john.doe@example.com"; \Phake::when(Arsse::$db)->userRemove->thenReturn(true)->thenThrow(new \JKingWeb\Arsse\User\Exception("doesNotExist")); $driver = new Driver; @@ -128,21 +128,21 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testSetAPassword() { + public function testSetAPassword():void { $john = "john.doe@example.com"; \Phake::verifyNoFurtherInteraction(Arsse::$db); $this->assertSame("superman", (new Driver)->userPasswordSet($john, "superman")); $this->assertSame(null, (new Driver)->userPasswordSet($john, null)); } - public function testUnsetAPassword() { + public function testUnsetAPassword():void { $drv = \Phake::partialMock(Driver::class); \Phake::when($drv)->userExists->thenReturn(true); \Phake::verifyNoFurtherInteraction(Arsse::$db); $this->assertTrue($drv->userPasswordUnset("john.doe@example.com")); } - public function testUnsetAPasswordForAMssingUser() { + public function testUnsetAPasswordForAMssingUser():void { $drv = \Phake::partialMock(Driver::class); \Phake::when($drv)->userExists->thenReturn(false); \Phake::verifyNoFurtherInteraction(Arsse::$db); diff --git a/tests/cases/User/TestUser.php b/tests/cases/User/TestUser.php index 97f3fc09..4b0c3998 100644 --- a/tests/cases/User/TestUser.php +++ b/tests/cases/User/TestUser.php @@ -24,12 +24,12 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { $this->drv = \Phake::mock(Driver::class); } - public function testConstruct() { + public function testConstruct():void { $this->assertInstanceOf(User::class, new User($this->drv)); $this->assertInstanceOf(User::class, new User); } - public function testConversionToString() { + public function testConversionToString():void { $u = new User; $u->id = "john.doe@example.com"; $this->assertSame("john.doe@example.com", (string) $u); @@ -38,7 +38,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideAuthentication */ - public function testAuthenticateAUser(bool $preAuth, string $user, string $password, bool $exp) { + public function testAuthenticateAUser(bool $preAuth, string $user, string $password, bool $exp):void { Arsse::$conf->userPreAuth = $preAuth; \Phake::when($this->drv)->auth->thenReturn(false); \Phake::when($this->drv)->auth("john.doe@example.com", "secret")->thenReturn(true); @@ -69,7 +69,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserList */ - public function testListUsers(bool $authorized, $exp) { + public function testListUsers(bool $authorized, $exp):void { $u = new User($this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userList->thenReturn(["john.doe@example.com", "jane.doe@example.com"]); @@ -89,7 +89,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideExistence */ - public function testCheckThatAUserExists(bool $authorized, string $user, $exp) { + public function testCheckThatAUserExists(bool $authorized, string $user, $exp):void { $u = new User($this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userExists("john.doe@example.com")->thenReturn(true); @@ -112,7 +112,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideAdditions */ - public function testAddAUser(bool $authorized, string $user, $password, $exp) { + public function testAddAUser(bool $authorized, string $user, $password, $exp):void { $u = new User($this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userAdd("john.doe@example.com", $this->anything())->thenThrow(new \JKingWeb\Arsse\User\Exception("alreadyExists")); @@ -130,7 +130,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideAdditions */ - public function testAddAUserWithARandomPassword(bool $authorized, string $user, $password, $exp) { + public function testAddAUserWithARandomPassword(bool $authorized, string $user, $password, $exp):void { $u = \Phake::partialMock(User::class, $this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userAdd($this->anything(), $this->isNull())->thenReturn(null); @@ -172,7 +172,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideRemovals */ - public function testRemoveAUser(bool $authorized, string $user, bool $exists, $exp) { + public function testRemoveAUser(bool $authorized, string $user, bool $exists, $exp):void { $u = new User($this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userRemove("john.doe@example.com")->thenReturn(true); @@ -210,7 +210,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider providePasswordChanges */ - public function testChangeAPassword(bool $authorized, string $user, $password, bool $exists, $exp) { + public function testChangeAPassword(bool $authorized, string $user, $password, bool $exists, $exp):void { $u = new User($this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userPasswordSet("john.doe@example.com", $this->anything(), $this->anything())->thenReturnCallback(function($user, $pass, $old) { @@ -237,7 +237,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider providePasswordChanges */ - public function testChangeAPasswordToARandomPassword(bool $authorized, string $user, $password, bool $exists, $exp) { + public function testChangeAPasswordToARandomPassword(bool $authorized, string $user, $password, bool $exists, $exp):void { $u = \Phake::partialMock(User::class, $this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userPasswordSet($this->anything(), $this->isNull(), $this->anything())->thenReturn(null); @@ -289,7 +289,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider providePasswordClearings */ - public function testClearAPassword(bool $authorized, bool $exists, string $user, $exp) { + public function testClearAPassword(bool $authorized, bool $exists, string $user, $exp):void { \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userPasswordUnset->thenReturn(true); \Phake::when($this->drv)->userPasswordUnset("jane.doe@example.net", null)->thenThrow(new \JKingWeb\Arsse\User\Exception("doesNotExist")); diff --git a/tests/lib/AbstractTest.php b/tests/lib/AbstractTest.php index bb0c688f..0a553d13 100644 --- a/tests/lib/AbstractTest.php +++ b/tests/lib/AbstractTest.php @@ -34,7 +34,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { self::clearData(); } - public static function clearData(bool $loadLang = true) { + public static function clearData(bool $loadLang = true): void { date_default_timezone_set("America/Toronto"); $r = new \ReflectionClass(\JKingWeb\Arsse\Arsse::class); $props = array_keys($r->getStaticProperties()); @@ -46,7 +46,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { } } - public static function setConf(array $conf = [], bool $force = true) { + public static function setConf(array $conf = [], bool $force = true): void { $defaults = [ 'dbSQLite3File' => ":memory:", 'dbSQLite3Timeout' => 0, @@ -127,7 +127,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { return $req; } - public function assertException($msg = "", string $prefix = "", string $type = "Exception") { + public function assertException($msg = "", string $prefix = "", string $type = "Exception"): void { if (func_num_args()) { if ($msg instanceof \JKingWeb\Arsse\AbstractException) { $this->expectException(get_class($msg)); @@ -149,7 +149,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { } } - protected function assertMessage(MessageInterface $exp, MessageInterface $act, string $text = '') { + protected function assertMessage(MessageInterface $exp, MessageInterface $act, string $text = ''): void { if ($exp instanceof ResponseInterface) { $this->assertInstanceOf(ResponseInterface::class, $act, $text); $this->assertEquals($exp->getStatusCode(), $act->getStatusCode(), $text); @@ -173,7 +173,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { $this->assertEquals($exp->getHeaders(), $act->getHeaders(), $text); } - public function assertTime($exp, $test, string $msg = '') { + public function assertTime($exp, $test, string $msg = ''): void { $test = $this->approximateTime($exp, $test); $exp = Date::transform($exp, "iso8601"); $test = Date::transform($test, "iso8601"); @@ -299,7 +299,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { return $out; } - public function assertResult(array $expected, Result $data) { + public function assertResult(array $expected, Result $data): void { $data = $data->getAll(); $this->assertCount(sizeof($expected), $data, "Number of result rows (".sizeof($data).") differs from number of expected rows (".sizeof($expected).")"); if (sizeof($expected)) { diff --git a/tests/lib/DatabaseDrivers/MySQL.php b/tests/lib/DatabaseDrivers/MySQL.php index 332f3d99..c0863b7d 100644 --- a/tests/lib/DatabaseDrivers/MySQL.php +++ b/tests/lib/DatabaseDrivers/MySQL.php @@ -42,7 +42,7 @@ trait MySQL { return $tables; } - public static function dbTruncate($db, array $afterStatements = []) { + public static function dbTruncate($db, array $afterStatements = []): void { // rollback any pending transaction try { $db->query("UNLOCK TABLES; ROLLBACK"); @@ -63,7 +63,7 @@ trait MySQL { } } - public static function dbRaze($db, array $afterStatements = []) { + public static function dbRaze($db, array $afterStatements = []): void { // rollback any pending transaction try { $db->query("UNLOCK TABLES; ROLLBACK"); diff --git a/tests/lib/DatabaseDrivers/MySQLPDO.php b/tests/lib/DatabaseDrivers/MySQLPDO.php index 2499e5d9..0b9ffef2 100644 --- a/tests/lib/DatabaseDrivers/MySQLPDO.php +++ b/tests/lib/DatabaseDrivers/MySQLPDO.php @@ -47,11 +47,11 @@ trait MySQLPDO { return MySQL::dbTableList($db); } - public static function dbTruncate($db, array $afterStatements = []) { + public static function dbTruncate($db, array $afterStatements = []): void { MySQL::dbTruncate($db, $afterStatements); } - public static function dbRaze($db, array $afterStatements = []) { + public static function dbRaze($db, array $afterStatements = []): void { MySQL::dbRaze($db, $afterStatements); } } diff --git a/tests/lib/DatabaseDrivers/PostgreSQL.php b/tests/lib/DatabaseDrivers/PostgreSQL.php index c03070ed..3b59ee84 100644 --- a/tests/lib/DatabaseDrivers/PostgreSQL.php +++ b/tests/lib/DatabaseDrivers/PostgreSQL.php @@ -29,7 +29,7 @@ trait PostgreSQL { } } - public static function dbExec($db, $q) { + public static function dbExec($db, $q): void { if ($db instanceof Driver) { $db->exec($q); } elseif ($db instanceof \PDO) { @@ -52,7 +52,7 @@ trait PostgreSQL { } } - public static function dbTruncate($db, array $afterStatements = []) { + public static function dbTruncate($db, array $afterStatements = []): void { // rollback any pending transaction try { @self::dbExec($db, "ROLLBACK"); @@ -72,7 +72,7 @@ trait PostgreSQL { } } - public static function dbRaze($db, array $afterStatements = []) { + public static function dbRaze($db, array $afterStatements = []): void { // rollback any pending transaction try { @self::dbExec($db, "ROLLBACK"); diff --git a/tests/lib/DatabaseDrivers/PostgreSQLPDO.php b/tests/lib/DatabaseDrivers/PostgreSQLPDO.php index f275e70e..b7f5f259 100644 --- a/tests/lib/DatabaseDrivers/PostgreSQLPDO.php +++ b/tests/lib/DatabaseDrivers/PostgreSQLPDO.php @@ -33,11 +33,11 @@ trait PostgreSQLPDO { return PostgreSQL::dbTableList($db); } - public static function dbTruncate($db, array $afterStatements = []) { + public static function dbTruncate($db, array $afterStatements = []): void { PostgreSQL::dbTruncate($db, $afterStatements); } - public static function dbRaze($db, array $afterStatements = []) { + public static function dbRaze($db, array $afterStatements = []): void { PostgreSQL::dbRaze($db, $afterStatements); } } diff --git a/tests/lib/DatabaseDrivers/SQLite3.php b/tests/lib/DatabaseDrivers/SQLite3.php index a3e23580..20f50cc1 100644 --- a/tests/lib/DatabaseDrivers/SQLite3.php +++ b/tests/lib/DatabaseDrivers/SQLite3.php @@ -51,7 +51,7 @@ trait SQLite3 { return $tables; } - public static function dbTruncate($db, array $afterStatements = []) { + public static function dbTruncate($db, array $afterStatements = []): void { // rollback any pending transaction try { $db->exec("ROLLBACK"); @@ -69,7 +69,7 @@ trait SQLite3 { } } - public static function dbRaze($db, array $afterStatements = []) { + public static function dbRaze($db, array $afterStatements = []): void { // rollback any pending transaction try { $db->exec("ROLLBACK"); diff --git a/tests/lib/DatabaseDrivers/SQLite3PDO.php b/tests/lib/DatabaseDrivers/SQLite3PDO.php index 7f5d2a04..c7af2074 100644 --- a/tests/lib/DatabaseDrivers/SQLite3PDO.php +++ b/tests/lib/DatabaseDrivers/SQLite3PDO.php @@ -30,11 +30,11 @@ trait SQLite3PDO { return SQLite3::dbTableList($db); } - public static function dbTruncate($db, array $afterStatements = []) { + public static function dbTruncate($db, array $afterStatements = []): void { SQLite3::dbTruncate($db, $afterStatements); } - public static function dbRaze($db, array $afterStatements = []) { + public static function dbRaze($db, array $afterStatements = []): void { SQLite3::dbRaze($db, $afterStatements); } } From b5f118e8cb879ba40778907c5bed0cdb8f0cf3b8 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 20 Jan 2020 13:52:48 -0500 Subject: [PATCH 06/14] Cleanup --- lib/Database.php | 2 +- lib/Feed.php | 2 +- lib/Misc/Date.php | 8 +- tests/cases/CLI/TestCLI.php | 28 ++-- tests/cases/Conf/TestConf.php | 32 ++--- tests/cases/Database/SeriesArticle.php | 120 +++++++++--------- tests/cases/Database/SeriesCleanup.php | 20 +-- tests/cases/Database/SeriesFeed.php | 20 +-- tests/cases/Database/SeriesFolder.php | 92 +++++++------- tests/cases/Database/SeriesLabel.php | 96 +++++++------- tests/cases/Database/SeriesMeta.php | 14 +- tests/cases/Database/SeriesMiscellany.php | 12 +- tests/cases/Database/SeriesSession.php | 24 ++-- tests/cases/Database/SeriesSubscription.php | 92 +++++++------- tests/cases/Database/SeriesTag.php | 100 +++++++-------- tests/cases/Database/SeriesToken.php | 24 ++-- tests/cases/Database/SeriesUser.php | 38 +++--- tests/cases/Database/TestDatabase.php | 4 +- tests/cases/Db/BaseDriver.php | 70 +++++----- tests/cases/Db/BaseResult.php | 18 +-- tests/cases/Db/BaseStatement.php | 18 +-- tests/cases/Db/BaseUpdate.php | 24 ++-- tests/cases/Db/MySQL/TestCreation.php | 2 +- tests/cases/Db/MySQL/TestStatement.php | 2 +- tests/cases/Db/MySQLPDO/TestCreation.php | 2 +- tests/cases/Db/PostgreSQL/TestCreation.php | 4 +- tests/cases/Db/PostgreSQLPDO/TestCreation.php | 4 +- tests/cases/Db/SQLite3/TestCreation.php | 26 ++-- tests/cases/Db/SQLite3PDO/TestCreation.php | 26 ++-- tests/cases/Db/TestResultAggregate.php | 14 +- tests/cases/Db/TestResultEmpty.php | 10 +- tests/cases/Db/TestTransaction.php | 6 +- tests/cases/Exception/TestException.php | 14 +- tests/cases/Feed/TestFeed.php | 34 ++--- tests/cases/Feed/TestFetching.php | 18 +-- tests/cases/ImportExport/TestFile.php | 4 +- tests/cases/ImportExport/TestImportExport.php | 16 +-- tests/cases/ImportExport/TestOPML.php | 8 +- tests/cases/Lang/TestBasic.php | 10 +- tests/cases/Lang/TestComplex.php | 24 ++-- tests/cases/Lang/TestErrors.php | 24 ++-- tests/cases/Misc/TestContext.php | 12 +- tests/cases/Misc/TestDate.php | 8 +- tests/cases/Misc/TestHTTP.php | 2 +- tests/cases/Misc/TestQuery.php | 16 +-- tests/cases/Misc/TestURL.php | 6 +- tests/cases/Misc/TestValueInfo.php | 16 +-- tests/cases/REST/Fever/TestAPI.php | 28 ++-- tests/cases/REST/Fever/TestUser.php | 6 +- tests/cases/REST/NextcloudNews/TestV1_2.php | 60 ++++----- .../cases/REST/NextcloudNews/TestVersions.php | 8 +- tests/cases/REST/TestREST.php | 18 +-- tests/cases/REST/TinyTinyRSS/TestAPI.php | 74 +++++------ tests/cases/REST/TinyTinyRSS/TestIcon.php | 4 +- tests/cases/REST/TinyTinyRSS/TestSearch.php | 2 +- tests/cases/Service/TestSerial.php | 8 +- tests/cases/Service/TestService.php | 12 +- tests/cases/Service/TestSubprocess.php | 8 +- tests/cases/TestArsse.php | 4 +- tests/cases/User/TestInternal.php | 22 ++-- tests/cases/User/TestUser.php | 22 ++-- 61 files changed, 721 insertions(+), 721 deletions(-) diff --git a/lib/Database.php b/lib/Database.php index eadabd70..24475a64 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -932,7 +932,7 @@ class Database { } /** Returns the time at which any of a user's subscriptions (or a specific subscription) was last refreshed, as a DateTimeImmutable object */ - public function subscriptionRefreshed(string $user, int $id = null): ?\DateTimeInterface { + public function subscriptionRefreshed(string $user, int $id = null): ?\DateTimeImmutable { if (!Arsse::$user->authorize($user, __FUNCTION__)) { throw new User\ExceptionAuthz("notAuthorized", ["action" => __FUNCTION__, "user" => $user]); } diff --git a/lib/Feed.php b/lib/Feed.php index 859bd06e..87e6016f 100644 --- a/lib/Feed.php +++ b/lib/Feed.php @@ -390,7 +390,7 @@ class Feed { return $offset; } - protected function computeLastModified(): ?\DateTimeInterface { + protected function computeLastModified(): ?\DateTimeImmutable { if (!$this->modified) { return $this->lastModified; // @codeCoverageIgnore } diff --git a/lib/Misc/Date.php b/lib/Misc/Date.php index 0b519dc4..6972ea5e 100644 --- a/lib/Misc/Date.php +++ b/lib/Misc/Date.php @@ -21,19 +21,19 @@ class Date { return $out; } - public static function normalize($date, string $inFormat = null): ?\DateTimeInterface { + public static function normalize($date, string $inFormat = null): ?\DateTimeImmutable { return ValueInfo::normalize($date, ValueInfo::T_DATE, $inFormat); } - public static function add($interval, $date = "now"): ?\DateTimeInterface { + public static function add($interval, $date = "now"): ?\DateTimeImmutable { return self::modify("add", $interval, $date); } - public static function sub($interval, $date = "now"): ?\DateTimeInterface { + public static function sub($interval, $date = "now"): ?\DateTimeImmutable { return self::modify("sub", $interval, $date); } - protected static function modify(string $func, $interval, $date): ?\DateTimeInterface { + protected static function modify(string $func, $interval, $date): ?\DateTimeImmutable { $date = self::normalize($date); $interval = (!$interval instanceof \DateInterval) ? ValueInfo::normalize($interval, ValueInfo::T_INTERVAL) : $interval; return $date ? $date->$func($interval) : null; diff --git a/tests/cases/CLI/TestCLI.php b/tests/cases/CLI/TestCLI.php index a350ce1e..6056912b 100644 --- a/tests/cases/CLI/TestCLI.php +++ b/tests/cases/CLI/TestCLI.php @@ -35,13 +35,13 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exitStatus, $cli->dispatch($argv)); } - public function testPrintVersion():void { + public function testPrintVersion(): void { $this->assertConsole($this->cli, "arsse.php --version", 0, Arsse::VERSION); \Phake::verify($this->cli, \Phake::times(0))->loadConf; } /** @dataProvider provideHelpText */ - public function testPrintHelp(string $cmd, string $name):void { + public function testPrintHelp(string $cmd, string $name): void { $this->assertConsole($this->cli, $cmd, 0, str_replace("arsse.php", $name, CLI::USAGE)); \Phake::verify($this->cli, \Phake::times(0))->loadConf; } @@ -57,7 +57,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testStartTheDaemon():void { + public function testStartTheDaemon(): void { $srv = \Phake::mock(Service::class); \Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable); \Phake::when($this->cli)->getInstance(Service::class)->thenReturn($srv); @@ -67,7 +67,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($this->cli)->getInstance(Service::class); } - public function testRefreshAllFeeds():void { + public function testRefreshAllFeeds(): void { $srv = \Phake::mock(Service::class); \Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable); \Phake::when($this->cli)->getInstance(Service::class)->thenReturn($srv); @@ -78,7 +78,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideFeedUpdates */ - public function testRefreshAFeed(string $cmd, int $exitStatus, string $output):void { + public function testRefreshAFeed(string $cmd, int $exitStatus, string $output): void { Arsse::$db = \Phake::mock(Database::class); \Phake::when(Arsse::$db)->feedUpdate(1, true)->thenReturn(true); \Phake::when(Arsse::$db)->feedUpdate(2, true)->thenThrow(new \JKingWeb\Arsse\Feed\Exception("http://example.com/", new \PicoFeed\Client\InvalidUrlException)); @@ -95,7 +95,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideDefaultConfigurationSaves */ - public function testSaveTheDefaultConfiguration(string $cmd, int $exitStatus, string $file):void { + public function testSaveTheDefaultConfiguration(string $cmd, int $exitStatus, string $file): void { $conf = \Phake::mock(Conf::class); \Phake::when($conf)->exportFile("php://output", true)->thenReturn(true); \Phake::when($conf)->exportFile("good.conf", true)->thenReturn(true); @@ -116,7 +116,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserList */ - public function testListUsers(string $cmd, array $list, int $exitStatus, string $output):void { + public function testListUsers(string $cmd, array $list, int $exitStatus, string $output): void { // FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead Arsse::$user = $this->createMock(User::class); Arsse::$user->method("list")->willReturn($list); @@ -135,7 +135,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserAdditions */ - public function testAddAUser(string $cmd, int $exitStatus, string $output):void { + public function testAddAUser(string $cmd, int $exitStatus, string $output): void { // FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead Arsse::$user = $this->createMock(User::class); Arsse::$user->method("add")->will($this->returnCallback(function($user, $pass = null) { @@ -158,7 +158,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserAuthentication */ - public function testAuthenticateAUser(string $cmd, int $exitStatus, string $output):void { + public function testAuthenticateAUser(string $cmd, int $exitStatus, string $output): void { // FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead Arsse::$user = $this->createMock(User::class); Arsse::$user->method("auth")->will($this->returnCallback(function($user, $pass) { @@ -192,7 +192,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserRemovals */ - public function testRemoveAUser(string $cmd, int $exitStatus, string $output):void { + public function testRemoveAUser(string $cmd, int $exitStatus, string $output): void { // FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead Arsse::$user = $this->createMock(User::class); Arsse::$user->method("remove")->will($this->returnCallback(function($user) { @@ -212,7 +212,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserPasswordChanges */ - public function testChangeAUserPassword(string $cmd, int $exitStatus, string $output):void { + public function testChangeAUserPassword(string $cmd, int $exitStatus, string $output): void { $passwordChange = function($user, $pass = null) { switch ($user) { case "jane.doe@example.com": @@ -242,7 +242,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserPasswordClearings */ - public function testClearAUserPassword(string $cmd, int $exitStatus, string $output):void { + public function testClearAUserPassword(string $cmd, int $exitStatus, string $output): void { $passwordClear = function($user) { switch ($user) { case "jane.doe@example.com": @@ -270,7 +270,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideOpmlExports */ - public function testExportToOpml(string $cmd, int $exitStatus, string $file, string $user, bool $flat):void { + public function testExportToOpml(string $cmd, int $exitStatus, string $file, string $user, bool $flat): void { $opml = \Phake::mock(OPML::class); \Phake::when($opml)->exportFile("php://output", $user, $flat)->thenReturn(true); \Phake::when($opml)->exportFile("good.opml", $user, $flat)->thenReturn(true); @@ -311,7 +311,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideOpmlImports */ - public function testImportFromOpml(string $cmd, int $exitStatus, string $file, string $user, bool $flat, bool $replace):void { + public function testImportFromOpml(string $cmd, int $exitStatus, string $file, string $user, bool $flat, bool $replace): void { $opml = \Phake::mock(OPML::class); \Phake::when($opml)->importFile("php://input", $user, $flat, $replace)->thenReturn(true); \Phake::when($opml)->importFile("good.opml", $user, $flat, $replace)->thenReturn(true); diff --git a/tests/cases/Conf/TestConf.php b/tests/cases/Conf/TestConf.php index d10d1d4c..67283338 100644 --- a/tests/cases/Conf/TestConf.php +++ b/tests/cases/Conf/TestConf.php @@ -38,12 +38,12 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testLoadDefaultValues():void { + public function testLoadDefaultValues(): void { $this->assertInstanceOf(Conf::class, new Conf); } /** @depends testLoadDefaultValues */ - public function testImportFromArray():void { + public function testImportFromArray(): void { $arr = [ 'lang' => "xx", 'purgeFeeds' => "P2D", @@ -54,7 +54,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { } /** @depends testImportFromArray */ - public function testImportFromFile():void { + public function testImportFromFile(): void { $conf = new Conf; $conf->importFile(self::$path."confGood"); $this->assertEquals("xx", $conf->lang); @@ -63,43 +63,43 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { } /** @depends testImportFromFile */ - public function testImportFromMissingFile():void { + public function testImportFromMissingFile(): void { $this->assertException("fileMissing", "Conf"); $conf = new Conf(self::$path."confMissing"); } /** @depends testImportFromFile */ - public function testImportFromEmptyFile():void { + public function testImportFromEmptyFile(): void { $this->assertException("fileCorrupt", "Conf"); $conf = new Conf(self::$path."confEmpty"); } /** @depends testImportFromFile */ - public function testImportFromFileWithoutReadPermission():void { + public function testImportFromFileWithoutReadPermission(): void { $this->assertException("fileUnreadable", "Conf"); $conf = new Conf(self::$path."confUnreadable"); } /** @depends testImportFromFile */ - public function testImportFromFileWhichIsNotAnArray():void { + public function testImportFromFileWhichIsNotAnArray(): void { $this->assertException("fileCorrupt", "Conf"); $conf = new Conf(self::$path."confNotArray"); } /** @depends testImportFromFile */ - public function testImportFromFileWhichIsNotPhp():void { + public function testImportFromFileWhichIsNotPhp(): void { $this->assertException("fileCorrupt", "Conf"); // this should not print the output of the non-PHP file $conf = new Conf(self::$path."confNotPHP"); } /** @depends testImportFromFile */ - public function testImportFromCorruptFile():void { + public function testImportFromCorruptFile(): void { $this->assertException("fileCorrupt", "Conf"); $conf = new Conf(self::$path."confCorrupt"); } - public function testImportBogusValue():void { + public function testImportBogusValue(): void { $arr = [ 'dbAutoUpdate' => "yes, please", ]; @@ -108,7 +108,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { $conf->import($arr); } - public function testImportBogusDriver():void { + public function testImportBogusDriver(): void { $arr = [ 'dbDriver' => "this driver does not exist", ]; @@ -117,7 +117,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { $conf->import($arr); } - public function testExportToArray():void { + public function testExportToArray(): void { $conf = new Conf; $conf->lang = ["en", "fr"]; // should not be exported: not scalar $conf->dbSQLite3File = "test.db"; // should be exported: value changed @@ -138,7 +138,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { /** @depends testExportToArray * @depends testImportFromFile */ - public function testExportToFile():void { + public function testExportToFile(): void { $conf = new Conf; $conf->lang = ["en", "fr"]; // should not be exported: not scalar $conf->dbSQLite3File = "test.db"; // should be exported: value changed @@ -159,19 +159,19 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { } /** @depends testExportToFile */ - public function testExportToStdout():void { + public function testExportToStdout(): void { $conf = new Conf(self::$path."confGood"); $conf->exportFile(self::$path."confGood"); $this->expectOutputString(file_get_contents(self::$path."confGood")); $conf->exportFile("php://output"); } - public function testExportToFileWithoutWritePermission():void { + public function testExportToFileWithoutWritePermission(): void { $this->assertException("fileUnwritable", "Conf"); (new Conf)->exportFile(self::$path."confUnreadable"); } - public function testExportToFileWithoutCreatePermission():void { + public function testExportToFileWithoutCreatePermission(): void { $this->assertException("fileUncreatable", "Conf"); (new Conf)->exportFile(self::$path."confForbidden/conf"); } diff --git a/tests/cases/Database/SeriesArticle.php b/tests/cases/Database/SeriesArticle.php index b560527c..13a5e930 100644 --- a/tests/cases/Database/SeriesArticle.php +++ b/tests/cases/Database/SeriesArticle.php @@ -13,7 +13,7 @@ use JKingWeb\Arsse\Misc\Date; use JKingWeb\Arsse\Misc\ValueInfo; trait SeriesArticle { - protected function setUpSeriesArticle():void { + protected function setUpSeriesArticle(): void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -408,12 +408,12 @@ trait SeriesArticle { $this->user = "john.doe@example.net"; } - protected function tearDownSeriesArticle():void { + protected function tearDownSeriesArticle(): void { unset($this->data, $this->matches, $this->fields, $this->checkTables, $this->user); } /** @dataProvider provideContextMatches */ - public function testListArticlesCheckingContext(Context $c, array $exp):void { + public function testListArticlesCheckingContext(Context $c, array $exp): void { $ids = array_column($ids = Arsse::$db->articleList("john.doe@example.com", $c, ["id"], ["id"])->getAll(), "id"); sort($ids); sort($exp); @@ -516,7 +516,7 @@ trait SeriesArticle { ]; } - public function testRetrieveArticleIdsForEditions():void { + public function testRetrieveArticleIdsForEditions(): void { $exp = [ 1 => 1, 2 => 2, @@ -553,17 +553,17 @@ trait SeriesArticle { $this->assertEquals($exp, Arsse::$db->editionArticle(...range(1, 1001))); } - public function testListArticlesOfAMissingFolder():void { + public function testListArticlesOfAMissingFolder(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->articleList($this->user, (new Context)->folder(1)); } - public function testListArticlesOfAMissingSubscription():void { + public function testListArticlesOfAMissingSubscription(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->articleList($this->user, (new Context)->subscription(1)); } - public function testListArticlesCheckingProperties():void { + public function testListArticlesCheckingProperties(): void { $this->user = "john.doe@example.org"; // check that the different fieldset groups return the expected columns foreach ($this->fields as $column) { @@ -577,7 +577,7 @@ trait SeriesArticle { } /** @dataProvider provideOrderedLists */ - public function testListArticlesCheckingOrder(array $sortCols, array $exp):void { + public function testListArticlesCheckingOrder(array $sortCols, array $exp): void { $act = ValueInfo::normalize(array_column(iterator_to_array(Arsse::$db->articleList("john.doe@example.com", null, ["id"], $sortCols)), "id"), ValueInfo::T_INT | ValueInfo::M_ARRAY); $this->assertSame($exp, $act); } @@ -595,17 +595,17 @@ trait SeriesArticle { ]; } - public function testListArticlesWithoutAuthority():void { + public function testListArticlesWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleList($this->user); } - public function testMarkNothing():void { + public function testMarkNothing(): void { $this->assertSame(0, Arsse::$db->articleMark($this->user, [])); } - public function testMarkAllArticlesUnread():void { + public function testMarkAllArticlesUnread(): void { Arsse::$db->articleMark($this->user, ['read'=>false]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -616,7 +616,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesRead():void { + public function testMarkAllArticlesRead(): void { Arsse::$db->articleMark($this->user, ['read'=>true]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -631,7 +631,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesUnstarred():void { + public function testMarkAllArticlesUnstarred(): void { Arsse::$db->articleMark($this->user, ['starred'=>false]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -642,7 +642,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesStarred():void { + public function testMarkAllArticlesStarred(): void { Arsse::$db->articleMark($this->user, ['starred'=>true]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -657,7 +657,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesUnreadAndUnstarred():void { + public function testMarkAllArticlesUnreadAndUnstarred(): void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>false]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -671,7 +671,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesReadAndStarred():void { + public function testMarkAllArticlesReadAndStarred(): void { Arsse::$db->articleMark($this->user, ['read'=>true,'starred'=>true]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -689,7 +689,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesUnreadAndStarred():void { + public function testMarkAllArticlesUnreadAndStarred(): void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -707,7 +707,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAllArticlesReadAndUnstarred():void { + public function testMarkAllArticlesReadAndUnstarred(): void { Arsse::$db->articleMark($this->user, ['read'=>true,'starred'=>false]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -725,7 +725,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testSetNoteForAllArticles():void { + public function testSetNoteForAllArticles(): void { Arsse::$db->articleMark($this->user, ['note'=>"New note"]); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -744,7 +744,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkATreeFolder():void { + public function testMarkATreeFolder(): void { Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(7)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -755,7 +755,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkALeafFolder():void { + public function testMarkALeafFolder(): void { Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(8)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -764,12 +764,12 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAMissingFolder():void { + public function testMarkAMissingFolder(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(42)); } - public function testMarkASubscription():void { + public function testMarkASubscription(): void { Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->subscription(13)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -778,12 +778,12 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAMissingSubscription():void { + public function testMarkAMissingSubscription(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(2112)); } - public function testMarkAnArticle():void { + public function testMarkAnArticle(): void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->article(20)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -792,7 +792,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleArticles():void { + public function testMarkMultipleArticles(): void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->articles([2,4,7,20])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -802,7 +802,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleArticlessUnreadAndStarred():void { + public function testMarkMultipleArticlessUnreadAndStarred(): void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true], (new Context)->articles([2,4,7,20])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -815,16 +815,16 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkTooManyMultipleArticles():void { + public function testMarkTooManyMultipleArticles(): void { $this->assertSame(7, Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true], (new Context)->articles(range(1, Database::LIMIT_SET_SIZE * 3)))); } - public function testMarkAMissingArticle():void { + public function testMarkAMissingArticle(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->article(1)); } - public function testMarkAnEdition():void { + public function testMarkAnEdition(): void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->edition(1001)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -833,7 +833,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleEditions():void { + public function testMarkMultipleEditions(): void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->editions([2,4,7,20])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -843,13 +843,13 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleMissingEditions():void { + public function testMarkMultipleMissingEditions(): void { $this->assertSame(0, Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->editions([500,501]))); $state = $this->primeExpectations($this->data, $this->checkTables); $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleEditionsUnread():void { + public function testMarkMultipleEditionsUnread(): void { Arsse::$db->articleMark($this->user, ['read'=>false], (new Context)->editions([2,4,7,1001])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -860,7 +860,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleEditionsUnreadWithStale():void { + public function testMarkMultipleEditionsUnreadWithStale(): void { Arsse::$db->articleMark($this->user, ['read'=>false], (new Context)->editions([2,4,7,20])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -869,7 +869,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkMultipleEditionsUnreadAndStarredWithStale():void { + public function testMarkMultipleEditionsUnreadAndStarredWithStale(): void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true], (new Context)->editions([2,4,7,20])); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -881,17 +881,17 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkTooManyMultipleEditions():void { + public function testMarkTooManyMultipleEditions(): void { $this->assertSame(7, Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true], (new Context)->editions(range(1, 51)))); } - public function testMarkAStaleEditionUnread():void { + public function testMarkAStaleEditionUnread(): void { Arsse::$db->articleMark($this->user, ['read'=>false], (new Context)->edition(20)); // no changes occur $state = $this->primeExpectations($this->data, $this->checkTables); $this->compareExpectations(static::$drv, $state); } - public function testMarkAStaleEditionStarred():void { + public function testMarkAStaleEditionStarred(): void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->edition(20)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -900,7 +900,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAStaleEditionUnreadAndStarred():void { + public function testMarkAStaleEditionUnreadAndStarred(): void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>true], (new Context)->edition(20)); // only starred is changed $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -909,18 +909,18 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkAStaleEditionUnreadAndUnstarred():void { + public function testMarkAStaleEditionUnreadAndUnstarred(): void { Arsse::$db->articleMark($this->user, ['read'=>false,'starred'=>false], (new Context)->edition(20)); // no changes occur $state = $this->primeExpectations($this->data, $this->checkTables); $this->compareExpectations(static::$drv, $state); } - public function testMarkAMissingEdition():void { + public function testMarkAMissingEdition(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->edition(2)); } - public function testMarkByOldestEdition():void { + public function testMarkByOldestEdition(): void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->oldestEdition(19)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -931,7 +931,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkByLatestEdition():void { + public function testMarkByLatestEdition(): void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->latestEdition(20)); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -944,7 +944,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkByLastMarked():void { + public function testMarkByLastMarked(): void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->markedSince('2017-01-01T00:00:00Z')); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -955,7 +955,7 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkByNotLastMarked():void { + public function testMarkByNotLastMarked(): void { Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->notMarkedSince('2000-01-01T00:00:00Z')); $now = Date::transform(time(), "sql"); $state = $this->primeExpectations($this->data, $this->checkTables); @@ -964,55 +964,55 @@ trait SeriesArticle { $this->compareExpectations(static::$drv, $state); } - public function testMarkArticlesWithoutAuthority():void { + public function testMarkArticlesWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleMark($this->user, ['read'=>false]); } - public function testCountArticles():void { + public function testCountArticles(): void { $this->assertSame(2, Arsse::$db->articleCount("john.doe@example.com", (new Context)->starred(true))); $this->assertSame(4, Arsse::$db->articleCount("john.doe@example.com", (new Context)->folder(1))); $this->assertSame(0, Arsse::$db->articleCount("jane.doe@example.com", (new Context)->starred(true))); $this->assertSame(10, Arsse::$db->articleCount("john.doe@example.com", (new Context)->articles(range(1, Database::LIMIT_SET_SIZE * 3)))); } - public function testCountArticlesWithoutAuthority():void { + public function testCountArticlesWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleCount($this->user); } - public function testFetchStarredCounts():void { + public function testFetchStarredCounts(): void { $exp1 = ['total' => 2, 'unread' => 1, 'read' => 1]; $exp2 = ['total' => 0, 'unread' => 0, 'read' => 0]; $this->assertEquals($exp1, Arsse::$db->articleStarred("john.doe@example.com")); $this->assertEquals($exp2, Arsse::$db->articleStarred("jane.doe@example.com")); } - public function testFetchStarredCountsWithoutAuthority():void { + public function testFetchStarredCountsWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleStarred($this->user); } - public function testFetchLatestEdition():void { + public function testFetchLatestEdition(): void { $this->assertSame(1001, Arsse::$db->editionLatest($this->user)); $this->assertSame(4, Arsse::$db->editionLatest($this->user, (new Context)->subscription(12))); } - public function testFetchLatestEditionOfMissingSubscription():void { + public function testFetchLatestEditionOfMissingSubscription(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->editionLatest($this->user, (new Context)->subscription(1)); } - public function testFetchLatestEditionWithoutAuthority():void { + public function testFetchLatestEditionWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->editionLatest($this->user); } - public function testListTheLabelsOfAnArticle():void { + public function testListTheLabelsOfAnArticle(): void { $this->assertEquals([1,2], Arsse::$db->articleLabelsGet("john.doe@example.com", 1)); $this->assertEquals([2], Arsse::$db->articleLabelsGet("john.doe@example.com", 5)); $this->assertEquals([], Arsse::$db->articleLabelsGet("john.doe@example.com", 2)); @@ -1021,18 +1021,18 @@ trait SeriesArticle { $this->assertEquals([], Arsse::$db->articleLabelsGet("john.doe@example.com", 2, true)); } - public function testListTheLabelsOfAMissingArticle():void { + public function testListTheLabelsOfAMissingArticle(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->articleLabelsGet($this->user, 101); } - public function testListTheLabelsOfAnArticleWithoutAuthority():void { + public function testListTheLabelsOfAnArticleWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleLabelsGet("john.doe@example.com", 1); } - public function testListTheCategoriesOfAnArticle():void { + public function testListTheCategoriesOfAnArticle(): void { $exp = ["Fascinating", "Logical"]; $this->assertSame($exp, Arsse::$db->articleCategoriesGet($this->user, 19)); $exp = ["Interesting", "Logical"]; @@ -1041,19 +1041,19 @@ trait SeriesArticle { $this->assertSame($exp, Arsse::$db->articleCategoriesGet($this->user, 4)); } - public function testListTheCategoriesOfAMissingArticle():void { + public function testListTheCategoriesOfAMissingArticle(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->articleCategoriesGet($this->user, 101); } - public function testListTheCategoriesOfAnArticleWithoutAuthority():void { + public function testListTheCategoriesOfAnArticleWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->articleCategoriesGet($this->user, 19); } /** @dataProvider provideArrayContextOptions */ - public function testUseTooFewValuesInArrayContext(string $option):void { + public function testUseTooFewValuesInArrayContext(string $option): void { $this->assertException("tooShort", "Db", "ExceptionInput"); Arsse::$db->articleList($this->user, (new Context)->$option([])); } diff --git a/tests/cases/Database/SeriesCleanup.php b/tests/cases/Database/SeriesCleanup.php index 7482243f..3a33f651 100644 --- a/tests/cases/Database/SeriesCleanup.php +++ b/tests/cases/Database/SeriesCleanup.php @@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\TestCase\Database; use JKingWeb\Arsse\Arsse; trait SeriesCleanup { - protected function setUpSeriesCleanup():void { + protected function setUpSeriesCleanup(): void { // set up the configuration Arsse::$conf->import([ 'userSessionTimeout' => "PT1H", @@ -147,11 +147,11 @@ trait SeriesCleanup { ]; } - protected function tearDownSeriesCleanup():void { + protected function tearDownSeriesCleanup(): void { unset($this->data); } - public function testCleanUpOrphanedFeeds():void { + public function testCleanUpOrphanedFeeds(): void { Arsse::$db->feedCleanup(); $now = gmdate("Y-m-d H:i:s"); $state = $this->primeExpectations($this->data, [ @@ -163,7 +163,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpOrphanedFeedsWithUnlimitedRetention():void { + public function testCleanUpOrphanedFeedsWithUnlimitedRetention(): void { Arsse::$conf->import([ 'purgeFeeds' => null, ]); @@ -177,7 +177,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpOldArticlesWithStandardRetention():void { + public function testCleanUpOldArticlesWithStandardRetention(): void { Arsse::$db->articleCleanup(); $state = $this->primeExpectations($this->data, [ 'arsse_articles' => ["id"] @@ -188,7 +188,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpOldArticlesWithUnlimitedReadRetention():void { + public function testCleanUpOldArticlesWithUnlimitedReadRetention(): void { Arsse::$conf->import([ 'purgeArticlesRead' => null, ]); @@ -202,7 +202,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpOldArticlesWithUnlimitedUnreadRetention():void { + public function testCleanUpOldArticlesWithUnlimitedUnreadRetention(): void { Arsse::$conf->import([ 'purgeArticlesUnread' => null, ]); @@ -216,7 +216,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpOldArticlesWithUnlimitedRetention():void { + public function testCleanUpOldArticlesWithUnlimitedRetention(): void { Arsse::$conf->import([ 'purgeArticlesRead' => null, 'purgeArticlesUnread' => null, @@ -228,7 +228,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpExpiredSessions():void { + public function testCleanUpExpiredSessions(): void { Arsse::$db->sessionCleanup(); $state = $this->primeExpectations($this->data, [ 'arsse_sessions' => ["id"] @@ -239,7 +239,7 @@ trait SeriesCleanup { $this->compareExpectations(static::$drv, $state); } - public function testCleanUpExpiredTokens():void { + public function testCleanUpExpiredTokens(): void { Arsse::$db->tokenCleanup(); $state = $this->primeExpectations($this->data, [ 'arsse_tokens' => ["id", "class"] diff --git a/tests/cases/Database/SeriesFeed.php b/tests/cases/Database/SeriesFeed.php index ce5e074e..ee19bb19 100644 --- a/tests/cases/Database/SeriesFeed.php +++ b/tests/cases/Database/SeriesFeed.php @@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\TestCase\Database; use JKingWeb\Arsse\Arsse; trait SeriesFeed { - protected function setUpSeriesFeed():void { + protected function setUpSeriesFeed(): void { // set up the test data $past = gmdate("Y-m-d H:i:s", strtotime("now - 1 minute")); $future = gmdate("Y-m-d H:i:s", strtotime("now + 1 minute")); @@ -160,15 +160,15 @@ trait SeriesFeed { ]; } - protected function tearDownSeriesFeed():void { + protected function tearDownSeriesFeed(): void { unset($this->data, $this->matches); } - public function testListLatestItems():void { + public function testListLatestItems(): void { $this->assertResult($this->matches, Arsse::$db->feedMatchLatest(1, 2)); } - public function testMatchItemsById():void { + public function testMatchItemsById(): void { $this->assertResult($this->matches, Arsse::$db->feedMatchIds(1, ['804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41'])); foreach ($this->matches as $m) { $exp = [$m]; @@ -179,7 +179,7 @@ trait SeriesFeed { $this->assertResult([['id' => 1]], Arsse::$db->feedMatchIds(1, ['e433653cef2e572eee4215fa299a4a5af9137b2cefd6283c85bd69a32915beda'])); // this ID appears in both feed 1 and feed 2; only one result should be returned } - public function testUpdateAFeed():void { + public function testUpdateAFeed(): void { // update a valid feed with both new and changed items Arsse::$db->feedUpdate(1); $now = gmdate("Y-m-d H:i:s"); @@ -219,22 +219,22 @@ trait SeriesFeed { $this->compareExpectations(static::$drv, $state); } - public function testUpdateAMissingFeed():void { + public function testUpdateAMissingFeed(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->feedUpdate(2112); } - public function testUpdateAnInvalidFeed():void { + public function testUpdateAnInvalidFeed(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->feedUpdate(-1); } - public function testUpdateAFeedThrowingExceptions():void { + public function testUpdateAFeedThrowingExceptions(): void { $this->assertException("invalidUrl", "Feed"); Arsse::$db->feedUpdate(3, true); } - public function testUpdateAFeedWithEnclosuresAndCategories():void { + public function testUpdateAFeedWithEnclosuresAndCategories(): void { Arsse::$db->feedUpdate(5); $state = $this->primeExpectations($this->data, [ 'arsse_enclosures' => ["url","type"], @@ -254,7 +254,7 @@ trait SeriesFeed { $this->compareExpectations(static::$drv, $state); } - public function testListStaleFeeds():void { + public function testListStaleFeeds(): void { $this->assertEquals([1,3,4], Arsse::$db->feedListStale()); Arsse::$db->feedUpdate(3); Arsse::$db->feedUpdate(4); diff --git a/tests/cases/Database/SeriesFolder.php b/tests/cases/Database/SeriesFolder.php index 9c73a3ea..bc1ae3a1 100644 --- a/tests/cases/Database/SeriesFolder.php +++ b/tests/cases/Database/SeriesFolder.php @@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\TestCase\Database; use JKingWeb\Arsse\Arsse; trait SeriesFolder { - protected function setUpSeriesFolder():void { + protected function setUpSeriesFolder(): void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -93,11 +93,11 @@ trait SeriesFolder { ]; } - protected function tearDownSeriesFolder():void { + protected function tearDownSeriesFolder(): void { unset($this->data); } - public function testAddARootFolder():void { + public function testAddARootFolder(): void { $user = "john.doe@example.com"; $folderID = $this->nextID("arsse_folders"); $this->assertSame($folderID, Arsse::$db->folderAdd($user, ['name' => "Entertainment"])); @@ -107,12 +107,12 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testAddADuplicateRootFolder():void { + public function testAddADuplicateRootFolder(): void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Politics"]); } - public function testAddANestedFolder():void { + public function testAddANestedFolder(): void { $user = "john.doe@example.com"; $folderID = $this->nextID("arsse_folders"); $this->assertSame($folderID, Arsse::$db->folderAdd($user, ['name' => "GNOME", 'parent' => 2])); @@ -122,43 +122,43 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testAddANestedFolderToAMissingParent():void { + public function testAddANestedFolderToAMissingParent(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => 2112]); } - public function testAddANestedFolderToAnInvalidParent():void { + public function testAddANestedFolderToAnInvalidParent(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => "stringFolderId"]); } - public function testAddANestedFolderForTheWrongOwner():void { + public function testAddANestedFolderForTheWrongOwner(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => 4]); // folder ID 4 belongs to Jane } - public function testAddAFolderWithAMissingName():void { + public function testAddAFolderWithAMissingName(): void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", []); } - public function testAddAFolderWithABlankName():void { + public function testAddAFolderWithABlankName(): void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => ""]); } - public function testAddAFolderWithAWhitespaceName():void { + public function testAddAFolderWithAWhitespaceName(): void { $this->assertException("whitespace", "Db", "ExceptionInput"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => " "]); } - public function testAddAFolderWithoutAuthority():void { + public function testAddAFolderWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology"]); } - public function testListRootFolders():void { + public function testListRootFolders(): void { $exp = [ ['id' => 5, 'name' => "Politics", 'parent' => null, 'children' => 0, 'feeds' => 2], ['id' => 1, 'name' => "Technology", 'parent' => null, 'children' => 2, 'feeds' => 1], @@ -175,7 +175,7 @@ trait SeriesFolder { \Phake::verify(Arsse::$user)->authorize("admin@example.net", "folderList"); } - public function testListFoldersRecursively():void { + public function testListFoldersRecursively(): void { $exp = [ ['id' => 5, 'name' => "Politics", 'parent' => null, 'children' => 0, 'feeds' => 2], ['id' => 6, 'name' => "Politics", 'parent' => 2, 'children' => 0, 'feeds' => 1], @@ -196,23 +196,23 @@ trait SeriesFolder { \Phake::verify(Arsse::$user)->authorize("jane.doe@example.com", "folderList"); } - public function testListFoldersOfAMissingParent():void { + public function testListFoldersOfAMissingParent(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderList("john.doe@example.com", 2112); } - public function testListFoldersOfTheWrongOwner():void { + public function testListFoldersOfTheWrongOwner(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderList("john.doe@example.com", 4); // folder ID 4 belongs to Jane } - public function testListFoldersWithoutAuthority():void { + public function testListFoldersWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->folderList("john.doe@example.com"); } - public function testRemoveAFolder():void { + public function testRemoveAFolder(): void { $this->assertTrue(Arsse::$db->folderRemove("john.doe@example.com", 6)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderRemove"); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); @@ -220,7 +220,7 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAFolderTree():void { + public function testRemoveAFolderTree(): void { $this->assertTrue(Arsse::$db->folderRemove("john.doe@example.com", 1)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderRemove"); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); @@ -230,28 +230,28 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAMissingFolder():void { + public function testRemoveAMissingFolder(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderRemove("john.doe@example.com", 2112); } - public function testRemoveAnInvalidFolder():void { + public function testRemoveAnInvalidFolder(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->folderRemove("john.doe@example.com", -1); } - public function testRemoveAFolderOfTheWrongOwner():void { + public function testRemoveAFolderOfTheWrongOwner(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderRemove("john.doe@example.com", 4); // folder ID 4 belongs to Jane } - public function testRemoveAFolderWithoutAuthority():void { + public function testRemoveAFolderWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->folderRemove("john.doe@example.com", 1); } - public function testGetThePropertiesOfAFolder():void { + public function testGetThePropertiesOfAFolder(): void { $exp = [ 'id' => 6, 'name' => "Politics", @@ -261,32 +261,32 @@ trait SeriesFolder { \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderPropertiesGet"); } - public function testGetThePropertiesOfAMissingFolder():void { + public function testGetThePropertiesOfAMissingFolder(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesGet("john.doe@example.com", 2112); } - public function testGetThePropertiesOfAnInvalidFolder():void { + public function testGetThePropertiesOfAnInvalidFolder(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesGet("john.doe@example.com", -1); } - public function testGetThePropertiesOfAFolderOfTheWrongOwner():void { + public function testGetThePropertiesOfAFolderOfTheWrongOwner(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesGet("john.doe@example.com", 4); // folder ID 4 belongs to Jane } - public function testGetThePropertiesOfAFolderWithoutAuthority():void { + public function testGetThePropertiesOfAFolderWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->folderPropertiesGet("john.doe@example.com", 1); } - public function testMakeNoChangesToAFolder():void { + public function testMakeNoChangesToAFolder(): void { $this->assertFalse(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, [])); } - public function testRenameAFolder():void { + public function testRenameAFolder(): void { $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => "Opinion"])); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderPropertiesSet"); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); @@ -294,26 +294,26 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testRenameTheRootFolder():void { + public function testRenameTheRootFolder(): void { $this->assertFalse(Arsse::$db->folderPropertiesSet("john.doe@example.com", null, ['name' => "Opinion"])); } - public function testRenameAFolderToTheEmptyString():void { + public function testRenameAFolderToTheEmptyString(): void { $this->assertException("missing", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => ""])); } - public function testRenameAFolderToWhitespaceOnly():void { + public function testRenameAFolderToWhitespaceOnly(): void { $this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => " "])); } - public function testRenameAFolderToAnInvalidValue():void { + public function testRenameAFolderToAnInvalidValue(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => []])); } - public function testMoveAFolder():void { + public function testMoveAFolder(): void { $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => 5])); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "folderPropertiesSet"); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); @@ -321,57 +321,57 @@ trait SeriesFolder { $this->compareExpectations(static::$drv, $state); } - public function testMoveTheRootFolder():void { + public function testMoveTheRootFolder(): void { $this->assertException("circularDependence", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 0, ['parent' => 1]); } - public function testMoveAFolderToItsDescendant():void { + public function testMoveAFolderToItsDescendant(): void { $this->assertException("circularDependence", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 3]); } - public function testMoveAFolderToItself():void { + public function testMoveAFolderToItself(): void { $this->assertException("circularDependence", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 1]); } - public function testMoveAFolderToAMissingParent():void { + public function testMoveAFolderToAMissingParent(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 2112]); } - public function testMoveAFolderToAnInvalidParent():void { + public function testMoveAFolderToAnInvalidParent(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => "ThisFolderDoesNotExist"]); } - public function testCauseAFolderCollision():void { + public function testCauseAFolderCollision(): void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => null]); } - public function testCauseACompoundFolderCollision():void { + public function testCauseACompoundFolderCollision(): void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 3, ['parent' => null, 'name' => "Technology"]); } - public function testSetThePropertiesOfAMissingFolder():void { + public function testSetThePropertiesOfAMissingFolder(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 2112, ['parent' => null]); } - public function testSetThePropertiesOfAnInvalidFolder():void { + public function testSetThePropertiesOfAnInvalidFolder(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", -1, ['parent' => null]); } - public function testSetThePropertiesOfAFolderForTheWrongOwner():void { + public function testSetThePropertiesOfAFolderForTheWrongOwner(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 4, ['parent' => null]); // folder ID 4 belongs to Jane } - public function testSetThePropertiesOfAFolderWithoutAuthority():void { + public function testSetThePropertiesOfAFolderWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => null]); diff --git a/tests/cases/Database/SeriesLabel.php b/tests/cases/Database/SeriesLabel.php index 0cf55ca8..74fdee47 100644 --- a/tests/cases/Database/SeriesLabel.php +++ b/tests/cases/Database/SeriesLabel.php @@ -11,7 +11,7 @@ use JKingWeb\Arsse\Database; use JKingWeb\Arsse\Context\Context; trait SeriesLabel { - protected function setUpSeriesLabel():void { + protected function setUpSeriesLabel(): void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -244,11 +244,11 @@ trait SeriesLabel { $this->user = "john.doe@example.com"; } - protected function tearDownSeriesLabel():void { + protected function tearDownSeriesLabel(): void { unset($this->data, $this->checkLabels, $this->checkMembers, $this->user); } - public function testAddALabel():void { + public function testAddALabel(): void { $user = "john.doe@example.com"; $labelID = $this->nextID("arsse_labels"); $this->assertSame($labelID, Arsse::$db->labelAdd($user, ['name' => "Entertaining"])); @@ -258,33 +258,33 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testAddADuplicateLabel():void { + public function testAddADuplicateLabel(): void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->labelAdd("john.doe@example.com", ['name' => "Interesting"]); } - public function testAddALabelWithAMissingName():void { + public function testAddALabelWithAMissingName(): void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->labelAdd("john.doe@example.com", []); } - public function testAddALabelWithABlankName():void { + public function testAddALabelWithABlankName(): void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->labelAdd("john.doe@example.com", ['name' => ""]); } - public function testAddALabelWithAWhitespaceName():void { + public function testAddALabelWithAWhitespaceName(): void { $this->assertException("whitespace", "Db", "ExceptionInput"); Arsse::$db->labelAdd("john.doe@example.com", ['name' => " "]); } - public function testAddALabelWithoutAuthority():void { + public function testAddALabelWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelAdd("john.doe@example.com", ['name' => "Boring"]); } - public function testListLabels():void { + public function testListLabels(): void { $exp = [ ['id' => 2, 'name' => "Fascinating", 'articles' => 3, 'read' => 1], ['id' => 1, 'name' => "Interesting", 'articles' => 2, 'read' => 2], @@ -300,13 +300,13 @@ trait SeriesLabel { \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "labelList"); } - public function testListLabelsWithoutAuthority():void { + public function testListLabelsWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelList("john.doe@example.com"); } - public function testRemoveALabel():void { + public function testRemoveALabel(): void { $this->assertTrue(Arsse::$db->labelRemove("john.doe@example.com", 1)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "labelRemove"); $state = $this->primeExpectations($this->data, $this->checkLabels); @@ -314,7 +314,7 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testRemoveALabelByName():void { + public function testRemoveALabelByName(): void { $this->assertTrue(Arsse::$db->labelRemove("john.doe@example.com", "Interesting", true)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "labelRemove"); $state = $this->primeExpectations($this->data, $this->checkLabels); @@ -322,33 +322,33 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAMissingLabel():void { + public function testRemoveAMissingLabel(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelRemove("john.doe@example.com", 2112); } - public function testRemoveAnInvalidLabel():void { + public function testRemoveAnInvalidLabel(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelRemove("john.doe@example.com", -1); } - public function testRemoveAnInvalidLabelByName():void { + public function testRemoveAnInvalidLabelByName(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelRemove("john.doe@example.com", [], true); } - public function testRemoveALabelOfTheWrongOwner():void { + public function testRemoveALabelOfTheWrongOwner(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelRemove("john.doe@example.com", 3); // label ID 3 belongs to Jane } - public function testRemoveALabelWithoutAuthority():void { + public function testRemoveALabelWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelRemove("john.doe@example.com", 1); } - public function testGetThePropertiesOfALabel():void { + public function testGetThePropertiesOfALabel(): void { $exp = [ 'id' => 2, 'name' => "Fascinating", @@ -360,37 +360,37 @@ trait SeriesLabel { \Phake::verify(Arsse::$user, \Phake::times(2))->authorize("john.doe@example.com", "labelPropertiesGet"); } - public function testGetThePropertiesOfAMissingLabel():void { + public function testGetThePropertiesOfAMissingLabel(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesGet("john.doe@example.com", 2112); } - public function testGetThePropertiesOfAnInvalidLabel():void { + public function testGetThePropertiesOfAnInvalidLabel(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesGet("john.doe@example.com", -1); } - public function testGetThePropertiesOfAnInvalidLabelByName():void { + public function testGetThePropertiesOfAnInvalidLabelByName(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesGet("john.doe@example.com", [], true); } - public function testGetThePropertiesOfALabelOfTheWrongOwner():void { + public function testGetThePropertiesOfALabelOfTheWrongOwner(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesGet("john.doe@example.com", 3); // label ID 3 belongs to Jane } - public function testGetThePropertiesOfALabelWithoutAuthority():void { + public function testGetThePropertiesOfALabelWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelPropertiesGet("john.doe@example.com", 1); } - public function testMakeNoChangesToALabel():void { + public function testMakeNoChangesToALabel(): void { $this->assertFalse(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, [])); } - public function testRenameALabel():void { + public function testRenameALabel(): void { $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Curious"])); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "labelPropertiesSet"); $state = $this->primeExpectations($this->data, $this->checkLabels); @@ -398,7 +398,7 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testRenameALabelByName():void { + public function testRenameALabelByName(): void { $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", "Interesting", ['name' => "Curious"], true)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "labelPropertiesSet"); $state = $this->primeExpectations($this->data, $this->checkLabels); @@ -406,53 +406,53 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testRenameALabelToTheEmptyString():void { + public function testRenameALabelToTheEmptyString(): void { $this->assertException("missing", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => ""])); } - public function testRenameALabelToWhitespaceOnly():void { + public function testRenameALabelToWhitespaceOnly(): void { $this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => " "])); } - public function testRenameALabelToAnInvalidValue():void { + public function testRenameALabelToAnInvalidValue(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => []])); } - public function testCauseALabelCollision():void { + public function testCauseALabelCollision(): void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Fascinating"]); } - public function testSetThePropertiesOfAMissingLabel():void { + public function testSetThePropertiesOfAMissingLabel(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesSet("john.doe@example.com", 2112, ['name' => "Exciting"]); } - public function testSetThePropertiesOfAnInvalidLabel():void { + public function testSetThePropertiesOfAnInvalidLabel(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesSet("john.doe@example.com", -1, ['name' => "Exciting"]); } - public function testSetThePropertiesOfAnInvalidLabelByName():void { + public function testSetThePropertiesOfAnInvalidLabelByName(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesSet("john.doe@example.com", [], ['name' => "Exciting"], true); } - public function testSetThePropertiesOfALabelForTheWrongOwner():void { + public function testSetThePropertiesOfALabelForTheWrongOwner(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelPropertiesSet("john.doe@example.com", 3, ['name' => "Exciting"]); // label ID 3 belongs to Jane } - public function testSetThePropertiesOfALabelWithoutAuthority():void { + public function testSetThePropertiesOfALabelWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Exciting"]); } - public function testListLabelledArticles():void { + public function testListLabelledArticles(): void { $exp = [1,19]; $this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", 1)); $this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", "Interesting", true)); @@ -464,23 +464,23 @@ trait SeriesLabel { $this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", "Lonely", true)); } - public function testListLabelledArticlesForAMissingLabel():void { + public function testListLabelledArticlesForAMissingLabel(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->labelArticlesGet("john.doe@example.com", 3); } - public function testListLabelledArticlesForAnInvalidLabel():void { + public function testListLabelledArticlesForAnInvalidLabel(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->labelArticlesGet("john.doe@example.com", -1); } - public function testListLabelledArticlesWithoutAuthority():void { + public function testListLabelledArticlesWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelArticlesGet("john.doe@example.com", 1); } - public function testApplyALabelToArticles():void { + public function testApplyALabelToArticles(): void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5])); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][4][3] = 1; @@ -488,14 +488,14 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testClearALabelFromArticles():void { + public function testClearALabelFromArticles(): void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([1,5]), Database::ASSOC_REMOVE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][0][3] = 0; $this->compareExpectations(static::$drv, $state); } - public function testApplyALabelToArticlesByName():void { + public function testApplyALabelToArticlesByName(): void { Arsse::$db->labelArticlesSet("john.doe@example.com", "Interesting", (new Context)->articles([2,5]), Database::ASSOC_ADD, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][4][3] = 1; @@ -503,26 +503,26 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testClearALabelFromArticlesByName():void { + public function testClearALabelFromArticlesByName(): void { Arsse::$db->labelArticlesSet("john.doe@example.com", "Interesting", (new Context)->articles([1,5]), Database::ASSOC_REMOVE, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][0][3] = 0; $this->compareExpectations(static::$drv, $state); } - public function testApplyALabelToNoArticles():void { + public function testApplyALabelToNoArticles(): void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000])); $state = $this->primeExpectations($this->data, $this->checkMembers); $this->compareExpectations(static::$drv, $state); } - public function testClearALabelFromNoArticles():void { + public function testClearALabelFromNoArticles(): void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]), Database::ASSOC_REMOVE); $state = $this->primeExpectations($this->data, $this->checkMembers); $this->compareExpectations(static::$drv, $state); } - public function testReplaceArticlesOfALabel():void { + public function testReplaceArticlesOfALabel(): void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5]), Database::ASSOC_REPLACE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][0][3] = 0; @@ -532,7 +532,7 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testPurgeArticlesOfALabel():void { + public function testPurgeArticlesOfALabel(): void { Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]), Database::ASSOC_REPLACE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_label_members']['rows'][0][3] = 0; @@ -540,7 +540,7 @@ trait SeriesLabel { $this->compareExpectations(static::$drv, $state); } - public function testApplyALabelToArticlesWithoutAuthority():void { + public function testApplyALabelToArticlesWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5])); diff --git a/tests/cases/Database/SeriesMeta.php b/tests/cases/Database/SeriesMeta.php index 2a617c6f..b1d19743 100644 --- a/tests/cases/Database/SeriesMeta.php +++ b/tests/cases/Database/SeriesMeta.php @@ -10,7 +10,7 @@ use JKingWeb\Arsse\Test\Database; use JKingWeb\Arsse\Arsse; trait SeriesMeta { - protected function setUpSeriesMeta():void { + protected function setUpSeriesMeta(): void { $dataBare = [ 'arsse_meta' => [ 'columns' => [ @@ -31,18 +31,18 @@ trait SeriesMeta { $this->primeDatabase(static::$drv, $dataBare); } - protected function tearDownSeriesMeta():void { + protected function tearDownSeriesMeta(): void { unset($this->data); } - public function testAddANewValue():void { + public function testAddANewValue(): void { $this->assertTrue(Arsse::$db->metaSet("favourite", "Cygnus X-1")); $state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]); $state['arsse_meta']['rows'][] = ["favourite","Cygnus X-1"]; $this->compareExpectations(static::$drv, $state); } - public function testAddANewTypedValue():void { + public function testAddANewTypedValue(): void { $this->assertTrue(Arsse::$db->metaSet("answer", 42, "int")); $this->assertTrue(Arsse::$db->metaSet("true", true, "bool")); $this->assertTrue(Arsse::$db->metaSet("false", false, "bool")); @@ -55,14 +55,14 @@ trait SeriesMeta { $this->compareExpectations(static::$drv, $state); } - public function testChangeAnExistingValue():void { + public function testChangeAnExistingValue(): void { $this->assertTrue(Arsse::$db->metaSet("album", "Hemispheres")); $state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]); $state['arsse_meta']['rows'][1][1] = "Hemispheres"; $this->compareExpectations(static::$drv, $state); } - public function testRemoveAValue():void { + public function testRemoveAValue(): void { $this->assertTrue(Arsse::$db->metaRemove("album")); $this->assertFalse(Arsse::$db->metaRemove("album")); $state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]); @@ -70,7 +70,7 @@ trait SeriesMeta { $this->compareExpectations(static::$drv, $state); } - public function testRetrieveAValue():void { + public function testRetrieveAValue(): void { $this->assertSame("".Database::SCHEMA_VERSION, Arsse::$db->metaGet("schema_version")); $this->assertSame("A Farewell to Kings", Arsse::$db->metaGet("album")); $this->assertSame(null, Arsse::$db->metaGet("this_key_does_not_exist")); diff --git a/tests/cases/Database/SeriesMiscellany.php b/tests/cases/Database/SeriesMiscellany.php index 03009eff..5bc1092b 100644 --- a/tests/cases/Database/SeriesMiscellany.php +++ b/tests/cases/Database/SeriesMiscellany.php @@ -10,22 +10,22 @@ use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\Database; trait SeriesMiscellany { - protected function setUpSeriesMiscellany():void { + protected function setUpSeriesMiscellany(): void { static::setConf([ 'dbDriver' => static::$dbDriverClass, ]); } - protected function tearDownSeriesMiscellany():void { + protected function tearDownSeriesMiscellany(): void { } - public function testInitializeDatabase():void { + public function testInitializeDatabase(): void { static::dbRaze(static::$drv); $d = new Database(true); $this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion()); } - public function testManuallyInitializeDatabase():void { + public function testManuallyInitializeDatabase(): void { static::dbRaze(static::$drv); $d = new Database(false); $this->assertSame(0, $d->driverSchemaVersion()); @@ -34,11 +34,11 @@ trait SeriesMiscellany { $this->assertFalse($d->driverSchemaUpdate()); } - public function testCheckCharacterSetAcceptability():void { + public function testCheckCharacterSetAcceptability(): void { $this->assertIsBool(Arsse::$db->driverCharsetAcceptable()); } - public function testPerformMaintenance():void { + public function testPerformMaintenance(): void { $this->assertTrue(Arsse::$db->driverMaintenance()); } } diff --git a/tests/cases/Database/SeriesSession.php b/tests/cases/Database/SeriesSession.php index 7e5b7c4a..f3a84b6f 100644 --- a/tests/cases/Database/SeriesSession.php +++ b/tests/cases/Database/SeriesSession.php @@ -10,7 +10,7 @@ use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\Misc\Date; trait SeriesSession { - protected function setUpSeriesSession():void { + protected function setUpSeriesSession(): void { // set up the configuration static::setConf([ 'userSessionTimeout' => "PT1H", @@ -49,11 +49,11 @@ trait SeriesSession { ]; } - protected function tearDownSeriesSession():void { + protected function tearDownSeriesSession(): void { unset($this->data); } - public function testResumeAValidSession():void { + public function testResumeAValidSession(): void { $exp1 = [ 'id' => "80fa94c1a11f11e78667001e673b2560", 'user' => "jane.doe@example.com" @@ -74,22 +74,22 @@ trait SeriesSession { $this->assertArraySubset($exp1, Arsse::$db->sessionResume("80fa94c1a11f11e78667001e673b2560")); } - public function testResumeAMissingSession():void { + public function testResumeAMissingSession(): void { $this->assertException("invalid", "User", "ExceptionSession"); Arsse::$db->sessionResume("thisSessionDoesNotExist"); } - public function testResumeAnExpiredSession():void { + public function testResumeAnExpiredSession(): void { $this->assertException("invalid", "User", "ExceptionSession"); Arsse::$db->sessionResume("27c6de8da13311e78667001e673b2560"); } - public function testResumeAStaleSession():void { + public function testResumeAStaleSession(): void { $this->assertException("invalid", "User", "ExceptionSession"); Arsse::$db->sessionResume("ab3b3eb8a13311e78667001e673b2560"); } - public function testCreateASession():void { + public function testCreateASession(): void { $user = "jane.doe@example.com"; $id = Arsse::$db->sessionCreate($user); $now = time(); @@ -98,13 +98,13 @@ trait SeriesSession { $this->compareExpectations(static::$drv, $state); } - public function testCreateASessionWithoutAuthority():void { + public function testCreateASessionWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->sessionCreate("jane.doe@example.com"); } - public function testDestroyASession():void { + public function testDestroyASession(): void { $user = "jane.doe@example.com"; $id = "80fa94c1a11f11e78667001e673b2560"; $this->assertTrue(Arsse::$db->sessionDestroy($user, $id)); @@ -115,7 +115,7 @@ trait SeriesSession { $this->assertFalse(Arsse::$db->sessionDestroy($user, $id)); } - public function testDestroyAllSessions():void { + public function testDestroyAllSessions(): void { $user = "jane.doe@example.com"; $this->assertTrue(Arsse::$db->sessionDestroy($user)); $state = $this->primeExpectations($this->data, ['arsse_sessions' => ["id", "created", "expires", "user"]]); @@ -125,13 +125,13 @@ trait SeriesSession { $this->compareExpectations(static::$drv, $state); } - public function testDestroyASessionForTheWrongUser():void { + public function testDestroyASessionForTheWrongUser(): void { $user = "john.doe@example.com"; $id = "80fa94c1a11f11e78667001e673b2560"; $this->assertFalse(Arsse::$db->sessionDestroy($user, $id)); } - public function testDestroyASessionWithoutAuthority():void { + public function testDestroyASessionWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->sessionDestroy("jane.doe@example.com", "80fa94c1a11f11e78667001e673b2560"); diff --git a/tests/cases/Database/SeriesSubscription.php b/tests/cases/Database/SeriesSubscription.php index 8f6f3043..434427e5 100644 --- a/tests/cases/Database/SeriesSubscription.php +++ b/tests/cases/Database/SeriesSubscription.php @@ -11,7 +11,7 @@ use JKingWeb\Arsse\Test\Database; use JKingWeb\Arsse\Feed\Exception as FeedException; trait SeriesSubscription { - public function setUpSeriesSubscription():void { + public function setUpSeriesSubscription(): void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -143,11 +143,11 @@ trait SeriesSubscription { $this->user = "john.doe@example.com"; } - protected function tearDownSeriesSubscription():void { + protected function tearDownSeriesSubscription(): void { unset($this->data, $this->user); } - public function testAddASubscriptionToAnExistingFeed():void { + public function testAddASubscriptionToAnExistingFeed(): void { $url = "http://example.com/feed1"; $subID = $this->nextID("arsse_subscriptions"); \Phake::when(Arsse::$db)->feedUpdate->thenReturn(true); @@ -162,7 +162,7 @@ trait SeriesSubscription { $this->compareExpectations(static::$drv, $state); } - public function testAddASubscriptionToANewFeed():void { + public function testAddASubscriptionToANewFeed(): void { $url = "http://example.org/feed1"; $feedID = $this->nextID("arsse_feeds"); $subID = $this->nextID("arsse_subscriptions"); @@ -179,7 +179,7 @@ trait SeriesSubscription { $this->compareExpectations(static::$drv, $state); } - public function testAddASubscriptionToANewFeedViaDiscovery():void { + public function testAddASubscriptionToANewFeedViaDiscovery(): void { $url = "http://localhost:8000/Feed/Discovery/Valid"; $discovered = "http://localhost:8000/Feed/Discovery/Feed"; $feedID = $this->nextID("arsse_feeds"); @@ -197,7 +197,7 @@ trait SeriesSubscription { $this->compareExpectations(static::$drv, $state); } - public function testAddASubscriptionToAnInvalidFeed():void { + public function testAddASubscriptionToAnInvalidFeed(): void { $url = "http://example.org/feed1"; $feedID = $this->nextID("arsse_feeds"); \Phake::when(Arsse::$db)->feedUpdate->thenThrow(new FeedException($url, new \PicoFeed\Client\InvalidUrlException())); @@ -215,19 +215,19 @@ trait SeriesSubscription { } } - public function testAddADuplicateSubscription():void { + public function testAddADuplicateSubscription(): void { $url = "http://example.com/feed2"; $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionAdd($this->user, $url); } - public function testAddADuplicateSubscriptionWithEquivalentUrl():void { + public function testAddADuplicateSubscriptionWithEquivalentUrl(): void { $url = "http://EXAMPLE.COM/feed2"; $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionAdd($this->user, $url); } - public function testAddADuplicateSubscriptionViaRedirection():void { + public function testAddADuplicateSubscriptionViaRedirection(): void { $url = "http://localhost:8000/Feed/Parsing/Valid"; Arsse::$db->subscriptionAdd($this->user, $url); $subID = $this->nextID("arsse_subscriptions"); @@ -235,14 +235,14 @@ trait SeriesSubscription { $this->assertSame($subID, Arsse::$db->subscriptionAdd($this->user, $url)); } - public function testAddASubscriptionWithoutAuthority():void { + public function testAddASubscriptionWithoutAuthority(): void { $url = "http://example.com/feed1"; \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionAdd($this->user, $url); } - public function testRemoveASubscription():void { + public function testRemoveASubscription(): void { $this->assertTrue(Arsse::$db->subscriptionRemove($this->user, 1)); \Phake::verify(Arsse::$user)->authorize($this->user, "subscriptionRemove"); $state = $this->primeExpectations($this->data, [ @@ -253,29 +253,29 @@ trait SeriesSubscription { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAMissingSubscription():void { + public function testRemoveAMissingSubscription(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionRemove($this->user, 2112); } - public function testRemoveAnInvalidSubscription():void { + public function testRemoveAnInvalidSubscription(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionRemove($this->user, -1); } - public function testRemoveASubscriptionForTheWrongOwner():void { + public function testRemoveASubscriptionForTheWrongOwner(): void { $this->user = "jane.doe@example.com"; $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionRemove($this->user, 1); } - public function testRemoveASubscriptionWithoutAuthority():void { + public function testRemoveASubscriptionWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionRemove($this->user, 1); } - public function testListSubscriptions():void { + public function testListSubscriptions(): void { $exp = [ [ 'url' => "http://example.com/feed2", @@ -303,7 +303,7 @@ trait SeriesSubscription { $this->assertArraySubset($exp[1], Arsse::$db->subscriptionPropertiesGet($this->user, 3)); } - public function testListSubscriptionsInAFolder():void { + public function testListSubscriptionsInAFolder(): void { $exp = [ [ 'url' => "http://example.com/feed2", @@ -318,7 +318,7 @@ trait SeriesSubscription { $this->assertResult($exp, Arsse::$db->subscriptionList($this->user, null, false)); } - public function testListSubscriptionsWithoutRecursion():void { + public function testListSubscriptionsWithoutRecursion(): void { $exp = [ [ 'url' => "http://example.com/feed3", @@ -333,50 +333,50 @@ trait SeriesSubscription { $this->assertResult($exp, Arsse::$db->subscriptionList($this->user, 2)); } - public function testListSubscriptionsInAMissingFolder():void { + public function testListSubscriptionsInAMissingFolder(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionList($this->user, 4); } - public function testListSubscriptionsWithoutAuthority():void { + public function testListSubscriptionsWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionList($this->user); } - public function testCountSubscriptions():void { + public function testCountSubscriptions(): void { $this->assertSame(2, Arsse::$db->subscriptionCount($this->user)); $this->assertSame(1, Arsse::$db->subscriptionCount($this->user, 2)); } - public function testCountSubscriptionsInAMissingFolder():void { + public function testCountSubscriptionsInAMissingFolder(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionCount($this->user, 4); } - public function testCountSubscriptionsWithoutAuthority():void { + public function testCountSubscriptionsWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionCount($this->user); } - public function testGetThePropertiesOfAMissingSubscription():void { + public function testGetThePropertiesOfAMissingSubscription(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesGet($this->user, 2112); } - public function testGetThePropertiesOfAnInvalidSubscription():void { + public function testGetThePropertiesOfAnInvalidSubscription(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesGet($this->user, -1); } - public function testGetThePropertiesOfASubscriptionWithoutAuthority():void { + public function testGetThePropertiesOfASubscriptionWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionPropertiesGet($this->user, 1); } - public function testSetThePropertiesOfASubscription():void { + public function testSetThePropertiesOfASubscription(): void { Arsse::$db->subscriptionPropertiesSet($this->user, 1, [ 'title' => "Ook Ook", 'folder' => 3, @@ -400,56 +400,56 @@ trait SeriesSubscription { $this->compareExpectations(static::$drv, $state); } - public function testMoveASubscriptionToAMissingFolder():void { + public function testMoveASubscriptionToAMissingFolder(): void { $this->assertException("idMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['folder' => 4]); } - public function testMoveASubscriptionToTheRootFolder():void { + public function testMoveASubscriptionToTheRootFolder(): void { $this->assertTrue(Arsse::$db->subscriptionPropertiesSet($this->user, 3, ['folder' => null])); } - public function testRenameASubscriptionToABlankTitle():void { + public function testRenameASubscriptionToABlankTitle(): void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => ""]); } - public function testRenameASubscriptionToAWhitespaceTitle():void { + public function testRenameASubscriptionToAWhitespaceTitle(): void { $this->assertException("whitespace", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => " "]); } - public function testRenameASubscriptionToFalse():void { + public function testRenameASubscriptionToFalse(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => false]); } - public function testRenameASubscriptionToZero():void { + public function testRenameASubscriptionToZero(): void { $this->assertTrue(Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => 0])); } - public function testRenameASubscriptionToAnArray():void { + public function testRenameASubscriptionToAnArray(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => []]); } - public function testSetThePropertiesOfAMissingSubscription():void { + public function testSetThePropertiesOfAMissingSubscription(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, 2112, ['folder' => null]); } - public function testSetThePropertiesOfAnInvalidSubscription():void { + public function testSetThePropertiesOfAnInvalidSubscription(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->subscriptionPropertiesSet($this->user, -1, ['folder' => null]); } - public function testSetThePropertiesOfASubscriptionWithoutAuthority():void { + public function testSetThePropertiesOfASubscriptionWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['folder' => null]); } - public function testRetrieveTheFaviconOfASubscription():void { + public function testRetrieveTheFaviconOfASubscription(): void { $exp = "http://example.com/favicon.ico"; $this->assertSame($exp, Arsse::$db->subscriptionFavicon(1)); $this->assertSame($exp, Arsse::$db->subscriptionFavicon(2)); @@ -465,7 +465,7 @@ trait SeriesSubscription { $this->assertSame('', Arsse::$db->subscriptionFavicon(-2112)); } - public function testRetrieveTheFaviconOfASubscriptionWithUser():void { + public function testRetrieveTheFaviconOfASubscriptionWithUser(): void { $exp = "http://example.com/favicon.ico"; $user = "john.doe@example.com"; $this->assertSame($exp, Arsse::$db->subscriptionFavicon(1, $user)); @@ -479,7 +479,7 @@ trait SeriesSubscription { $this->assertSame('', Arsse::$db->subscriptionFavicon(4, $user)); } - public function testRetrieveTheFaviconOfASubscriptionWithUserWithoutAuthority():void { + public function testRetrieveTheFaviconOfASubscriptionWithUserWithoutAuthority(): void { $exp = "http://example.com/favicon.ico"; $user = "john.doe@example.com"; \Phake::when(Arsse::$user)->authorize->thenReturn(false); @@ -487,36 +487,36 @@ trait SeriesSubscription { Arsse::$db->subscriptionFavicon(-2112, $user); } - public function testListTheTagsOfASubscription():void { + public function testListTheTagsOfASubscription(): void { $this->assertEquals([1,2], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 1)); $this->assertEquals([2], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 3)); $this->assertEquals(["Fascinating","Interesting"], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 1, true)); $this->assertEquals(["Fascinating"], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 3, true)); } - public function testListTheTagsOfAMissingSubscription():void { + public function testListTheTagsOfAMissingSubscription(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->subscriptionTagsGet($this->user, 101); } - public function testListTheTagsOfASubscriptionWithoutAuthority():void { + public function testListTheTagsOfASubscriptionWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->subscriptionTagsGet("john.doe@example.com", 1); } - public function testGetRefreshTimeOfASubscription():void { + public function testGetRefreshTimeOfASubscription(): void { $user = "john.doe@example.com"; $this->assertTime(strtotime("now + 1 hour"), Arsse::$db->subscriptionRefreshed($user)); $this->assertTime(strtotime("now - 1 hour"), Arsse::$db->subscriptionRefreshed($user, 1)); } - public function testGetRefreshTimeOfAMissingSubscription():void { + public function testGetRefreshTimeOfAMissingSubscription(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertTime(strtotime("now - 1 hour"), Arsse::$db->subscriptionRefreshed("john.doe@example.com", 2)); } - public function testGetRefreshTimeOfASubscriptionWithoutAuthority():void { + public function testGetRefreshTimeOfASubscriptionWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); $this->assertTime(strtotime("now + 1 hour"), Arsse::$db->subscriptionRefreshed("john.doe@example.com")); diff --git a/tests/cases/Database/SeriesTag.php b/tests/cases/Database/SeriesTag.php index f2617c45..07b99fd6 100644 --- a/tests/cases/Database/SeriesTag.php +++ b/tests/cases/Database/SeriesTag.php @@ -10,7 +10,7 @@ use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\Database; trait SeriesTag { - protected function setUpSeriesTag():void { + protected function setUpSeriesTag(): void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -104,11 +104,11 @@ trait SeriesTag { $this->user = "john.doe@example.com"; } - protected function tearDownSeriesTag():void { + protected function tearDownSeriesTag(): void { unset($this->data, $this->checkTags, $this->checkMembers, $this->user); } - public function testAddATag():void { + public function testAddATag(): void { $user = "john.doe@example.com"; $tagID = $this->nextID("arsse_tags"); $this->assertSame($tagID, Arsse::$db->tagAdd($user, ['name' => "Entertaining"])); @@ -118,33 +118,33 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testAddADuplicateTag():void { + public function testAddADuplicateTag(): void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->tagAdd("john.doe@example.com", ['name' => "Interesting"]); } - public function testAddATagWithAMissingName():void { + public function testAddATagWithAMissingName(): void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->tagAdd("john.doe@example.com", []); } - public function testAddATagWithABlankName():void { + public function testAddATagWithABlankName(): void { $this->assertException("missing", "Db", "ExceptionInput"); Arsse::$db->tagAdd("john.doe@example.com", ['name' => ""]); } - public function testAddATagWithAWhitespaceName():void { + public function testAddATagWithAWhitespaceName(): void { $this->assertException("whitespace", "Db", "ExceptionInput"); Arsse::$db->tagAdd("john.doe@example.com", ['name' => " "]); } - public function testAddATagWithoutAuthority():void { + public function testAddATagWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagAdd("john.doe@example.com", ['name' => "Boring"]); } - public function testListTags():void { + public function testListTags(): void { $exp = [ ['id' => 2, 'name' => "Fascinating"], ['id' => 1, 'name' => "Interesting"], @@ -160,13 +160,13 @@ trait SeriesTag { \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "tagList"); } - public function testListTagsWithoutAuthority():void { + public function testListTagsWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagList("john.doe@example.com"); } - public function testRemoveATag():void { + public function testRemoveATag(): void { $this->assertTrue(Arsse::$db->tagRemove("john.doe@example.com", 1)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "tagRemove"); $state = $this->primeExpectations($this->data, $this->checkTags); @@ -174,7 +174,7 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testRemoveATagByName():void { + public function testRemoveATagByName(): void { $this->assertTrue(Arsse::$db->tagRemove("john.doe@example.com", "Interesting", true)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "tagRemove"); $state = $this->primeExpectations($this->data, $this->checkTags); @@ -182,33 +182,33 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAMissingTag():void { + public function testRemoveAMissingTag(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagRemove("john.doe@example.com", 2112); } - public function testRemoveAnInvalidTag():void { + public function testRemoveAnInvalidTag(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagRemove("john.doe@example.com", -1); } - public function testRemoveAnInvalidTagByName():void { + public function testRemoveAnInvalidTagByName(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagRemove("john.doe@example.com", [], true); } - public function testRemoveATagOfTheWrongOwner():void { + public function testRemoveATagOfTheWrongOwner(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagRemove("john.doe@example.com", 3); // tag ID 3 belongs to Jane } - public function testRemoveATagWithoutAuthority():void { + public function testRemoveATagWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagRemove("john.doe@example.com", 1); } - public function testGetThePropertiesOfATag():void { + public function testGetThePropertiesOfATag(): void { $exp = [ 'id' => 2, 'name' => "Fascinating", @@ -218,37 +218,37 @@ trait SeriesTag { \Phake::verify(Arsse::$user, \Phake::times(2))->authorize("john.doe@example.com", "tagPropertiesGet"); } - public function testGetThePropertiesOfAMissingTag():void { + public function testGetThePropertiesOfAMissingTag(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesGet("john.doe@example.com", 2112); } - public function testGetThePropertiesOfAnInvalidTag():void { + public function testGetThePropertiesOfAnInvalidTag(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesGet("john.doe@example.com", -1); } - public function testGetThePropertiesOfAnInvalidTagByName():void { + public function testGetThePropertiesOfAnInvalidTagByName(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesGet("john.doe@example.com", [], true); } - public function testGetThePropertiesOfATagOfTheWrongOwner():void { + public function testGetThePropertiesOfATagOfTheWrongOwner(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesGet("john.doe@example.com", 3); // tag ID 3 belongs to Jane } - public function testGetThePropertiesOfATagWithoutAuthority():void { + public function testGetThePropertiesOfATagWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagPropertiesGet("john.doe@example.com", 1); } - public function testMakeNoChangesToATag():void { + public function testMakeNoChangesToATag(): void { $this->assertFalse(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, [])); } - public function testRenameATag():void { + public function testRenameATag(): void { $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Curious"])); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "tagPropertiesSet"); $state = $this->primeExpectations($this->data, $this->checkTags); @@ -256,7 +256,7 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testRenameATagByName():void { + public function testRenameATagByName(): void { $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", "Interesting", ['name' => "Curious"], true)); \Phake::verify(Arsse::$user)->authorize("john.doe@example.com", "tagPropertiesSet"); $state = $this->primeExpectations($this->data, $this->checkTags); @@ -264,53 +264,53 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testRenameATagToTheEmptyString():void { + public function testRenameATagToTheEmptyString(): void { $this->assertException("missing", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => ""])); } - public function testRenameATagToWhitespaceOnly():void { + public function testRenameATagToWhitespaceOnly(): void { $this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => " "])); } - public function testRenameATagToAnInvalidValue():void { + public function testRenameATagToAnInvalidValue(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => []])); } - public function testCauseATagCollision():void { + public function testCauseATagCollision(): void { $this->assertException("constraintViolation", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Fascinating"]); } - public function testSetThePropertiesOfAMissingTag():void { + public function testSetThePropertiesOfAMissingTag(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesSet("john.doe@example.com", 2112, ['name' => "Exciting"]); } - public function testSetThePropertiesOfAnInvalidTag():void { + public function testSetThePropertiesOfAnInvalidTag(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesSet("john.doe@example.com", -1, ['name' => "Exciting"]); } - public function testSetThePropertiesOfAnInvalidTagByName():void { + public function testSetThePropertiesOfAnInvalidTagByName(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesSet("john.doe@example.com", [], ['name' => "Exciting"], true); } - public function testSetThePropertiesOfATagForTheWrongOwner():void { + public function testSetThePropertiesOfATagForTheWrongOwner(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagPropertiesSet("john.doe@example.com", 3, ['name' => "Exciting"]); // tag ID 3 belongs to Jane } - public function testSetThePropertiesOfATagWithoutAuthority():void { + public function testSetThePropertiesOfATagWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Exciting"]); } - public function testListTaggedSubscriptions():void { + public function testListTaggedSubscriptions(): void { $exp = [1,5]; $this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 1)); $this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", "Interesting", true)); @@ -322,23 +322,23 @@ trait SeriesTag { $this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", "Lonely", true)); } - public function testListTaggedSubscriptionsForAMissingTag():void { + public function testListTaggedSubscriptionsForAMissingTag(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 3); } - public function testListTaggedSubscriptionsForAnInvalidTag():void { + public function testListTaggedSubscriptionsForAnInvalidTag(): void { $this->assertException("typeViolation", "Db", "ExceptionInput"); Arsse::$db->tagSubscriptionsGet("john.doe@example.com", -1); } - public function testListTaggedSubscriptionsWithoutAuthority():void { + public function testListTaggedSubscriptionsWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 1); } - public function testApplyATagToSubscriptions():void { + public function testApplyATagToSubscriptions(): void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4]); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][1][2] = 1; @@ -346,14 +346,14 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testClearATagFromSubscriptions():void { + public function testClearATagFromSubscriptions(): void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [1,3], Database::ASSOC_REMOVE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][0][2] = 0; $this->compareExpectations(static::$drv, $state); } - public function testApplyATagToSubscriptionsByName():void { + public function testApplyATagToSubscriptionsByName(): void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [3,4], Database::ASSOC_ADD, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][1][2] = 1; @@ -361,26 +361,26 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testClearATagFromSubscriptionsByName():void { + public function testClearATagFromSubscriptionsByName(): void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [1,3], Database::ASSOC_REMOVE, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][0][2] = 0; $this->compareExpectations(static::$drv, $state); } - public function testApplyATagToNoSubscriptionsByName():void { + public function testApplyATagToNoSubscriptionsByName(): void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [], Database::ASSOC_ADD, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $this->compareExpectations(static::$drv, $state); } - public function testClearATagFromNoSubscriptionsByName():void { + public function testClearATagFromNoSubscriptionsByName(): void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [], Database::ASSOC_REMOVE, true); $state = $this->primeExpectations($this->data, $this->checkMembers); $this->compareExpectations(static::$drv, $state); } - public function testReplaceSubscriptionsOfATag():void { + public function testReplaceSubscriptionsOfATag(): void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4], Database::ASSOC_REPLACE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][0][2] = 0; @@ -390,7 +390,7 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testPurgeSubscriptionsOfATag():void { + public function testPurgeSubscriptionsOfATag(): void { Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [], Database::ASSOC_REPLACE); $state = $this->primeExpectations($this->data, $this->checkMembers); $state['arsse_tag_members']['rows'][0][2] = 0; @@ -398,13 +398,13 @@ trait SeriesTag { $this->compareExpectations(static::$drv, $state); } - public function testApplyATagToSubscriptionsWithoutAuthority():void { + public function testApplyATagToSubscriptionsWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4]); } - public function testSummarizeTags():void { + public function testSummarizeTags(): void { $exp = [ ['id' => 1, 'name' => "Interesting", 'subscription' => 1], ['id' => 1, 'name' => "Interesting", 'subscription' => 5], @@ -415,7 +415,7 @@ trait SeriesTag { $this->assertResult($exp, Arsse::$db->tagSummarize("john.doe@example.com")); } - public function testSummarizeTagsWithoutAuthority():void { + public function testSummarizeTagsWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tagSummarize("john.doe@example.com"); diff --git a/tests/cases/Database/SeriesToken.php b/tests/cases/Database/SeriesToken.php index ca37c1d8..8ed84e2b 100644 --- a/tests/cases/Database/SeriesToken.php +++ b/tests/cases/Database/SeriesToken.php @@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\TestCase\Database; use JKingWeb\Arsse\Arsse; trait SeriesToken { - protected function setUpSeriesToken():void { + protected function setUpSeriesToken(): void { // set up the test data $past = gmdate("Y-m-d H:i:s", strtotime("now - 1 minute")); $future = gmdate("Y-m-d H:i:s", strtotime("now + 1 minute")); @@ -43,11 +43,11 @@ trait SeriesToken { ]; } - protected function tearDownSeriesToken():void { + protected function tearDownSeriesToken(): void { unset($this->data); } - public function testLookUpAValidToken():void { + public function testLookUpAValidToken(): void { $exp1 = [ 'id' => "80fa94c1a11f11e78667001e673b2560", 'class' => "fever.login", @@ -71,22 +71,22 @@ trait SeriesToken { $this->assertArraySubset($exp1, Arsse::$db->tokenLookup("fever.login", "80fa94c1a11f11e78667001e673b2560")); } - public function testLookUpAMissingToken():void { + public function testLookUpAMissingToken(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tokenLookup("class", "thisTokenDoesNotExist"); } - public function testLookUpAnExpiredToken():void { + public function testLookUpAnExpiredToken(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tokenLookup("fever.login", "27c6de8da13311e78667001e673b2560"); } - public function testLookUpATokenOfTheWrongClass():void { + public function testLookUpATokenOfTheWrongClass(): void { $this->assertException("subjectMissing", "Db", "ExceptionInput"); Arsse::$db->tokenLookup("some.class", "80fa94c1a11f11e78667001e673b2560"); } - public function testCreateAToken():void { + public function testCreateAToken(): void { $user = "jane.doe@example.com"; $state = $this->primeExpectations($this->data, ['arsse_tokens' => ["id", "class", "expires", "user"]]); $id = Arsse::$db->tokenCreate($user, "fever.login"); @@ -100,18 +100,18 @@ trait SeriesToken { $this->compareExpectations(static::$drv, $state); } - public function testCreateATokenForAMissingUser():void { + public function testCreateATokenForAMissingUser(): void { $this->assertException("doesNotExist", "User"); Arsse::$db->tokenCreate("fever.login", "jane.doe@example.biz"); } - public function testCreateATokenWithoutAuthority():void { + public function testCreateATokenWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tokenCreate("fever.login", "jane.doe@example.com"); } - public function testRevokeAToken():void { + public function testRevokeAToken(): void { $user = "jane.doe@example.com"; $id = "80fa94c1a11f11e78667001e673b2560"; $this->assertTrue(Arsse::$db->tokenRevoke($user, "fever.login", $id)); @@ -122,7 +122,7 @@ trait SeriesToken { $this->assertFalse(Arsse::$db->tokenRevoke($user, "fever.login", $id)); } - public function testRevokeAllTokens():void { + public function testRevokeAllTokens(): void { $user = "jane.doe@example.com"; $state = $this->primeExpectations($this->data, ['arsse_tokens' => ["id", "expires", "user"]]); $this->assertTrue(Arsse::$db->tokenRevoke($user, "fever.login")); @@ -136,7 +136,7 @@ trait SeriesToken { $this->assertFalse(Arsse::$db->tokenRevoke($user, "unknown.class")); } - public function testRevokeATokenWithoutAuthority():void { + public function testRevokeATokenWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->tokenRevoke("jane.doe@example.com", "fever.login"); diff --git a/tests/cases/Database/SeriesUser.php b/tests/cases/Database/SeriesUser.php index 4a0abb39..54376600 100644 --- a/tests/cases/Database/SeriesUser.php +++ b/tests/cases/Database/SeriesUser.php @@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\TestCase\Database; use JKingWeb\Arsse\Arsse; trait SeriesUser { - protected function setUpSeriesUser():void { + protected function setUpSeriesUser(): void { $this->data = [ 'arsse_users' => [ 'columns' => [ @@ -25,11 +25,11 @@ trait SeriesUser { ]; } - protected function tearDownSeriesUser():void { + protected function tearDownSeriesUser(): void { unset($this->data); } - public function testCheckThatAUserExists():void { + public function testCheckThatAUserExists(): void { $this->assertTrue(Arsse::$db->userExists("jane.doe@example.com")); $this->assertFalse(Arsse::$db->userExists("jane.doe@example.org")); \Phake::verify(Arsse::$user)->authorize("jane.doe@example.com", "userExists"); @@ -37,31 +37,31 @@ trait SeriesUser { $this->compareExpectations(static::$drv, $this->data); } - public function testCheckThatAUserExistsWithoutAuthority():void { + public function testCheckThatAUserExistsWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userExists("jane.doe@example.com"); } - public function testGetAPassword():void { + public function testGetAPassword(): void { $hash = Arsse::$db->userPasswordGet("admin@example.net"); $this->assertSame('$2y$10$PbcG2ZR3Z8TuPzM7aHTF8.v61dtCjzjK78gdZJcp4UePE8T9jEgBW', $hash); \Phake::verify(Arsse::$user)->authorize("admin@example.net", "userPasswordGet"); $this->assertTrue(password_verify("secret", $hash)); } - public function testGetThePasswordOfAMissingUser():void { + public function testGetThePasswordOfAMissingUser(): void { $this->assertException("doesNotExist", "User"); Arsse::$db->userPasswordGet("john.doe@example.org"); } - public function testGetAPasswordWithoutAuthority():void { + public function testGetAPasswordWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userPasswordGet("admin@example.net"); } - public function testAddANewUser():void { + public function testAddANewUser(): void { $this->assertTrue(Arsse::$db->userAdd("john.doe@example.org", "")); \Phake::verify(Arsse::$user)->authorize("john.doe@example.org", "userAdd"); $state = $this->primeExpectations($this->data, ['arsse_users' => ['id']]); @@ -69,18 +69,18 @@ trait SeriesUser { $this->compareExpectations(static::$drv, $state); } - public function testAddAnExistingUser():void { + public function testAddAnExistingUser(): void { $this->assertException("alreadyExists", "User"); Arsse::$db->userAdd("john.doe@example.com", ""); } - public function testAddANewUserWithoutAuthority():void { + public function testAddANewUserWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userAdd("john.doe@example.org", ""); } - public function testRemoveAUser():void { + public function testRemoveAUser(): void { $this->assertTrue(Arsse::$db->userRemove("admin@example.net")); \Phake::verify(Arsse::$user)->authorize("admin@example.net", "userRemove"); $state = $this->primeExpectations($this->data, ['arsse_users' => ['id']]); @@ -88,24 +88,24 @@ trait SeriesUser { $this->compareExpectations(static::$drv, $state); } - public function testRemoveAMissingUser():void { + public function testRemoveAMissingUser(): void { $this->assertException("doesNotExist", "User"); Arsse::$db->userRemove("john.doe@example.org"); } - public function testRemoveAUserWithoutAuthority():void { + public function testRemoveAUserWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userRemove("admin@example.net"); } - public function testListAllUsers():void { + public function testListAllUsers(): void { $users = ["admin@example.net", "jane.doe@example.com", "john.doe@example.com"]; $this->assertSame($users, Arsse::$db->userList()); \Phake::verify(Arsse::$user)->authorize("", "userList"); } - public function testListAllUsersWithoutAuthority():void { + public function testListAllUsersWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userList(); @@ -114,7 +114,7 @@ trait SeriesUser { /** * @depends testGetAPassword */ - public function testSetAPassword():void { + public function testSetAPassword(): void { $user = "john.doe@example.com"; $pass = "secret"; $this->assertEquals("", Arsse::$db->userPasswordGet($user)); @@ -125,19 +125,19 @@ trait SeriesUser { $this->assertTrue(password_verify($pass, $hash), "Failed verifying password of $user '$pass' against hash '$hash'."); } - public function testUnsetAPassword():void { + public function testUnsetAPassword(): void { $user = "john.doe@example.com"; $this->assertEquals("", Arsse::$db->userPasswordGet($user)); $this->assertTrue(Arsse::$db->userPasswordSet($user, null)); $this->assertNull(Arsse::$db->userPasswordGet($user)); } - public function testSetThePasswordOfAMissingUser():void { + public function testSetThePasswordOfAMissingUser(): void { $this->assertException("doesNotExist", "User"); Arsse::$db->userPasswordSet("john.doe@example.org", "secret"); } - public function testSetAPasswordWithoutAuthority():void { + public function testSetAPasswordWithoutAuthority(): void { \Phake::when(Arsse::$user)->authorize->thenReturn(false); $this->assertException("notAuthorized", "User", "ExceptionAuthz"); Arsse::$db->userPasswordSet("john.doe@example.com", "secret"); diff --git a/tests/cases/Database/TestDatabase.php b/tests/cases/Database/TestDatabase.php index 6f2249fe..0bce9166 100644 --- a/tests/cases/Database/TestDatabase.php +++ b/tests/cases/Database/TestDatabase.php @@ -28,7 +28,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideInClauses */ - public function testGenerateInClause(string $clause, array $values, array $inV, string $inT):void { + public function testGenerateInClause(string $clause, array $values, array $inV, string $inT): void { $types = array_fill(0, sizeof($values), $inT); $exp = [$clause, $types, $values]; $this->assertSame($exp, $this->db->generateIn($inV, $inT)); @@ -62,7 +62,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideSearchClauses */ - public function testGenerateSearchClause(string $clause, array $values, array $inV, array $inC, bool $inAny):void { + public function testGenerateSearchClause(string $clause, array $values, array $inV, array $inC, bool $inAny): void { // this is not an exhaustive test; integration tests already cover the ins and outs of the functionality $types = array_fill(0, sizeof($values), "str"); $exp = [$clause, $types, $values]; diff --git a/tests/cases/Db/BaseDriver.php b/tests/cases/Db/BaseDriver.php index 990f4872..017deaaa 100644 --- a/tests/cases/Db/BaseDriver.php +++ b/tests/cases/Db/BaseDriver.php @@ -76,112 +76,112 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { # TESTS - public function testFetchDriverName():void { + public function testFetchDriverName(): void { $class = get_class($this->drv); $this->assertTrue(strlen($class::driverName()) > 0); } - public function testFetchSchemaId():void { + public function testFetchSchemaId(): void { $class = get_class($this->drv); $this->assertTrue(strlen($class::schemaID()) > 0); } - public function testCheckCharacterSetAcceptability():void { + public function testCheckCharacterSetAcceptability(): void { $this->assertTrue($this->drv->charsetAcceptable()); } - public function testTranslateAToken():void { + public function testTranslateAToken(): void { $this->assertRegExp("/^[a-z][a-z0-9]*$/i", $this->drv->sqlToken("greatest")); $this->assertRegExp("/^\"?[a-z][a-z0-9_\-]*\"?$/i", $this->drv->sqlToken("nocase")); $this->assertRegExp("/^[a-z][a-z0-9]*$/i", $this->drv->sqlToken("like")); $this->assertSame("distinct", $this->drv->sqlToken("distinct")); } - public function testExecAValidStatement():void { + public function testExecAValidStatement(): void { $this->assertTrue($this->drv->exec($this->create)); } - public function testExecAnInvalidStatement():void { + public function testExecAnInvalidStatement(): void { $this->assertException("engineErrorGeneral", "Db"); $this->drv->exec("And the meek shall inherit the earth..."); } - public function testExecMultipleStatements():void { + public function testExecMultipleStatements(): void { $this->assertTrue($this->drv->exec("$this->create; INSERT INTO arsse_test(id) values(2112)")); $this->assertEquals(2112, $this->query("SELECT id from arsse_test")); } - public function testExecTimeout():void { + public function testExecTimeout(): void { $this->exec($this->create); $this->exec($this->lock); $this->assertException("general", "Db", "ExceptionTimeout"); $this->drv->exec("INSERT INTO arsse_meta(\"key\", value) values('lock', '1')"); } - public function testExecConstraintViolation():void { + public function testExecConstraintViolation(): void { $this->drv->exec("CREATE TABLE arsse_test(id varchar(255) not null)"); $this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->drv->exec(static::$insertDefaultValues); } - public function testExecTypeViolation():void { + public function testExecTypeViolation(): void { $this->drv->exec($this->create); $this->assertException("typeViolation", "Db", "ExceptionInput"); $this->drv->exec("INSERT INTO arsse_test(id) values('ook')"); } - public function testMakeAValidQuery():void { + public function testMakeAValidQuery(): void { $this->assertInstanceOf(Result::class, $this->drv->query("SELECT 1")); } - public function testMakeAnInvalidQuery():void { + public function testMakeAnInvalidQuery(): void { $this->assertException("engineErrorGeneral", "Db"); $this->drv->query("Apollo was astonished; Dionysus thought me mad"); } - public function testQueryConstraintViolation():void { + public function testQueryConstraintViolation(): void { $this->drv->exec("CREATE TABLE arsse_test(id integer not null)"); $this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->drv->query(static::$insertDefaultValues); } - public function testQueryTypeViolation():void { + public function testQueryTypeViolation(): void { $this->drv->exec($this->create); $this->assertException("typeViolation", "Db", "ExceptionInput"); $this->drv->query("INSERT INTO arsse_test(id) values('ook')"); } - public function testPrepareAValidQuery():void { + public function testPrepareAValidQuery(): void { $s = $this->drv->prepare("SELECT ?, ?", "int", "int"); $this->assertInstanceOf(Statement::class, $s); } - public function testPrepareAnInvalidQuery():void { + public function testPrepareAnInvalidQuery(): void { $this->assertException("engineErrorGeneral", "Db"); $s = $this->drv->prepare("This is an invalid query", "int", "int")->run(); } - public function testCreateASavepoint():void { + public function testCreateASavepoint(): void { $this->assertEquals(1, $this->drv->savepointCreate()); $this->assertEquals(2, $this->drv->savepointCreate()); $this->assertEquals(3, $this->drv->savepointCreate()); } - public function testReleaseASavepoint():void { + public function testReleaseASavepoint(): void { $this->assertEquals(1, $this->drv->savepointCreate()); $this->assertEquals(true, $this->drv->savepointRelease()); $this->assertException("savepointInvalid", "Db"); $this->drv->savepointRelease(); } - public function testUndoASavepoint():void { + public function testUndoASavepoint(): void { $this->assertEquals(1, $this->drv->savepointCreate()); $this->assertEquals(true, $this->drv->savepointUndo()); $this->assertException("savepointInvalid", "Db"); $this->drv->savepointUndo(); } - public function testManipulateSavepoints():void { + public function testManipulateSavepoints(): void { $this->assertEquals(1, $this->drv->savepointCreate()); $this->assertEquals(2, $this->drv->savepointCreate()); $this->assertEquals(3, $this->drv->savepointCreate()); @@ -198,7 +198,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->drv->savepointRelease(2); } - public function testManipulateSavepointsSomeMore():void { + public function testManipulateSavepointsSomeMore(): void { $this->assertEquals(1, $this->drv->savepointCreate()); $this->assertEquals(2, $this->drv->savepointCreate()); $this->assertEquals(3, $this->drv->savepointCreate()); @@ -209,7 +209,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->drv->savepointUndo(2); } - public function testBeginATransaction():void { + public function testBeginATransaction(): void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr = $this->drv->begin(); @@ -221,7 +221,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(0, $this->query($select)); } - public function testCommitATransaction():void { + public function testCommitATransaction(): void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr = $this->drv->begin(); @@ -233,7 +233,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(1, $this->query($select)); } - public function testRollbackATransaction():void { + public function testRollbackATransaction(): void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr = $this->drv->begin(); @@ -245,7 +245,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(0, $this->query($select)); } - public function testBeginChainedTransactions():void { + public function testBeginChainedTransactions(): void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -258,7 +258,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(0, $this->query($select)); } - public function testCommitChainedTransactions():void { + public function testCommitChainedTransactions(): void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -275,7 +275,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(2, $this->query($select)); } - public function testCommitChainedTransactionsOutOfOrder():void { + public function testCommitChainedTransactionsOutOfOrder(): void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -291,7 +291,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $tr2->commit(); } - public function testRollbackChainedTransactions():void { + public function testRollbackChainedTransactions(): void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -310,7 +310,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(0, $this->query($select)); } - public function testRollbackChainedTransactionsOutOfOrder():void { + public function testRollbackChainedTransactionsOutOfOrder(): void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -329,7 +329,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(0, $this->query($select)); } - public function testPartiallyRollbackChainedTransactions():void { + public function testPartiallyRollbackChainedTransactions(): void { $select = "SELECT count(*) FROM arsse_test"; $this->drv->exec($this->create); $tr1 = $this->drv->begin(); @@ -348,7 +348,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(1, $this->query($select)); } - public function testFetchSchemaVersion():void { + public function testFetchSchemaVersion(): void { $this->assertSame(0, $this->drv->schemaVersion()); $this->drv->exec(str_replace("#", "1", $this->setVersion)); $this->assertSame(1, $this->drv->schemaVersion()); @@ -361,7 +361,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $this->drv->schemaVersion()); } - public function testLockTheDatabase():void { + public function testLockTheDatabase(): void { // PostgreSQL doesn't actually lock the whole database, only the metadata table // normally the application will first query this table to ensure the schema version is correct, // so the effect is usually the same @@ -370,7 +370,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->exec($this->lock); } - public function testUnlockTheDatabase():void { + public function testUnlockTheDatabase(): void { $this->drv->savepointCreate(true); $this->drv->savepointRelease(); $this->drv->savepointCreate(true); @@ -378,11 +378,11 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertTrue($this->exec(str_replace("#", "3", $this->setVersion))); } - public function testProduceAStringLiteral():void { + public function testProduceAStringLiteral(): void { $this->assertSame("'It''s a string!'", $this->drv->literalString("It's a string!")); } - public function testPerformMaintenance():void { + public function testPerformMaintenance(): void { // this performs maintenance in the absence of tables; see BaseUpdate.php for another test with tables $this->assertTrue($this->drv->maintenance()); } diff --git a/tests/cases/Db/BaseResult.php b/tests/cases/Db/BaseResult.php index 844b8b80..3391cf0e 100644 --- a/tests/cases/Db/BaseResult.php +++ b/tests/cases/Db/BaseResult.php @@ -46,18 +46,18 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testConstructResult():void { + public function testConstructResult(): void { $this->assertInstanceOf(Result::class, new $this->resultClass(...$this->makeResult("SELECT 1"))); } - public function testGetChangeCountAndLastInsertId():void { + public function testGetChangeCountAndLastInsertId(): void { $this->makeResult(static::$createMeta); $r = new $this->resultClass(...$this->makeResult("INSERT INTO arsse_meta(\"key\",value) values('test', 1)")); $this->assertSame(1, $r->changes()); $this->assertSame(0, $r->lastId()); } - public function testGetChangeCountAndLastInsertIdBis():void { + public function testGetChangeCountAndLastInsertIdBis(): void { $this->makeResult(static::$createTest); $r = new $this->resultClass(...$this->makeResult(static::$insertDefault)); $this->assertSame(1, $r->changes()); @@ -67,7 +67,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(2, $r->lastId()); } - public function testIterateOverResults():void { + public function testIterateOverResults(): void { $exp = [0 => 1, 1 => 2, 2 => 3]; $exp = static::$stringOutput ? $this->stringify($exp) : $exp; foreach (new $this->resultClass(...$this->makeResult("SELECT 1 as col union select 2 as col union select 3 as col")) as $index => $row) { @@ -76,7 +76,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $rows); } - public function testIterateOverResultsTwice():void { + public function testIterateOverResultsTwice(): void { $exp = [0 => 1, 1 => 2, 2 => 3]; $exp = static::$stringOutput ? $this->stringify($exp) : $exp; $result = new $this->resultClass(...$this->makeResult("SELECT 1 as col union select 2 as col union select 3 as col")); @@ -90,7 +90,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testGetSingleValues():void { + public function testGetSingleValues(): void { $exp = [1867, 1970, 2112]; $exp = static::$stringOutput ? $this->stringify($exp) : $exp; $test = new $this->resultClass(...$this->makeResult("SELECT 1867 as year union all select 1970 as year union all select 2112 as year")); @@ -100,7 +100,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getValue()); } - public function testGetFirstValuesOnly():void { + public function testGetFirstValuesOnly(): void { $exp = [1867, 1970, 2112]; $exp = static::$stringOutput ? $this->stringify($exp) : $exp; $test = new $this->resultClass(...$this->makeResult("SELECT 1867 as year, 19 as century union all select 1970 as year, 20 as century union all select 2112 as year, 22 as century")); @@ -110,7 +110,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getValue()); } - public function testGetRows():void { + public function testGetRows(): void { $exp = [ ['album' => '2112', 'track' => '2112'], ['album' => 'Clockwork Angels', 'track' => 'The Wreckers'], @@ -121,7 +121,7 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getRow()); } - public function testGetAllRows():void { + public function testGetAllRows(): void { $exp = [ ['album' => '2112', 'track' => '2112'], ['album' => 'Clockwork Angels', 'track' => 'The Wreckers'], diff --git a/tests/cases/Db/BaseStatement.php b/tests/cases/Db/BaseStatement.php index 25364fdd..f2f166f8 100644 --- a/tests/cases/Db/BaseStatement.php +++ b/tests/cases/Db/BaseStatement.php @@ -46,12 +46,12 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testConstructStatement():void { + public function testConstructStatement(): void { $this->assertInstanceOf(Statement::class, new $this->statementClass(...$this->makeStatement("SELECT ? as value"))); } /** @dataProvider provideBindings */ - public function testBindATypedValue($value, string $type, string $exp):void { + public function testBindATypedValue($value, string $type, string $exp): void { if ($exp === "null") { $query = "SELECT (? is null) as pass"; } else { @@ -65,7 +65,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideBinaryBindings */ - public function testHandleBinaryData($value, string $type, string $exp):void { + public function testHandleBinaryData($value, string $type, string $exp): void { if (in_array(static::$implementation, ["PostgreSQL", "PDO PostgreSQL"])) { $this->markTestIncomplete("Correct handling of binary data with PostgreSQL is not currently implemented"); } @@ -81,13 +81,13 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertTrue((bool) $act); } - public function testBindMissingValue():void { + public function testBindMissingValue(): void { $s = new $this->statementClass(...$this->makeStatement("SELECT ? as value", ["int"])); $val = $s->runArray()->getRow()['value']; $this->assertSame(null, $val); } - public function testBindMultipleValues():void { + public function testBindMultipleValues(): void { $exp = [ 'one' => "A", 'two' => "B", @@ -97,7 +97,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $val); } - public function testBindRecursively():void { + public function testBindRecursively(): void { $exp = [ 'one' => "A", 'two' => "B", @@ -109,20 +109,20 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $val); } - public function testBindWithoutType():void { + public function testBindWithoutType(): void { $this->assertException("paramTypeMissing", "Db"); $s = new $this->statementClass(...$this->makeStatement("SELECT ? as value", [])); $s->runArray([1]); } - public function testViolateConstraint():void { + public function testViolateConstraint(): void { (new $this->statementClass(...$this->makeStatement("CREATE TABLE if not exists arsse_meta(\"key\" varchar(255) primary key not null, value text)")))->run(); $s = new $this->statementClass(...$this->makeStatement("INSERT INTO arsse_meta(\"key\") values(?)", ["str"])); $this->assertException("constraintViolation", "Db", "ExceptionInput"); $s->runArray([null]); } - public function testMismatchTypes():void { + public function testMismatchTypes(): void { (new $this->statementClass(...$this->makeStatement("CREATE TABLE if not exists arsse_feeds(id integer primary key not null, url text not null)")))->run(); $s = new $this->statementClass(...$this->makeStatement("INSERT INTO arsse_feeds(id,url) values(?,?)", ["str", "str"])); $this->assertException("typeViolation", "Db", "ExceptionInput"); diff --git a/tests/cases/Db/BaseUpdate.php b/tests/cases/Db/BaseUpdate.php index f9e129dd..06db9db7 100644 --- a/tests/cases/Db/BaseUpdate.php +++ b/tests/cases/Db/BaseUpdate.php @@ -58,43 +58,43 @@ class BaseUpdate extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testLoadMissingFile():void { + public function testLoadMissingFile(): void { $this->assertException("updateFileMissing", "Db"); $this->drv->schemaUpdate(1, $this->base); } - public function testLoadUnreadableFile():void { + public function testLoadUnreadableFile(): void { touch($this->path."0.sql"); chmod($this->path."0.sql", 0000); $this->assertException("updateFileUnreadable", "Db"); $this->drv->schemaUpdate(1, $this->base); } - public function testLoadCorruptFile():void { + public function testLoadCorruptFile(): void { file_put_contents($this->path."0.sql", "This is a corrupt file"); $this->assertException("updateFileError", "Db"); $this->drv->schemaUpdate(1, $this->base); } - public function testLoadIncompleteFile():void { + public function testLoadIncompleteFile(): void { file_put_contents($this->path."0.sql", "create table arsse_meta(\"key\" varchar(255) primary key not null, value text);"); $this->assertException("updateFileIncomplete", "Db"); $this->drv->schemaUpdate(1, $this->base); } - public function testLoadEmptyFile():void { + public function testLoadEmptyFile(): void { file_put_contents($this->path."0.sql", ""); $this->assertException("updateFileIncomplete", "Db"); $this->drv->schemaUpdate(1, $this->base); } - public function testLoadCorrectFile():void { + public function testLoadCorrectFile(): void { file_put_contents($this->path."0.sql", static::$minimal1); $this->drv->schemaUpdate(1, $this->base); $this->assertEquals(1, $this->drv->schemaVersion()); } - public function testPerformPartialUpdate():void { + public function testPerformPartialUpdate(): void { file_put_contents($this->path."0.sql", static::$minimal1); file_put_contents($this->path."1.sql", "UPDATE arsse_meta set value = '1' where \"key\" = 'schema_version'"); $this->assertException("updateFileIncomplete", "Db"); @@ -106,31 +106,31 @@ class BaseUpdate extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testPerformSequentialUpdate():void { + public function testPerformSequentialUpdate(): void { file_put_contents($this->path."0.sql", static::$minimal1); file_put_contents($this->path."1.sql", static::$minimal2); $this->drv->schemaUpdate(2, $this->base); $this->assertEquals(2, $this->drv->schemaVersion()); } - public function testPerformActualUpdate():void { + public function testPerformActualUpdate(): void { $this->drv->schemaUpdate(Database::SCHEMA_VERSION); $this->assertEquals(Database::SCHEMA_VERSION, $this->drv->schemaVersion()); } - public function testDeclineManualUpdate():void { + public function testDeclineManualUpdate(): void { // turn auto-updating off Arsse::$conf->dbAutoUpdate = false; $this->assertException("updateManual", "Db"); $this->drv->schemaUpdate(Database::SCHEMA_VERSION); } - public function testDeclineDowngrade():void { + public function testDeclineDowngrade(): void { $this->assertException("updateTooNew", "Db"); $this->drv->schemaUpdate(-1, $this->base); } - public function testPerformMaintenance():void { + public function testPerformMaintenance(): void { $this->drv->schemaUpdate(Database::SCHEMA_VERSION); $this->assertTrue($this->drv->maintenance()); } diff --git a/tests/cases/Db/MySQL/TestCreation.php b/tests/cases/Db/MySQL/TestCreation.php index 6b0bbdf4..2f821043 100644 --- a/tests/cases/Db/MySQL/TestCreation.php +++ b/tests/cases/Db/MySQL/TestCreation.php @@ -19,7 +19,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testFailToConnect():void { + public function testFailToConnect(): void { // for the sake of simplicity we don't distinguish between failure modes, but the MySQL-supplied error messages do self::setConf([ 'dbMySQLHost' => "example.invalid", diff --git a/tests/cases/Db/MySQL/TestStatement.php b/tests/cases/Db/MySQL/TestStatement.php index c044c03f..76c7b819 100644 --- a/tests/cases/Db/MySQL/TestStatement.php +++ b/tests/cases/Db/MySQL/TestStatement.php @@ -34,7 +34,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement { } } - public function testBindLongString():void { + public function testBindLongString(): void { // this test requires some set-up to be effective static::$interface->query("CREATE TABLE arsse_test(`value` longtext not null) character set utf8mb4"); // we'll use an unrealistic packet size of 1 byte to trigger special handling for strings which are too long for the maximum packet size diff --git a/tests/cases/Db/MySQLPDO/TestCreation.php b/tests/cases/Db/MySQLPDO/TestCreation.php index 856e3488..b12bc8eb 100644 --- a/tests/cases/Db/MySQLPDO/TestCreation.php +++ b/tests/cases/Db/MySQLPDO/TestCreation.php @@ -19,7 +19,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testFailToConnect():void { + public function testFailToConnect(): void { // for the sake of simplicity we don't distinguish between failure modes, but the MySQL-supplied error messages do self::setConf([ 'dbMySQLHost' => "example.invalid", diff --git a/tests/cases/Db/PostgreSQL/TestCreation.php b/tests/cases/Db/PostgreSQL/TestCreation.php index fcfea3fe..7b3dd761 100644 --- a/tests/cases/Db/PostgreSQL/TestCreation.php +++ b/tests/cases/Db/PostgreSQL/TestCreation.php @@ -20,7 +20,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideConnectionStrings */ - public function testGenerateConnectionString(bool $pdo, string $user, string $pass, string $db, string $host, int $port, string $service, string $exp):void { + public function testGenerateConnectionString(bool $pdo, string $user, string $pass, string $db, string $host, int $port, string $service, string $exp): void { self::setConf(); $timeout = (string) ceil(Arsse::$conf->dbTimeoutConnect ?? 0); $postfix = "application_name='arsse' client_encoding='UTF8' connect_timeout='$timeout'"; @@ -62,7 +62,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testFailToConnect():void { + public function testFailToConnect(): void { // we cannnot distinguish between different connection failure modes self::setConf([ 'dbPostgreSQLHost' => "example.invalid", diff --git a/tests/cases/Db/PostgreSQLPDO/TestCreation.php b/tests/cases/Db/PostgreSQLPDO/TestCreation.php index 003dbe52..a3916403 100644 --- a/tests/cases/Db/PostgreSQLPDO/TestCreation.php +++ b/tests/cases/Db/PostgreSQLPDO/TestCreation.php @@ -20,7 +20,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideConnectionStrings */ - public function testGenerateConnectionString(bool $pdo, string $user, string $pass, string $db, string $host, int $port, string $service, string $exp):void { + public function testGenerateConnectionString(bool $pdo, string $user, string $pass, string $db, string $host, int $port, string $service, string $exp): void { self::setConf(); $timeout = (string) ceil(Arsse::$conf->dbTimeoutConnect ?? 0); $postfix = "application_name='arsse' client_encoding='UTF8' connect_timeout='$timeout'"; @@ -62,7 +62,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testFailToConnect():void { + public function testFailToConnect(): void { // PDO dies not distinguish between different connection failure modes self::setConf([ 'dbPostgreSQLHost' => "example.invalid", diff --git a/tests/cases/Db/SQLite3/TestCreation.php b/tests/cases/Db/SQLite3/TestCreation.php index 2eef1f31..ecb942f3 100644 --- a/tests/cases/Db/SQLite3/TestCreation.php +++ b/tests/cases/Db/SQLite3/TestCreation.php @@ -112,79 +112,79 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testFailToCreateDatabase():void { + public function testFailToCreateDatabase(): void { Arsse::$conf->dbSQLite3File = $this->path."Cmain/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToCreateJournal():void { + public function testFailToCreateJournal(): void { Arsse::$conf->dbSQLite3File = $this->path."Cwal/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToCreateSharedMmeory():void { + public function testFailToCreateSharedMmeory(): void { Arsse::$conf->dbSQLite3File = $this->path."Cshm/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToReadDatabase():void { + public function testFailToReadDatabase(): void { Arsse::$conf->dbSQLite3File = $this->path."Rmain/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToReadJournal():void { + public function testFailToReadJournal(): void { Arsse::$conf->dbSQLite3File = $this->path."Rwal/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToReadSharedMmeory():void { + public function testFailToReadSharedMmeory(): void { Arsse::$conf->dbSQLite3File = $this->path."Rshm/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToWriteToDatabase():void { + public function testFailToWriteToDatabase(): void { Arsse::$conf->dbSQLite3File = $this->path."Wmain/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToWriteToJournal():void { + public function testFailToWriteToJournal(): void { Arsse::$conf->dbSQLite3File = $this->path."Wwal/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToWriteToSharedMmeory():void { + public function testFailToWriteToSharedMmeory(): void { Arsse::$conf->dbSQLite3File = $this->path."Wshm/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToAccessDatabase():void { + public function testFailToAccessDatabase(): void { Arsse::$conf->dbSQLite3File = $this->path."Amain/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testFailToAccessJournal():void { + public function testFailToAccessJournal(): void { Arsse::$conf->dbSQLite3File = $this->path."Awal/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testFailToAccessSharedMmeory():void { + public function testFailToAccessSharedMmeory(): void { Arsse::$conf->dbSQLite3File = $this->path."Ashm/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testAssumeDatabaseCorruption():void { + public function testAssumeDatabaseCorruption(): void { Arsse::$conf->dbSQLite3File = $this->path."corrupt/arsse.db"; $this->assertException("fileCorrupt", "Db"); new Driver; diff --git a/tests/cases/Db/SQLite3PDO/TestCreation.php b/tests/cases/Db/SQLite3PDO/TestCreation.php index dde9dd7b..50e2fe25 100644 --- a/tests/cases/Db/SQLite3PDO/TestCreation.php +++ b/tests/cases/Db/SQLite3PDO/TestCreation.php @@ -114,79 +114,79 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testFailToCreateDatabase():void { + public function testFailToCreateDatabase(): void { Arsse::$conf->dbSQLite3File = $this->path."Cmain/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToCreateJournal():void { + public function testFailToCreateJournal(): void { Arsse::$conf->dbSQLite3File = $this->path."Cwal/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToCreateSharedMmeory():void { + public function testFailToCreateSharedMmeory(): void { Arsse::$conf->dbSQLite3File = $this->path."Cshm/arsse.db"; $this->assertException("fileUncreatable", "Db"); new Driver; } - public function testFailToReadDatabase():void { + public function testFailToReadDatabase(): void { Arsse::$conf->dbSQLite3File = $this->path."Rmain/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToReadJournal():void { + public function testFailToReadJournal(): void { Arsse::$conf->dbSQLite3File = $this->path."Rwal/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToReadSharedMmeory():void { + public function testFailToReadSharedMmeory(): void { Arsse::$conf->dbSQLite3File = $this->path."Rshm/arsse.db"; $this->assertException("fileUnreadable", "Db"); new Driver; } - public function testFailToWriteToDatabase():void { + public function testFailToWriteToDatabase(): void { Arsse::$conf->dbSQLite3File = $this->path."Wmain/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToWriteToJournal():void { + public function testFailToWriteToJournal(): void { Arsse::$conf->dbSQLite3File = $this->path."Wwal/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToWriteToSharedMmeory():void { + public function testFailToWriteToSharedMmeory(): void { Arsse::$conf->dbSQLite3File = $this->path."Wshm/arsse.db"; $this->assertException("fileUnwritable", "Db"); new Driver; } - public function testFailToAccessDatabase():void { + public function testFailToAccessDatabase(): void { Arsse::$conf->dbSQLite3File = $this->path."Amain/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testFailToAccessJournal():void { + public function testFailToAccessJournal(): void { Arsse::$conf->dbSQLite3File = $this->path."Awal/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testFailToAccessSharedMmeory():void { + public function testFailToAccessSharedMmeory(): void { Arsse::$conf->dbSQLite3File = $this->path."Ashm/arsse.db"; $this->assertException("fileUnusable", "Db"); new Driver; } - public function testAssumeDatabaseCorruption():void { + public function testAssumeDatabaseCorruption(): void { Arsse::$conf->dbSQLite3File = $this->path."corrupt/arsse.db"; $this->assertException("fileCorrupt", "Db"); new Driver; diff --git a/tests/cases/Db/TestResultAggregate.php b/tests/cases/Db/TestResultAggregate.php index 0dad2194..2ce69cdd 100644 --- a/tests/cases/Db/TestResultAggregate.php +++ b/tests/cases/Db/TestResultAggregate.php @@ -7,7 +7,7 @@ use JKingWeb\Arsse\Test\Result; /** @covers \JKingWeb\Arsse\Db\ResultAggregate */ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { - public function testGetChangeCountAndLastInsertId():void { + public function testGetChangeCountAndLastInsertId(): void { $in = [ new Result([], 3, 4), new Result([], 27, 10), @@ -18,7 +18,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals(2112, $r->lastId()); } - public function testIterateOverResults():void { + public function testIterateOverResults(): void { $in = [ new Result([['col' => 1]]), new Result([['col' => 2]]), @@ -31,7 +31,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals([0 => 1, 1 => 2, 2 => 3], $rows); } - public function testIterateOverResultsTwice():void { + public function testIterateOverResultsTwice(): void { $in = [ new Result([['col' => 1]]), new Result([['col' => 2]]), @@ -49,7 +49,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testGetSingleValues():void { + public function testGetSingleValues(): void { $test = new ResultAggregate(...[ new Result([['year' => 1867]]), new Result([['year' => 1970]]), @@ -61,7 +61,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getValue()); } - public function testGetFirstValuesOnly():void { + public function testGetFirstValuesOnly(): void { $test = new ResultAggregate(...[ new Result([['year' => 1867, 'century' => 19]]), new Result([['year' => 1970, 'century' => 20]]), @@ -73,7 +73,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getValue()); } - public function testGetRows():void { + public function testGetRows(): void { $test = new ResultAggregate(...[ new Result([['album' => '2112', 'track' => '2112']]), new Result([['album' => 'Clockwork Angels', 'track' => 'The Wreckers']]), @@ -87,7 +87,7 @@ class TestResultAggregate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(null, $test->getRow()); } - public function testGetAllRows():void { + public function testGetAllRows(): void { $test = new ResultAggregate(...[ new Result([['album' => '2112', 'track' => '2112']]), new Result([['album' => 'Clockwork Angels', 'track' => 'The Wreckers']]), diff --git a/tests/cases/Db/TestResultEmpty.php b/tests/cases/Db/TestResultEmpty.php index c9a799f9..0386c976 100644 --- a/tests/cases/Db/TestResultEmpty.php +++ b/tests/cases/Db/TestResultEmpty.php @@ -6,13 +6,13 @@ use JKingWeb\Arsse\Db\ResultEmpty; /** @covers \JKingWeb\Arsse\Db\ResultEmpty */ class TestResultEmpty extends \JKingWeb\Arsse\Test\AbstractTest { - public function testGetChangeCountAndLastInsertId():void { + public function testGetChangeCountAndLastInsertId(): void { $r = new ResultEmpty; $this->assertEquals(0, $r->changes()); $this->assertEquals(0, $r->lastId()); } - public function testIterateOverResults():void { + public function testIterateOverResults(): void { $rows = []; foreach (new ResultEmpty as $index => $row) { $rows[$index] = $row['col']; @@ -20,17 +20,17 @@ class TestResultEmpty extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals([], $rows); } - public function testGetSingleValues():void { + public function testGetSingleValues(): void { $test = new ResultEmpty; $this->assertSame(null, $test->getValue()); } - public function testGetRows():void { + public function testGetRows(): void { $test = new ResultEmpty; $this->assertSame(null, $test->getRow()); } - public function testGetAllRows():void { + public function testGetAllRows(): void { $test = new ResultEmpty; $rows = []; $this->assertEquals($rows, $test->getAll()); diff --git a/tests/cases/Db/TestTransaction.php b/tests/cases/Db/TestTransaction.php index 5c045c82..6b8aed58 100644 --- a/tests/cases/Db/TestTransaction.php +++ b/tests/cases/Db/TestTransaction.php @@ -23,7 +23,7 @@ class TestTransaction extends \JKingWeb\Arsse\Test\AbstractTest { $this->drv = $drv; } - public function testManipulateTransactions():void { + public function testManipulateTransactions(): void { $tr1 = new Transaction($this->drv); $tr2 = new Transaction($this->drv); \Phake::verify($this->drv, \Phake::times(2))->savepointCreate; @@ -35,7 +35,7 @@ class TestTransaction extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($this->drv)->savepointUndo(2); } - public function testCloseTransactions():void { + public function testCloseTransactions(): void { $tr1 = new Transaction($this->drv); $tr2 = new Transaction($this->drv); $this->assertTrue($tr1->isPending()); @@ -50,7 +50,7 @@ class TestTransaction extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($this->drv)->savepointUndo(2); } - public function testIgnoreRollbackErrors():void { + public function testIgnoreRollbackErrors(): void { \Phake::when($this->drv)->savepointUndo->thenThrow(new Exception("savepointStale")); $tr1 = new Transaction($this->drv); $tr2 = new Transaction($this->drv); diff --git a/tests/cases/Exception/TestException.php b/tests/cases/Exception/TestException.php index 4c888a67..66a1f3a8 100644 --- a/tests/cases/Exception/TestException.php +++ b/tests/cases/Exception/TestException.php @@ -28,7 +28,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(true); } - public function testBaseClass():void { + public function testBaseClass(): void { $this->assertException("unknown"); throw new Exception("unknown"); } @@ -36,7 +36,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testBaseClass */ - public function testBaseClassWithoutMessage():void { + public function testBaseClassWithoutMessage(): void { $this->assertException("unknown"); throw new Exception(); } @@ -44,7 +44,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testBaseClass */ - public function testDerivedClass():void { + public function testDerivedClass(): void { $this->assertException("fileMissing", "Lang"); throw new LangException("fileMissing"); } @@ -52,7 +52,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testDerivedClass */ - public function testDerivedClassWithMessageParameters():void { + public function testDerivedClassWithMessageParameters(): void { $this->assertException("fileMissing", "Lang"); throw new LangException("fileMissing", "en"); } @@ -60,7 +60,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testBaseClass */ - public function testBaseClassWithUnknownCode():void { + public function testBaseClassWithUnknownCode(): void { $this->assertException("uncoded"); throw new Exception("testThisExceptionMessageDoesNotExist"); } @@ -68,13 +68,13 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testBaseClassWithUnknownCode */ - public function testDerivedClassWithMissingMessage():void { + public function testDerivedClassWithMissingMessage(): void { $this->assertException("uncoded"); throw new LangException("testThisExceptionMessageDoesNotExist"); } /** @covers \JKingWeb\Arsse\ExceptionFatal */ - public function testFatalException():void { + public function testFatalException(): void { $this->expectException('JKingWeb\Arsse\ExceptionFatal'); throw new \JKingWeb\Arsse\ExceptionFatal(""); } diff --git a/tests/cases/Feed/TestFeed.php b/tests/cases/Feed/TestFeed.php index e6962c54..e86628d3 100644 --- a/tests/cases/Feed/TestFeed.php +++ b/tests/cases/Feed/TestFeed.php @@ -98,7 +98,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { Arsse::$db = \Phake::mock(Database::class); } - public function testParseAFeed():void { + public function testParseAFeed(): void { // test that various properties are set on the feed and on items $f = new Feed(null, $this->base."Parsing/Valid"); $this->assertTrue(isset($f->lastModified)); @@ -141,37 +141,37 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($categories, $f->data->items[5]->categories); } - public function testDiscoverAFeedSuccessfully():void { + public function testDiscoverAFeedSuccessfully(): void { $this->assertSame($this->base."Discovery/Feed", Feed::discover($this->base."Discovery/Valid")); $this->assertSame($this->base."Discovery/Feed", Feed::discover($this->base."Discovery/Feed")); } - public function testDiscoverAFeedUnsuccessfully():void { + public function testDiscoverAFeedUnsuccessfully(): void { $this->assertException("subscriptionNotFound", "Feed"); Feed::discover($this->base."Discovery/Invalid"); } - public function testParseEntityExpansionAttack():void { + public function testParseEntityExpansionAttack(): void { $this->assertException("xmlEntity", "Feed"); new Feed(null, $this->base."Parsing/XEEAttack"); } - public function testParseExternalEntityAttack():void { + public function testParseExternalEntityAttack(): void { $this->assertException("xmlEntity", "Feed"); new Feed(null, $this->base."Parsing/XXEAttack"); } - public function testParseAnUnsupportedFeed():void { + public function testParseAnUnsupportedFeed(): void { $this->assertException("unsupportedFeedFormat", "Feed"); new Feed(null, $this->base."Parsing/Unsupported"); } - public function testParseAMalformedFeed():void { + public function testParseAMalformedFeed(): void { $this->assertException("malformedXml", "Feed"); new Feed(null, $this->base."Parsing/Malformed"); } - public function testDeduplicateFeedItems():void { + public function testDeduplicateFeedItems(): void { // duplicates with dates lead to the newest match being kept $t = strtotime("2002-05-19T15:21:36Z"); $f = new Feed(null, $this->base."Deduplication/Permalink-Dates"); @@ -198,7 +198,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame("http://example.com/1", $f->newItems[0]->url); } - public function testHandleCacheHeadersOn304():void { + public function testHandleCacheHeadersOn304(): void { // upon 304, the client should re-use the caching header values it supplied the server $t = time(); $e = "78567a"; @@ -216,7 +216,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($e, $f->resource->getETag()); } - public function testHandleCacheHeadersOn200():void { + public function testHandleCacheHeadersOn200(): void { // these tests should trust the server-returned time, even in cases of obviously incorrect results $t = time() - 2000; $f = new Feed(null, $this->base."Caching/200Past"); @@ -244,7 +244,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertTime($t, $f->lastModified); } - public function testComputeNextFetchOnError():void { + public function testComputeNextFetchOnError(): void { for ($a = 0; $a < 100; $a++) { if ($a < 3) { $this->assertTime("now + 5 minutes", Feed::nextFetchOnError($a)); @@ -257,7 +257,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provide304Timestamps */ - public function testComputeNextFetchFrom304(string $t, string $exp):void { + public function testComputeNextFetchFrom304(string $t, string $exp): void { $t = $t ? strtotime($t) : ""; $f = new Feed(null, $this->base."NextFetch/NotModified?t=$t", Date::transform($t, "http")); $exp = strtotime($exp); @@ -279,13 +279,13 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testComputeNextFetchFrom304WithoutDate():void { + public function testComputeNextFetchFrom304WithoutDate(): void { $f = new Feed(null, $this->base."NextFetch/NotModifiedEtag"); $exp = strtotime("now + 3 hours"); $this->assertTime($exp, $f->nextFetch); } - public function testComputeNextFetchFrom200():void { + public function testComputeNextFetchFrom200(): void { // if less than half an hour, check in 15 minutes $f = new Feed(null, $this->base."NextFetch/30m"); $exp = strtotime("now + 15 minutes"); @@ -312,7 +312,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertTime($exp, $f->nextFetch); } - public function testMatchLatestArticles():void { + public function testMatchLatestArticles(): void { \Phake::when(Arsse::$db)->feedMatchLatest(1, $this->anything())->thenReturn(new Result($this->latest)); $f = new Feed(1, $this->base."Matching/1"); $this->assertCount(0, $f->newItems); @@ -328,7 +328,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertCount(2, $f->changedItems); } - public function testMatchHistoricalArticles():void { + public function testMatchHistoricalArticles(): void { \Phake::when(Arsse::$db)->feedMatchLatest(1, $this->anything())->thenReturn(new Result($this->latest)); \Phake::when(Arsse::$db)->feedMatchIds(1, $this->anything(), $this->anything(), $this->anything(), $this->anything())->thenReturn(new Result($this->others)); $f = new Feed(1, $this->base."Matching/5"); @@ -336,7 +336,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertCount(0, $f->changedItems); } - public function testScrapeFullContent():void { + public function testScrapeFullContent(): void { // first make sure that the absence of scraping works as expected $f = new Feed(null, $this->base."Scraping/Feed"); $exp = "

Partial content

"; diff --git a/tests/cases/Feed/TestFetching.php b/tests/cases/Feed/TestFetching.php index 05b79b40..573c7e96 100644 --- a/tests/cases/Feed/TestFetching.php +++ b/tests/cases/Feed/TestFetching.php @@ -27,48 +27,48 @@ class TestFetching extends \JKingWeb\Arsse\Test\AbstractTest { self::setConf(); } - public function testHandle400():void { + public function testHandle400(): void { $this->assertException("unsupportedFeedFormat", "Feed"); new Feed(null, $this->base."Fetching/Error?code=400"); } - public function testHandle401():void { + public function testHandle401(): void { $this->assertException("unauthorized", "Feed"); new Feed(null, $this->base."Fetching/Error?code=401"); } - public function testHandle403():void { + public function testHandle403(): void { $this->assertException("forbidden", "Feed"); new Feed(null, $this->base."Fetching/Error?code=403"); } - public function testHandle404():void { + public function testHandle404(): void { $this->assertException("invalidUrl", "Feed"); new Feed(null, $this->base."Fetching/Error?code=404"); } - public function testHandle500():void { + public function testHandle500(): void { $this->assertException("unsupportedFeedFormat", "Feed"); new Feed(null, $this->base."Fetching/Error?code=500"); } - public function testHandleARedirectLoop():void { + public function testHandleARedirectLoop(): void { $this->assertException("maxRedirect", "Feed"); new Feed(null, $this->base."Fetching/EndlessLoop?i=0"); } - public function testHandleAnOverlyLargeFeed():void { + public function testHandleAnOverlyLargeFeed(): void { Arsse::$conf->fetchSizeLimit = 512; $this->assertException("maxSize", "Feed"); new Feed(null, $this->base."Fetching/TooLarge"); } - public function testHandleACertificateError():void { + public function testHandleACertificateError(): void { $this->assertException("invalidCertificate", "Feed"); new Feed(null, "https://localhost:8000/"); } - public function testHandleATimeout():void { + public function testHandleATimeout(): void { Arsse::$conf->fetchTimeout = 1; $this->assertException("timeout", "Feed"); new Feed(null, $this->base."Fetching/Timeout"); diff --git a/tests/cases/ImportExport/TestFile.php b/tests/cases/ImportExport/TestFile.php index 36b45b57..bbffca67 100644 --- a/tests/cases/ImportExport/TestFile.php +++ b/tests/cases/ImportExport/TestFile.php @@ -45,7 +45,7 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideFileExports */ - public function testExportToAFile(string $file, string $user, bool $flat, $exp):void { + public function testExportToAFile(string $file, string $user, bool $flat, $exp): void { $path = $this->path.$file; try { if ($exp instanceof \JKingWeb\Arsse\AbstractException) { @@ -84,7 +84,7 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideFileImports */ - public function testImportFromAFile(string $file, string $user, bool $flat, bool $replace, $exp):void { + public function testImportFromAFile(string $file, string $user, bool $flat, bool $replace, $exp): void { $path = $this->path.$file; try { if ($exp instanceof \JKingWeb\Arsse\AbstractException) { diff --git a/tests/cases/ImportExport/TestImportExport.php b/tests/cases/ImportExport/TestImportExport.php index 269b3515..ee8830c3 100644 --- a/tests/cases/ImportExport/TestImportExport.php +++ b/tests/cases/ImportExport/TestImportExport.php @@ -146,13 +146,13 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testImportForAMissingUser():void { + public function testImportForAMissingUser(): void { \Phake::when(Arsse::$user)->exists->thenReturn(false); $this->assertException("doesNotExist", "User"); $this->proc->import("john.doe@example.com", "", false, false); } - public function testImportWithInvalidFolder():void { + public function testImportWithInvalidFolder(): void { $in = [[ ], [1 => ['id' => 1, 'name' => "", 'parent' => 0], @@ -162,7 +162,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->proc->import("john.doe@example.com", "", false, false); } - public function testImportWithDuplicateFolder():void { + public function testImportWithDuplicateFolder(): void { $in = [[ ], [1 => ['id' => 1, 'name' => "New", 'parent' => 0], @@ -173,7 +173,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->proc->import("john.doe@example.com", "", false, false); } - public function testMakeNoEffectiveChanges():void { + public function testMakeNoEffectiveChanges(): void { $in = [[ ['url' => "http://localhost:8000/Import/nasa-jpl", 'title' => "NASA JPL", 'folder' => 3, 'tags' => ["tech"]], ['url' => "http://localhost:8000/Import/ars", 'title' => "Ars Technica", 'folder' => 2, 'tags' => ["frequent", "tech"]], @@ -197,7 +197,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->compareExpectations($this->drv, $exp); } - public function testModifyASubscription():void { + public function testModifyASubscription(): void { $in = [[ ['url' => "http://localhost:8000/Import/nasa-jpl", 'title' => "NASA JPL", 'folder' => 3, 'tags' => ["tech"]], ['url' => "http://localhost:8000/Import/ars", 'title' => "Ars Technica", 'folder' => 2, 'tags' => ["frequent", "tech"]], @@ -222,7 +222,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->compareExpectations($this->drv, $exp); } - public function testImportAFeed():void { + public function testImportAFeed(): void { $in = [[ ['url' => "http://localhost:8000/Import/some-feed", 'title' => "Some Feed", 'folder' => 0, 'tags' => ["frequent", "cryptic"]], //one existing tag and one new one ], []]; @@ -237,7 +237,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->compareExpectations($this->drv, $exp); } - public function testImportAFeedWithAnInvalidTag():void { + public function testImportAFeedWithAnInvalidTag(): void { $in = [[ ['url' => "http://localhost:8000/Import/some-feed", 'title' => "Some Feed", 'folder' => 0, 'tags' => [""]], ], []]; @@ -246,7 +246,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->proc->import("john.doe@example.com", "", false, false); } - public function testReplaceData():void { + public function testReplaceData(): void { $in = [[ ['url' => "http://localhost:8000/Import/some-feed", 'title' => "Some Feed", 'folder' => 1, 'tags' => ["frequent", "cryptic"]], ], [1 => diff --git a/tests/cases/ImportExport/TestOPML.php b/tests/cases/ImportExport/TestOPML.php index 294da40f..234d6b5c 100644 --- a/tests/cases/ImportExport/TestOPML.php +++ b/tests/cases/ImportExport/TestOPML.php @@ -86,28 +86,28 @@ OPML_EXPORT_SERIALIZATION; \Phake::when(Arsse::$user)->exists->thenReturn(true); } - public function testExportToOpml():void { + public function testExportToOpml(): void { \Phake::when(Arsse::$db)->folderList("john.doe@example.com")->thenReturn(new Result($this->folders)); \Phake::when(Arsse::$db)->subscriptionList("john.doe@example.com")->thenReturn(new Result($this->subscriptions)); \Phake::when(Arsse::$db)->tagSummarize("john.doe@example.com")->thenReturn(new Result($this->tags)); $this->assertXmlStringEqualsXmlString($this->serialization, (new OPML)->export("john.doe@example.com")); } - public function testExportToFlatOpml():void { + public function testExportToFlatOpml(): void { \Phake::when(Arsse::$db)->folderList("john.doe@example.com")->thenReturn(new Result($this->folders)); \Phake::when(Arsse::$db)->subscriptionList("john.doe@example.com")->thenReturn(new Result($this->subscriptions)); \Phake::when(Arsse::$db)->tagSummarize("john.doe@example.com")->thenReturn(new Result($this->tags)); $this->assertXmlStringEqualsXmlString($this->serializationFlat, (new OPML)->export("john.doe@example.com", true)); } - public function testExportToOpmlAMissingUser():void { + public function testExportToOpmlAMissingUser(): void { \Phake::when(Arsse::$user)->exists->thenReturn(false); $this->assertException("doesNotExist", "User"); (new OPML)->export("john.doe@example.com"); } /** @dataProvider provideParserData */ - public function testParseOpmlForImport(string $file, bool $flat, $exp):void { + public function testParseOpmlForImport(string $file, bool $flat, $exp): void { $data = file_get_contents(\JKingWeb\Arsse\DOCROOT."Import/OPML/$file"); // set up a partial mock to make the ImportExport::parse() method visible $parser = \Phake::makeVisible(\Phake::partialMock(OPML::class)); diff --git a/tests/cases/Lang/TestBasic.php b/tests/cases/Lang/TestBasic.php index 16bec4b6..ff55b538 100644 --- a/tests/cases/Lang/TestBasic.php +++ b/tests/cases/Lang/TestBasic.php @@ -16,14 +16,14 @@ class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest { public $path; public $l; - public function testListLanguages():void { + public function testListLanguages(): void { $this->assertCount(sizeof($this->files), $this->l->list("en")); } /** * @depends testListLanguages */ - public function testSetLanguage():void { + public function testSetLanguage(): void { $this->assertEquals("en", $this->l->set("en")); $this->assertEquals("en_ca", $this->l->set("en_ca")); $this->assertEquals("de", $this->l->set("de_ch")); @@ -36,7 +36,7 @@ class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testSetLanguage */ - public function testLoadInternalStrings():void { + public function testLoadInternalStrings(): void { $this->assertEquals("", $this->l->set("", true)); $this->assertCount(sizeof(TestClass::REQUIRED), $this->l->dump()); } @@ -44,7 +44,7 @@ class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testLoadInternalStrings */ - public function testLoadDefaultLanguage():void { + public function testLoadDefaultLanguage(): void { $this->assertEquals(TestClass::DEFAULT, $this->l->set(TestClass::DEFAULT, true)); $str = $this->l->dump(); $this->assertArrayHasKey('Exception.JKingWeb/Arsse/Exception.uncoded', $str); @@ -54,7 +54,7 @@ class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testLoadDefaultLanguage */ - public function testLoadSupplementaryLanguage():void { + public function testLoadSupplementaryLanguage(): void { $this->l->set(TestClass::DEFAULT, true); $this->assertEquals("ja", $this->l->set("ja", true)); $str = $this->l->dump(); diff --git a/tests/cases/Lang/TestComplex.php b/tests/cases/Lang/TestComplex.php index 7de2bf40..9697c237 100644 --- a/tests/cases/Lang/TestComplex.php +++ b/tests/cases/Lang/TestComplex.php @@ -16,11 +16,11 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { public $path; public $l; - public function setUpSeries():void { + public function setUpSeries(): void { $this->l->set(TestClass::DEFAULT, true); } - public function testLazyLoad():void { + public function testLazyLoad(): void { $this->l->set("ja"); $this->assertArrayNotHasKey('Test.absentText', $this->l->dump()); } @@ -28,14 +28,14 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testLazyLoad */ - public function testGetWantedAndLoadedLocale():void { + public function testGetWantedAndLoadedLocale(): void { $this->l->set("en", true); $this->l->set("ja"); $this->assertEquals("ja", $this->l->get()); $this->assertEquals("en", $this->l->get(true)); } - public function testLoadCascadeOfFiles():void { + public function testLoadCascadeOfFiles(): void { $this->l->set("ja", true); $this->assertEquals("de", $this->l->set("de", true)); $str = $this->l->dump(); @@ -46,11 +46,11 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testLoadCascadeOfFiles */ - public function testLoadSubtag():void { + public function testLoadSubtag(): void { $this->assertEquals("en_ca", $this->l->set("en_ca", true)); } - public function testFetchAMessage():void { + public function testFetchAMessage(): void { $this->l->set("de"); $this->assertEquals('und der Stein der Weisen', $this->l->msg('Test.presentText')); } @@ -58,7 +58,7 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testFetchAMessage */ - public function testFetchAMessageWithMissingParameters():void { + public function testFetchAMessageWithMissingParameters(): void { $this->l->set("en_ca", true); $this->assertEquals('{0} and {1}', $this->l->msg('Test.presentText')); } @@ -66,7 +66,7 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testFetchAMessage */ - public function testFetchAMessageWithSingleNumericParameter():void { + public function testFetchAMessageWithSingleNumericParameter(): void { $this->l->set("en_ca", true); $this->assertEquals('Default language file "en" missing', $this->l->msg('Exception.JKingWeb/Arsse/Lang/Exception.defaultFileMissing', TestClass::DEFAULT)); } @@ -74,7 +74,7 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testFetchAMessage */ - public function testFetchAMessageWithMultipleNumericParameters():void { + public function testFetchAMessageWithMultipleNumericParameters(): void { $this->l->set("en_ca", true); $this->assertEquals('Happy Rotter and the Philosopher\'s Stone', $this->l->msg('Test.presentText', ['Happy Rotter', 'the Philosopher\'s Stone'])); } @@ -82,14 +82,14 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testFetchAMessage */ - public function testFetchAMessageWithNamedParameters():void { + public function testFetchAMessageWithNamedParameters(): void { $this->assertEquals('Message string "Test.absentText" missing from all loaded language files (en)', $this->l->msg('Exception.JKingWeb/Arsse/Lang/Exception.stringMissing', ['msgID' => 'Test.absentText', 'fileList' => 'en'])); } /** * @depends testFetchAMessage */ - public function testReloadDefaultStrings():void { + public function testReloadDefaultStrings(): void { $this->l->set("de", true); $this->l->set("en", true); $this->assertEquals('and the Philosopher\'s Stone', $this->l->msg('Test.presentText')); @@ -98,7 +98,7 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest { /** * @depends testFetchAMessage */ - public function testReloadGeneralTagAfterSubtag():void { + public function testReloadGeneralTagAfterSubtag(): void { $this->l->set("en", true); $this->l->set("en_us", true); $this->assertEquals('and the Sorcerer\'s Stone', $this->l->msg('Test.presentText')); diff --git a/tests/cases/Lang/TestErrors.php b/tests/cases/Lang/TestErrors.php index e8774846..8c995062 100644 --- a/tests/cases/Lang/TestErrors.php +++ b/tests/cases/Lang/TestErrors.php @@ -16,65 +16,65 @@ class TestErrors extends \JKingWeb\Arsse\Test\AbstractTest { public $path; public $l; - public function setUpSeries():void { + public function setUpSeries(): void { $this->l->set("", true); } - public function testLoadEmptyFile():void { + public function testLoadEmptyFile(): void { $this->assertException("fileCorrupt", "Lang"); $this->l->set("fr_ca", true); } - public function testLoadFileWhichDoesNotReturnAnArray():void { + public function testLoadFileWhichDoesNotReturnAnArray(): void { $this->assertException("fileCorrupt", "Lang"); $this->l->set("it", true); } - public function testLoadFileWhichIsNotPhp():void { + public function testLoadFileWhichIsNotPhp(): void { $this->assertException("fileCorrupt", "Lang"); $this->l->set("ko", true); } - public function testLoadFileWhichIsCorrupt():void { + public function testLoadFileWhichIsCorrupt(): void { $this->assertException("fileCorrupt", "Lang"); $this->l->set("zh", true); } - public function testLoadFileWithooutReadPermission():void { + public function testLoadFileWithooutReadPermission(): void { $this->assertException("fileUnreadable", "Lang"); $this->l->set("ru", true); } - public function testLoadSubtagOfMissingLanguage():void { + public function testLoadSubtagOfMissingLanguage(): void { $this->assertException("fileMissing", "Lang"); $this->l->set("pt_br", true); } - public function testFetchInvalidMessage():void { + public function testFetchInvalidMessage(): void { $this->assertException("stringInvalid", "Lang"); $this->l->set("vi", true); $txt = $this->l->msg('Test.presentText'); } - public function testFetchMissingMessage():void { + public function testFetchMissingMessage(): void { $this->assertException("stringMissing", "Lang"); $txt = $this->l->msg('Test.absentText'); } - public function testLoadMissingDefaultLanguage():void { + public function testLoadMissingDefaultLanguage(): void { unlink($this->path.TestClass::DEFAULT.".php"); $this->assertException("defaultFileMissing", "Lang"); $this->l->set("fr", true); } - public function testLoadMissingLanguageWhenFetching():void { + public function testLoadMissingLanguageWhenFetching(): void { $this->l->set("en_ca"); unlink($this->path.TestClass::DEFAULT.".php"); $this->assertException("fileMissing", "Lang"); $this->l->msg('Test.presentText'); } - public function testLoadMissingDefaultLanguageWhenFetching():void { + public function testLoadMissingDefaultLanguageWhenFetching(): void { unlink($this->path.TestClass::DEFAULT.".php"); $this->l = new TestClass($this->path); $this->assertException("stringMissing", "Lang"); diff --git a/tests/cases/Misc/TestContext.php b/tests/cases/Misc/TestContext.php index 8ebb5151..b4f51c5c 100644 --- a/tests/cases/Misc/TestContext.php +++ b/tests/cases/Misc/TestContext.php @@ -11,7 +11,7 @@ use JKingWeb\Arsse\Misc\ValueInfo; /** @covers \JKingWeb\Arsse\Context\Context */ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { - public function testVerifyInitialState():void { + public function testVerifyInitialState(): void { $c = new Context; foreach ((new \ReflectionObject($c))->getMethods(\ReflectionMethod::IS_PUBLIC) as $m) { if ($m->isStatic() || strpos($m->name, "__") === 0) { @@ -23,7 +23,7 @@ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testSetContextOptions():void { + public function testSetContextOptions(): void { $v = [ 'reverse' => true, 'limit' => 10, @@ -85,7 +85,7 @@ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testCleanIdArrayValues():void { + public function testCleanIdArrayValues(): void { $methods = ["articles", "editions", "tags", "labels", "subscriptions"]; $in = [1, "2", 3.5, 4.0, 4, "ook", 0, -20, true, false, null, new \DateTime(), -1.0]; $out = [1, 2, 4]; @@ -95,7 +95,7 @@ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testCleanFolderIdArrayValues():void { + public function testCleanFolderIdArrayValues(): void { $methods = ["folders", "foldersShallow"]; $in = [1, "2", 3.5, 4.0, 4, "ook", 0, -20, true, false, null, new \DateTime(), -1.0]; $out = [1, 2, 4, 0]; @@ -105,7 +105,7 @@ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testCleanStringArrayValues():void { + public function testCleanStringArrayValues(): void { $methods = ["searchTerms", "annotationTerms", "titleTerms", "authorTerms", "tagNames", "labelNames"]; $now = new \DateTime; $in = [1, 3.0, "ook", 0, true, false, null, $now, ""]; @@ -116,7 +116,7 @@ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testCloneAContext():void { + public function testCloneAContext(): void { $c1 = new Context; $c2 = clone $c1; $this->assertEquals($c1, $c2); diff --git a/tests/cases/Misc/TestDate.php b/tests/cases/Misc/TestDate.php index 229c3108..5c16d352 100644 --- a/tests/cases/Misc/TestDate.php +++ b/tests/cases/Misc/TestDate.php @@ -14,7 +14,7 @@ class TestDate extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testNormalizeADate():void { + public function testNormalizeADate(): void { $exp = new \DateTimeImmutable("2018-01-01T00:00:00Z"); $this->assertEquals($exp, Date::normalize(1514764800)); $this->assertEquals($exp, Date::normalize("2018-01-01T00:00:00")); @@ -26,7 +26,7 @@ class TestDate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertNull(Date::normalize("2018-01-01T00:00:00Z", "http")); } - public function testFormatADate():void { + public function testFormatADate(): void { $test = new \DateTimeImmutable("2018-01-01T00:00:00Z"); $this->assertNull(Date::transform(null, "http")); $this->assertNull(Date::transform("ook", "http")); @@ -40,7 +40,7 @@ class TestDate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(1514764800.265579, Date::transform("2018-01-01T00:00:00.265579Z", "float", "iso8601m")); } - public function testMoveDateForward():void { + public function testMoveDateForward(): void { $test = new \DateTimeImmutable("2018-01-01T00:00:00Z"); $this->assertNull(Date::add("P1D", null)); $this->assertNull(Date::add("P1D", "ook")); @@ -49,7 +49,7 @@ class TestDate extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertNull(Date::add("ook", $test)); } - public function testMoveDateBack():void { + public function testMoveDateBack(): void { $test = new \DateTimeImmutable("2018-01-01T00:00:00Z"); $this->assertNull(Date::sub("P1D", null)); $this->assertNull(Date::sub("P1D", "ook")); diff --git a/tests/cases/Misc/TestHTTP.php b/tests/cases/Misc/TestHTTP.php index d951af7c..04199d10 100644 --- a/tests/cases/Misc/TestHTTP.php +++ b/tests/cases/Misc/TestHTTP.php @@ -12,7 +12,7 @@ use Psr\Http\Message\ResponseInterface; /** @covers \JKingWeb\Arsse\Misc\HTTP */ class TestHTTP extends \JKingWeb\Arsse\Test\AbstractTest { /** @dataProvider provideMediaTypes */ - public function testMatchMediaType(string $header, array $types, bool $exp):void { + public function testMatchMediaType(string $header, array $types, bool $exp): void { $msg = (new \Laminas\Diactoros\Request)->withHeader("Content-Type", $header); $this->assertSame($exp, HTTP::matchType($msg, ...$types)); $msg = (new \Laminas\Diactoros\Response)->withHeader("Content-Type", $header); diff --git a/tests/cases/Misc/TestQuery.php b/tests/cases/Misc/TestQuery.php index d784d91e..7d94f90d 100644 --- a/tests/cases/Misc/TestQuery.php +++ b/tests/cases/Misc/TestQuery.php @@ -11,14 +11,14 @@ use JKingWeb\Arsse\Misc\ValueInfo; /** @covers \JKingWeb\Arsse\Misc\Query */ class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest { - public function testBasicQuery():void { + public function testBasicQuery(): void { $q = new Query("select * from table where a = ?", "int", 3); $this->assertSame("select * from table where a = ?", $q->getQuery()); $this->assertSame(["int"], $q->getTypes()); $this->assertSame([3], $q->getValues()); } - public function testWhereQuery():void { + public function testWhereQuery(): void { // simple where clause $q = (new Query("select * from table"))->setWhere("a = ?", "int", 3); $this->assertSame("select * from table WHERE a = ?", $q->getQuery()); @@ -46,21 +46,21 @@ class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame([2, 4, 1, 3], $q->getValues()); } - public function testGroupedQuery():void { + public function testGroupedQuery(): void { $q = (new Query("select col1, col2, count(*) as count from table"))->setGroup("col1", "col2"); $this->assertSame("select col1, col2, count(*) as count from table GROUP BY col1, col2", $q->getQuery()); $this->assertSame([], $q->getTypes()); $this->assertSame([], $q->getValues()); } - public function testOrderedQuery():void { + public function testOrderedQuery(): void { $q = (new Query("select col1, col2, col3 from table"))->setOrder("col1 desc", "col2")->setOrder("col3 asc"); $this->assertSame("select col1, col2, col3 from table ORDER BY col1 desc, col2, col3 asc", $q->getQuery()); $this->assertSame([], $q->getTypes()); $this->assertSame([], $q->getValues()); } - public function testLimitedQuery():void { + public function testLimitedQuery(): void { // no offset $q = (new Query("select * from table"))->setLimit(5); $this->assertSame("select * from table LIMIT 5", $q->getQuery()); @@ -78,7 +78,7 @@ class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame([], $q->getValues()); } - public function testQueryWithCommonTableExpression():void { + public function testQueryWithCommonTableExpression(): void { $q = (new Query("select * from table where a in (select * from cte where a = ?)", "int", 1))->setCTE("cte", "select * from other_table where a = ? and b = ?", ["str", "str"], [2, 3]); $this->assertSame("WITH RECURSIVE cte as (select * from other_table where a = ? and b = ?) select * from table where a in (select * from cte where a = ?)", $q->getQuery()); $this->assertSame(["str", "str", "int"], $q->getTypes()); @@ -90,7 +90,7 @@ class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame([2, 3, 4, 5, 1], $q->getValues()); } - public function testQueryWithPushedCommonTableExpression():void { + public function testQueryWithPushedCommonTableExpression(): void { $q = (new Query("select * from table1"))->setWhere("a between ? and ?", ["datetime", "datetime"], [1, 2]) ->setCTE("cte1", "select * from table2 where a = ? and b = ?", ["str", "str"], [3, 4]) ->pushCTE("cte2") @@ -100,7 +100,7 @@ class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame([3, 4, 1, 2, 5], $q->getValues()); } - public function testComplexQuery():void { + public function testComplexQuery(): void { $q = (new query("select *, ? as const from table", "datetime", 1)) ->setWhereNot("b = ?", "bool", 2) ->setGroup("col1", "col2") diff --git a/tests/cases/Misc/TestURL.php b/tests/cases/Misc/TestURL.php index 7cf1554f..46f5886a 100644 --- a/tests/cases/Misc/TestURL.php +++ b/tests/cases/Misc/TestURL.php @@ -15,7 +15,7 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideNormalizations */ - public function testNormalizeAUrl(string $url, string $exp, string $user = null, string $pass = null):void { + public function testNormalizeAUrl(string $url, string $exp, string $user = null, string $pass = null): void { $this->assertSame($exp, URL::normalize($url, $user, $pass)); } @@ -77,7 +77,7 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideQueries */ - public function testAppendQueryParameters(string $url, string $query, string $exp):void { + public function testAppendQueryParameters(string $url, string $query, string $exp): void { $this->assertSame($exp, URL::queryAppend($url, $query)); } @@ -93,7 +93,7 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideAbsolutes */ - public function testDetermineAbsoluteness(bool $exp, string $url):void { + public function testDetermineAbsoluteness(bool $exp, string $url): void { $this->assertSame($exp, URL::absolute($url)); } diff --git a/tests/cases/Misc/TestValueInfo.php b/tests/cases/Misc/TestValueInfo.php index b3b48ca4..a35040b6 100644 --- a/tests/cases/Misc/TestValueInfo.php +++ b/tests/cases/Misc/TestValueInfo.php @@ -16,7 +16,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testGetIntegerInfo():void { + public function testGetIntegerInfo(): void { $tests = [ [null, I::NULL], ["", I::NULL], @@ -91,7 +91,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, I::int($value), "Test returned ".decbin(I::int($value))." for value: ".var_export($value, true)); } } - public function testGetStringInfo():void { + public function testGetStringInfo(): void { $tests = [ [null, I::NULL], ["", I::VALID | I::EMPTY], @@ -162,7 +162,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testValidateDatabaseIdentifier():void { + public function testValidateDatabaseIdentifier(): void { $tests = [ [null, false, true], ["", false, true], @@ -234,7 +234,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testValidateBoolean():void { + public function testValidateBoolean(): void { $tests = [ [null, null], ["", false], @@ -310,7 +310,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideSimpleNormalizationValues */ - public function testNormalizeSimpleValues($input, string $typeName, $exp, bool $pass, bool $strict, bool $drop):void { + public function testNormalizeSimpleValues($input, string $typeName, $exp, bool $pass, bool $strict, bool $drop): void { $assert = function($exp, $act, string $msg) { if (is_null($exp)) { $this->assertNull($act, $msg); @@ -366,7 +366,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideDateNormalizationValues */ - public function testNormalizeDateValues($input, $format, $exp, bool $strict, bool $drop):void { + public function testNormalizeDateValues($input, $format, $exp, bool $strict, bool $drop): void { if ($strict && $drop) { $modeName = "strict drop"; $modeConst = I::M_STRICT | I::M_DROP; @@ -397,7 +397,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testNormalizeComplexValues():void { + public function testNormalizeComplexValues(): void { // Array-mode tests $tests = [ [I::T_INT | I::M_DROP, [1, 2, 2.2, 3], [1,2,null,3] ], @@ -640,7 +640,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { return $out; } - public function testFlattenArray():void { + public function testFlattenArray(): void { $arr = [1, [2, 3, [4, 5]], 6, [[7, 8], 9, 10]]; $exp = range(1, 10); $this->assertSame($exp, I::flatten($arr)); diff --git a/tests/cases/REST/Fever/TestAPI.php b/tests/cases/REST/Fever/TestAPI.php index fd892b06..6bdce399 100644 --- a/tests/cases/REST/Fever/TestAPI.php +++ b/tests/cases/REST/Fever/TestAPI.php @@ -173,7 +173,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideTokenAuthenticationRequests */ - public function testAuthenticateAUserToken(bool $httpRequired, bool $tokenEnforced, string $httpUser = null, array $dataPost, array $dataGet, ResponseInterface $exp):void { + public function testAuthenticateAUserToken(bool $httpRequired, bool $tokenEnforced, string $httpUser = null, array $dataPost, array $dataGet, ResponseInterface $exp): void { self::setConf([ 'userHTTPAuthRequired' => $httpRequired, 'userSessionEnforced' => $tokenEnforced, @@ -244,7 +244,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testListGroups():void { + public function testListGroups(): void { \Phake::when(Arsse::$db)->tagList(Arsse::$user->id)->thenReturn(new Result([ ['id' => 1, 'name' => "Fascinating", 'subscriptions' => 2], ['id' => 2, 'name' => "Interesting", 'subscriptions' => 2], @@ -271,7 +271,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function testListFeeds():void { + public function testListFeeds(): void { \Phake::when(Arsse::$db)->subscriptionList(Arsse::$user->id)->thenReturn(new Result([ ['id' => 1, 'feed' => 5, 'title' => "Ankh-Morpork News", 'url' => "http://example.com/feed", 'source' => "http://example.com/", 'edited' => "2019-01-01 21:12:00", 'favicon' => "http://example.com/favicon.ico"], ['id' => 2, 'feed' => 9, 'title' => "Ook, Ook Eek Ook!", 'url' => "http://example.net/feed", 'source' => "http://example.net/", 'edited' => "1988-06-24 12:21:00", 'favicon' => ""], @@ -299,7 +299,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideItemListContexts */ - public function testListItems(string $url, Context $c, bool $desc):void { + public function testListItems(string $url, Context $c, bool $desc): void { $fields = ["id", "subscription", "title", "author", "content", "url", "starred", "unread", "published_date"]; $order = [$desc ? "id desc" : "id"]; \Phake::when(Arsse::$db)->articleList->thenReturn(new Result($this->articles['db'])); @@ -329,7 +329,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testListItemIds():void { + public function testListItemIds(): void { $saved = [['id' => 1],['id' => 2],['id' => 3]]; $unread = [['id' => 4],['id' => 5],['id' => 6]]; \Phake::when(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->starred(true))->thenReturn(new Result($saved)); @@ -344,7 +344,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->h->dispatch($this->req("api&unread_item_ids"))); } - public function testListHotLinks():void { + public function testListHotLinks(): void { // hot links are not actually implemented, so an empty array should be all we get $exp = new JsonResponse([ 'links' => [] @@ -353,7 +353,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideMarkingContexts */ - public function testSetMarks(string $post, Context $c, array $data, array $out):void { + public function testSetMarks(string $post, Context $c, array $data, array $out): void { $saved = [['id' => 1],['id' => 2],['id' => 3]]; $unread = [['id' => 4],['id' => 5],['id' => 6]]; \Phake::when(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->starred(true))->thenReturn(new Result($saved)); @@ -371,7 +371,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideMarkingContexts */ - public function testSetMarksWithQuery(string $get, Context $c, array $data, array $out):void { + public function testSetMarksWithQuery(string $get, Context $c, array $data, array $out): void { $saved = [['id' => 1],['id' => 2],['id' => 3]]; $unread = [['id' => 4],['id' => 5],['id' => 6]]; \Phake::when(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->starred(true))->thenReturn(new Result($saved)); @@ -427,7 +427,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideInvalidRequests */ - public function testSendInvalidRequests(ServerRequest $req, ResponseInterface $exp):void { + public function testSendInvalidRequests(ServerRequest $req, ResponseInterface $exp): void { $this->assertMessage($exp, $this->h->dispatch($req)); } @@ -439,7 +439,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testMakeABaseQuery():void { + public function testMakeABaseQuery(): void { $this->h = \Phake::partialMock(API::class); \Phake::when($this->h)->logIn->thenReturn(true); \Phake::when(Arsse::$db)->subscriptionRefreshed(Arsse::$user->id)->thenReturn(new \DateTimeImmutable("2000-01-01T00:00:00Z")); @@ -467,7 +467,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function testUndoReadMarks():void { + public function testUndoReadMarks(): void { $unread = [['id' => 4],['id' => 5],['id' => 6]]; $out = ['unread_item_ids' => "4,5,6"]; \Phake::when(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->limit(1), ["marked_date"], ["marked_date desc"])->thenReturn(new Result([['marked_date' => "2000-01-01 00:00:00"]])); @@ -483,7 +483,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->articleMark; // only called one time, above } - public function testOutputToXml():void { + public function testOutputToXml(): void { \Phake::when($this->h)->processRequest->thenReturn([ 'items' => $this->articles['rest'], 'total_items' => 1024, @@ -493,13 +493,13 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function testListFeedIcons():void { + public function testListFeedIcons(): void { $act = $this->h->dispatch($this->req("api&favicons")); $exp = new JsonResponse(['favicons' => [['id' => 0, 'data' => API::GENERIC_ICON_TYPE.",".API::GENERIC_ICON_DATA]]]); $this->assertMessage($exp, $act); } - public function testAnswerOptionsRequest():void { + public function testAnswerOptionsRequest(): void { $act = $this->h->dispatch($this->req("api", "", "OPTIONS")); $exp = new EmptyResponse(204, [ 'Allow' => "POST", diff --git a/tests/cases/REST/Fever/TestUser.php b/tests/cases/REST/Fever/TestUser.php index 695ea933..d6bab6df 100644 --- a/tests/cases/REST/Fever/TestUser.php +++ b/tests/cases/REST/Fever/TestUser.php @@ -36,7 +36,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider providePasswordCreations */ - public function testRegisterAUserPassword(string $user, string $password = null, $exp):void { + public function testRegisterAUserPassword(string $user, string $password = null, $exp): void { \Phake::when(Arsse::$user)->generatePassword->thenReturn("RANDOM_PASSWORD"); \Phake::when(Arsse::$db)->tokenCreate->thenReturnCallback(function($user, $class, $id = null) { return $id ?? "RANDOM_TOKEN"; @@ -66,7 +66,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testUnregisterAUser():void { + public function testUnregisterAUser(): void { \Phake::when(Arsse::$db)->tokenRevoke->thenReturn(3); $this->assertTrue($this->u->unregister("jane.doe@example.com")); \Phake::verify(Arsse::$db)->tokenRevoke("jane.doe@example.com", "fever.login"); @@ -76,7 +76,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserAuthenticationRequests */ - public function testAuthenticateAUserName(string $user, string $password, bool $exp):void { + public function testAuthenticateAUserName(string $user, string $password, bool $exp): void { \Phake::when(Arsse::$db)->tokenLookup->thenThrow(new ExceptionInput("constraintViolation")); \Phake::when(Arsse::$db)->tokenLookup("fever.login", md5("jane.doe@example.com:secret"))->thenReturn(['user' => "jane.doe@example.com"]); \Phake::when(Arsse::$db)->tokenLookup("fever.login", md5("john.doe@example.com:superman"))->thenReturn(['user' => "john.doe@example.com"]); diff --git a/tests/cases/REST/NextcloudNews/TestV1_2.php b/tests/cases/REST/NextcloudNews/TestV1_2.php index 25b98a82..dfe30083 100644 --- a/tests/cases/REST/NextcloudNews/TestV1_2.php +++ b/tests/cases/REST/NextcloudNews/TestV1_2.php @@ -333,13 +333,13 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { return $value; } - public function testSendAuthenticationChallenge():void { + public function testSendAuthenticationChallenge(): void { $exp = new EmptyResponse(401); $this->assertMessage($exp, $this->req("GET", "/", "", [], false)); } /** @dataProvider provideInvalidPaths */ - public function testRespondToInvalidPaths($path, $method, $code, $allow = null):void { + public function testRespondToInvalidPaths($path, $method, $code, $allow = null): void { $exp = new EmptyResponse($code, $allow ? ['Allow' => $allow] : []); $this->assertMessage($exp, $this->req($method, $path)); } @@ -371,7 +371,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testRespondToInvalidInputTypes():void { + public function testRespondToInvalidInputTypes(): void { $exp = new EmptyResponse(415, ['Accept' => "application/json"]); $this->assertMessage($exp, $this->req("PUT", "/folders/1", '', ['Content-Type' => "application/xml"])); $exp = new EmptyResponse(400); @@ -380,7 +380,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideOptionsRequests */ - public function testRespondToOptionsRequests(string $url, string $allow, string $accept):void { + public function testRespondToOptionsRequests(string $url, string $allow, string $accept): void { $exp = new EmptyResponse(204, [ 'Allow' => $allow, 'Accept' => $accept, @@ -396,7 +396,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testListFolders():void { + public function testListFolders(): void { $list = [ ['id' => 1, 'name' => "Software", 'parent' => null], ['id' => 12, 'name' => "Hardware", 'parent' => null], @@ -411,9 +411,9 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideFolderCreations */ - public function testAddAFolder(array $input, bool $body, $output, ResponseInterface $exp):void { + public function testAddAFolder(array $input, bool $body, $output, ResponseInterface $exp): void { if ($output instanceof ExceptionInput) { - \Phake::when(Arsse::$db)->folderAdd->thenThrow($output); + \Phake::when(Arsse::$db)->folderAdd->thenThrow($output); } else { \Phake::when(Arsse::$db)->folderAdd->thenReturn($output); \Phake::when(Arsse::$db)->folderPropertiesGet->thenReturn($this->v(['id' => $output, 'name' => $input['name'], 'parent' => null])); @@ -441,7 +441,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testRemoveAFolder():void { + public function testRemoveAFolder(): void { \Phake::when(Arsse::$db)->folderRemove(Arsse::$user->id, 1)->thenReturn(true)->thenThrow(new ExceptionInput("subjectMissing")); $exp = new EmptyResponse(204); $this->assertMessage($exp, $this->req("DELETE", "/folders/1")); @@ -452,7 +452,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideFolderRenamings */ - public function testRenameAFolder(array $input, int $id, $output, ResponseInterface $exp):void { + public function testRenameAFolder(array $input, int $id, $output, ResponseInterface $exp): void { if ($output instanceof ExceptionInput) { \Phake::when(Arsse::$db)->folderPropertiesSet->thenThrow($output); } else { @@ -474,7 +474,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testRetrieveServerVersion():void { + public function testRetrieveServerVersion(): void { $exp = new Response([ 'version' => V1_2::VERSION, 'arsse_version' => Arsse::VERSION, @@ -482,7 +482,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("GET", "/version")); } - public function testListSubscriptions():void { + public function testListSubscriptions(): void { $exp1 = [ 'feeds' => [], 'starredCount' => 0, @@ -502,7 +502,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideNewSubscriptions */ - public function testAddASubscription(array $input, $id, int $latestEdition, array $output, $moveOutcome, ResponseInterface $exp):void { + public function testAddASubscription(array $input, $id, int $latestEdition, array $output, $moveOutcome, ResponseInterface $exp): void { if ($id instanceof \Exception) { \Phake::when(Arsse::$db)->subscriptionAdd->thenThrow($id); } else { @@ -528,7 +528,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { if ($input['folderId'] ?? 0) { \Phake::verify(Arsse::$db)->subscriptionPropertiesSet(Arsse::$user->id, $id, ['folder' => (int) $input['folderId']]); } else { - \Phake::verify(Arsse::$db, \Phake::times(0))->subscriptionPropertiesSet; + \Phake::verify(Arsse::$db, \Phake::times(0))->subscriptionPropertiesSet; } } } @@ -545,7 +545,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testRemoveASubscription():void { + public function testRemoveASubscription(): void { \Phake::when(Arsse::$db)->subscriptionRemove(Arsse::$user->id, 1)->thenReturn(true)->thenThrow(new ExceptionInput("subjectMissing")); $exp = new EmptyResponse(204); $this->assertMessage($exp, $this->req("DELETE", "/feeds/1")); @@ -555,7 +555,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db, \Phake::times(2))->subscriptionRemove(Arsse::$user->id, 1); } - public function testMoveASubscription():void { + public function testMoveASubscription(): void { $in = [ ['folderId' => 0], ['folderId' => 42], @@ -583,7 +583,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("PUT", "/feeds/1/move", json_encode($in[5]))); } - public function testRenameASubscription():void { + public function testRenameASubscription(): void { $in = [ ['feedTitle' => null], ['feedTitle' => "Ook"], @@ -613,7 +613,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("PUT", "/feeds/1/rename", json_encode($in[6]))); } - public function testListStaleFeeds():void { + public function testListStaleFeeds(): void { $out = [ [ 'id' => 42, @@ -629,7 +629,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("GET", "/feeds/all")); } - public function testUpdateAFeed():void { + public function testUpdateAFeed(): void { $in = [ ['feedId' => 42], // valid ['feedId' => 2112], // feed does not exist @@ -650,7 +650,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("GET", "/feeds/update", json_encode($in[4]))); } - public function testListArticles():void { + public function testListArticles(): void { $t = new \DateTime; $in = [ ['type' => 0, 'id' => 42], // type=0 => subscription/feed @@ -704,7 +704,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->limit(5), $this->anything(), ["edition desc"]); } - public function testMarkAFolderRead():void { + public function testMarkAFolderRead(): void { $read = ['read' => true]; $in = json_encode(['newestItemId' => 2112]); \Phake::when(Arsse::$db)->articleMark(Arsse::$user->id, $read, (new Context)->folder(1)->latestEdition(2112))->thenReturn(42); @@ -719,7 +719,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("PUT", "/folders/42/read", $in)); } - public function testMarkASubscriptionRead():void { + public function testMarkASubscriptionRead(): void { $read = ['read' => true]; $in = json_encode(['newestItemId' => 2112]); \Phake::when(Arsse::$db)->articleMark(Arsse::$user->id, $read, (new Context)->subscription(1)->latestEdition(2112))->thenReturn(42); @@ -734,7 +734,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("PUT", "/feeds/42/read", $in)); } - public function testMarkAllItemsRead():void { + public function testMarkAllItemsRead(): void { $read = ['read' => true]; $in = json_encode(['newestItemId' => 2112]); \Phake::when(Arsse::$db)->articleMark(Arsse::$user->id, $read, (new Context)->latestEdition(2112))->thenReturn(42); @@ -746,7 +746,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("PUT", "/items/read?newestItemId=ook")); } - public function testChangeMarksOfASingleArticle():void { + public function testChangeMarksOfASingleArticle(): void { $read = ['read' => true]; $unread = ['read' => false]; $star = ['starred' => true]; @@ -772,7 +772,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db, \Phake::times(8))->articleMark(Arsse::$user->id, $this->anything(), $this->anything()); } - public function testChangeMarksOfMultipleArticles():void { + public function testChangeMarksOfMultipleArticles(): void { $read = ['read' => true]; $unread = ['read' => false]; $star = ['starred' => true]; @@ -827,7 +827,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db, \Phake::atLeast(1))->articleMark(Arsse::$user->id, $unstar, (new Context)->articles($in[1])); } - public function testQueryTheServerStatus():void { + public function testQueryTheServerStatus(): void { $interval = Arsse::$conf->serviceFrequency; $valid = (new \DateTimeImmutable("now", new \DateTimezone("UTC")))->sub($interval); $invalid = $valid->sub($interval)->sub($interval); @@ -847,21 +847,21 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("GET", "/status")); } - public function testCleanUpBeforeUpdate():void { + public function testCleanUpBeforeUpdate(): void { \Phake::when(Arsse::$db)->feedCleanup()->thenReturn(true); $exp = new EmptyResponse(204); $this->assertMessage($exp, $this->req("GET", "/cleanup/before-update")); \Phake::verify(Arsse::$db)->feedCleanup(); } - public function testCleanUpAfterUpdate():void { + public function testCleanUpAfterUpdate(): void { \Phake::when(Arsse::$db)->articleCleanup()->thenReturn(true); $exp = new EmptyResponse(204); $this->assertMessage($exp, $this->req("GET", "/cleanup/after-update")); \Phake::verify(Arsse::$db)->articleCleanup(); } - public function testQueryTheUserStatus():void { + public function testQueryTheUserStatus(): void { $act = $this->req("GET", "/user"); $exp = new Response([ 'userId' => Arsse::$user->id, @@ -872,7 +872,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function testPreferJsonOverQueryParameters():void { + public function testPreferJsonOverQueryParameters(): void { $in = ['name' => "Software"]; $url = "/folders?name=Hardware"; $out1 = ['id' => 1, 'name' => "Software"]; @@ -885,7 +885,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("POST", "/folders?name=Hardware", json_encode($in))); } - public function testMeldJsonAndQueryParameters():void { + public function testMeldJsonAndQueryParameters(): void { $in = ['oldestFirst' => true]; $url = "/items?type=2"; \Phake::when(Arsse::$db)->articleList->thenReturn(new Result([])); diff --git a/tests/cases/REST/NextcloudNews/TestVersions.php b/tests/cases/REST/NextcloudNews/TestVersions.php index ba849c59..ba0ae3a0 100644 --- a/tests/cases/REST/NextcloudNews/TestVersions.php +++ b/tests/cases/REST/NextcloudNews/TestVersions.php @@ -25,24 +25,24 @@ class TestVersions extends \JKingWeb\Arsse\Test\AbstractTest { return (new Versions)->dispatch($req); } - public function testFetchVersionList():void { + public function testFetchVersionList(): void { $exp = new Response(['apiLevels' => ['v1-2']]); $this->assertMessage($exp, $this->req("GET", "/")); $this->assertMessage($exp, $this->req("GET", "/")); $this->assertMessage($exp, $this->req("GET", "/")); } - public function testRespondToOptionsRequest():void { + public function testRespondToOptionsRequest(): void { $exp = new EmptyResponse(204, ['Allow' => "HEAD,GET"]); $this->assertMessage($exp, $this->req("OPTIONS", "/")); } - public function testUseIncorrectMethod():void { + public function testUseIncorrectMethod(): void { $exp = new EmptyResponse(405, ['Allow' => "HEAD,GET"]); $this->assertMessage($exp, $this->req("POST", "/")); } - public function testUseIncorrectPath():void { + public function testUseIncorrectPath(): void { $exp = new EmptyResponse(404); $this->assertMessage($exp, $this->req("GET", "/ook")); $this->assertMessage($exp, $this->req("OPTIONS", "/ook")); diff --git a/tests/cases/REST/TestREST.php b/tests/cases/REST/TestREST.php index 821ab308..3983fd29 100644 --- a/tests/cases/REST/TestREST.php +++ b/tests/cases/REST/TestREST.php @@ -25,7 +25,7 @@ use Laminas\Diactoros\Response\EmptyResponse; class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { /** @dataProvider provideApiMatchData */ - public function testMatchAUrlToAnApi($apiList, string $input, array $exp):void { + public function testMatchAUrlToAnApi($apiList, string $input, array $exp): void { $r = new REST($apiList); try { $out = $r->apiMatch($input); @@ -61,7 +61,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideAuthenticableRequests */ - public function testAuthenticateRequests(array $serverParams, array $expAttr):void { + public function testAuthenticateRequests(array $serverParams, array $expAttr): void { $r = new REST(); // create a mock user manager Arsse::$user = \Phake::mock(User::class); @@ -93,7 +93,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testSendAuthenticationChallenges():void { + public function testSendAuthenticationChallenges(): void { self::setConf(); $r = new REST(); $in = new EmptyResponse(401); @@ -106,7 +106,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUnnormalizedOrigins */ - public function testNormalizeOrigins(string $origin, string $exp, array $ports = null):void { + public function testNormalizeOrigins(string $origin, string $exp, array $ports = null): void { $r = new REST(); $act = $r->corsNormalizeOrigin($origin, $ports); $this->assertSame($exp, $act); @@ -149,7 +149,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideCorsNegotiations */ - public function testNegotiateCors($origin, bool $exp, string $allowed = null, string $denied = null):void { + public function testNegotiateCors($origin, bool $exp, string $allowed = null, string $denied = null): void { self::setConf(); $r = \Phake::partialMock(REST::class); \Phake::when($r)->corsNormalizeOrigin->thenReturnCallback(function($origin) { @@ -187,7 +187,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideCorsHeaders */ - public function testAddCorsHeaders(string $reqMethod, array $reqHeaders, array $resHeaders, array $expHeaders):void { + public function testAddCorsHeaders(string $reqMethod, array $reqHeaders, array $resHeaders, array $expHeaders): void { $r = new REST(); $req = new Request("", $reqMethod, "php://memory", $reqHeaders); $res = new EmptyResponse(204, $resHeaders); @@ -251,7 +251,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUnnormalizedResponses */ - public function testNormalizeHttpResponses(ResponseInterface $res, ResponseInterface $exp, RequestInterface $req = null):void { + public function testNormalizeHttpResponses(ResponseInterface $res, ResponseInterface $exp, RequestInterface $req = null): void { $r = \Phake::partialMock(REST::class); \Phake::when($r)->corsNegotiate->thenReturn(true); \Phake::when($r)->challenge->thenReturnCallback(function($res) { @@ -286,7 +286,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testCreateHandlers():void { + public function testCreateHandlers(): void { $r = new REST(); foreach (REST::API_LIST as $api) { $class = $api['class']; @@ -295,7 +295,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideMockRequests */ - public function testDispatchRequests(ServerRequest $req, string $method, bool $called, string $class = "", string $target =""):void { + public function testDispatchRequests(ServerRequest $req, string $method, bool $called, string $class = "", string $target =""): void { $r = \Phake::partialMock(REST::class); \Phake::when($r)->normalizeResponse->thenReturnCallback(function($res) { return $res; diff --git a/tests/cases/REST/TinyTinyRSS/TestAPI.php b/tests/cases/REST/TinyTinyRSS/TestAPI.php index b6be644a..8f94c76c 100644 --- a/tests/cases/REST/TinyTinyRSS/TestAPI.php +++ b/tests/cases/REST/TinyTinyRSS/TestAPI.php @@ -178,7 +178,7 @@ LONG_STRING; self::clearData(); } - public function testHandleInvalidPaths():void { + public function testHandleInvalidPaths(): void { $exp = $this->respErr("MALFORMED_INPUT", [], null); $this->assertMessage($exp, $this->req(null, "POST", "", "")); $this->assertMessage($exp, $this->req(null, "POST", "/", "")); @@ -187,7 +187,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req(null, "POST", "/bad/path", "")); } - public function testHandleOptionsRequest():void { + public function testHandleOptionsRequest(): void { $exp = new EmptyResponse(204, [ 'Allow' => "POST", 'Accept' => "application/json, text/json", @@ -195,14 +195,14 @@ LONG_STRING; $this->assertMessage($exp, $this->req(null, "OPTIONS", "", "")); } - public function testHandleInvalidData():void { + public function testHandleInvalidData(): void { $exp = $this->respErr("MALFORMED_INPUT", [], null); $this->assertMessage($exp, $this->req(null, "POST", "", "This is not valid JSON data")); $this->assertMessage($exp, $this->req(null, "POST", "", "")); // lack of data is also an error } /** @dataProvider provideLoginRequests */ - public function testLogIn(array $conf, $httpUser, array $data, $sessions):void { + public function testLogIn(array $conf, $httpUser, array $data, $sessions): void { Arsse::$user->id = null; self::setConf($conf); \Phake::when(Arsse::$user)->auth->thenReturn(false); @@ -236,7 +236,7 @@ LONG_STRING; } /** @dataProvider provideResumeRequests */ - public function testValidateASession(array $conf, $httpUser, string $data, $result):void { + public function testValidateASession(array $conf, $httpUser, string $data, $result): void { Arsse::$user->id = null; self::setConf($conf); \Phake::when(Arsse::$db)->sessionResume("PriestsOfSyrinx")->thenReturn([ @@ -520,7 +520,7 @@ LONG_STRING; } } - public function testHandleGenericError():void { + public function testHandleGenericError(): void { \Phake::when(Arsse::$user)->auth(Arsse::$user->id, $this->anything())->thenThrow(new \JKingWeb\Arsse\Db\ExceptionTimeout("general")); $data = [ 'op' => "login", @@ -531,7 +531,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($data)); } - public function testLogOut():void { + public function testLogOut(): void { \Phake::when(Arsse::$db)->sessionDestroy->thenReturn(true); $data = [ 'op' => "logout", @@ -542,7 +542,7 @@ LONG_STRING; \Phake::verify(Arsse::$db)->sessionDestroy(Arsse::$user->id, "PriestsOfSyrinx"); } - public function testHandleUnknownMethods():void { + public function testHandleUnknownMethods(): void { $exp = $this->respErr("UNKNOWN_METHOD", ['method' => "thisMethodDoesNotExist"]); $data = [ 'op' => "thisMethodDoesNotExist", @@ -551,7 +551,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($data)); } - public function testHandleMixedCaseMethods():void { + public function testHandleMixedCaseMethods(): void { $data = [ 'op' => "isLoggedIn", 'sid' => "PriestsOfSyrinx", @@ -566,7 +566,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($data)); } - public function testRetrieveServerVersion():void { + public function testRetrieveServerVersion(): void { $data = [ 'op' => "getVersion", 'sid' => "PriestsOfSyrinx", @@ -578,7 +578,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($data)); } - public function testRetrieveProtocolLevel():void { + public function testRetrieveProtocolLevel(): void { $data = [ 'op' => "getApiLevel", 'sid' => "PriestsOfSyrinx", @@ -587,7 +587,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($data)); } - public function testAddACategory():void { + public function testAddACategory(): void { $in = [ ['op' => "addCategory", 'sid' => "PriestsOfSyrinx", 'caption' => "Software"], ['op' => "addCategory", 'sid' => "PriestsOfSyrinx", 'caption' => "Hardware", 'parent_id' => 1], @@ -638,7 +638,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($in[5])); } - public function testRemoveACategory():void { + public function testRemoveACategory(): void { $in = [ ['op' => "removeCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 42], ['op' => "removeCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 2112], @@ -661,7 +661,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(3))->folderRemove(Arsse::$user->id, $this->anything()); } - public function testMoveACategory():void { + public function testMoveACategory(): void { $in = [ ['op' => "moveCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 42, 'parent_id' => 1], ['op' => "moveCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 2112, 'parent_id' => 2], @@ -713,7 +713,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(5))->folderPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything()); } - public function testRenameACategory():void { + public function testRenameACategory(): void { $in = [ ['op' => "renameCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 42, 'caption' => "Ook"], ['op' => "renameCategory", 'sid' => "PriestsOfSyrinx", 'category_id' => 2112, 'caption' => "Eek"], @@ -753,7 +753,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(3))->folderPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything()); } - public function testAddASubscription():void { + public function testAddASubscription(): void { $in = [ ['op' => "subscribeToFeed", 'sid' => "PriestsOfSyrinx", 'feed_url' => "http://example.com/0"], ['op' => "subscribeToFeed", 'sid' => "PriestsOfSyrinx", 'feed_url' => "http://example.com/1", 'category_id' => 42], @@ -828,7 +828,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(0))->subscriptionPropertiesSet(Arsse::$user->id, 4, ['folder' => 1]); } - public function testRemoveASubscription():void { + public function testRemoveASubscription(): void { $in = [ ['op' => "unsubscribeFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 42], ['op' => "unsubscribeFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 2112], @@ -850,7 +850,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(5))->subscriptionRemove(Arsse::$user->id, $this->anything()); } - public function testMoveASubscription():void { + public function testMoveASubscription(): void { $in = [ ['op' => "moveFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 42, 'category_id' => 1], ['op' => "moveFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 2112, 'category_id' => 2], @@ -892,7 +892,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(4))->subscriptionPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything()); } - public function testRenameASubscription():void { + public function testRenameASubscription(): void { $in = [ ['op' => "renameFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 42, 'caption' => "Ook"], ['op' => "renameFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 2112, 'caption' => "Eek"], @@ -934,7 +934,7 @@ LONG_STRING; \Phake::verify(Arsse::$db)->subscriptionPropertiesSet(...$db[2]); } - public function testRetrieveTheGlobalUnreadCount():void { + public function testRetrieveTheGlobalUnreadCount(): void { $in = ['op' => "getUnread", 'sid' => "PriestsOfSyrinx"]; \Phake::when(Arsse::$db)->subscriptionList(Arsse::$user->id)->thenReturn(new Result($this->v([ ['id' => 1, 'unread' => 2112], @@ -945,7 +945,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($in)); } - public function testRetrieveTheServerConfiguration():void { + public function testRetrieveTheServerConfiguration(): void { $in = ['op' => "getConfig", 'sid' => "PriestsOfSyrinx"]; $interval = Arsse::$conf->serviceFrequency; $valid = (new \DateTimeImmutable("now", new \DateTimezone("UTC")))->sub($interval); @@ -960,7 +960,7 @@ LONG_STRING; $this->assertMessage($this->respGood($exp[1]), $this->req($in)); } - public function testUpdateAFeed():void { + public function testUpdateAFeed(): void { $in = [ ['op' => "updateFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 1], ['op' => "updateFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => 2], @@ -980,7 +980,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($in[3])); } - public function testAddALabel():void { + public function testAddALabel(): void { $in = [ ['op' => "addLabel", 'sid' => "PriestsOfSyrinx", 'caption' => "Software"], ['op' => "addLabel", 'sid' => "PriestsOfSyrinx", 'caption' => "Hardware",], @@ -1025,7 +1025,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($in[4])); } - public function testRemoveALabel():void { + public function testRemoveALabel(): void { $in = [ ['op' => "removeLabel", 'sid' => "PriestsOfSyrinx", 'label_id' => -1042], ['op' => "removeLabel", 'sid' => "PriestsOfSyrinx", 'label_id' => -2112], @@ -1053,7 +1053,7 @@ LONG_STRING; \Phake::verify(Arsse::$db)->labelRemove(Arsse::$user->id, 1088); } - public function testRenameALabel():void { + public function testRenameALabel(): void { $in = [ ['op' => "renameLabel", 'sid' => "PriestsOfSyrinx", 'label_id' => -1042, 'caption' => "Ook"], ['op' => "renameLabel", 'sid' => "PriestsOfSyrinx", 'label_id' => -2112, 'caption' => "Eek"], @@ -1099,7 +1099,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(6))->labelPropertiesSet(Arsse::$user->id, $this->anything(), $this->anything()); } - public function testRetrieveCategoryLists():void { + public function testRetrieveCategoryLists(): void { $in = [ ['op' => "getCategories", 'sid' => "PriestsOfSyrinx", 'include_empty' => true], ['op' => "getCategories", 'sid' => "PriestsOfSyrinx"], @@ -1171,7 +1171,7 @@ LONG_STRING; } } - public function testRetrieveCounterList():void { + public function testRetrieveCounterList(): void { $in = ['op' => "getCounters", 'sid' => "PriestsOfSyrinx"]; \Phake::when(Arsse::$db)->folderList($this->anything())->thenReturn(new Result($this->v($this->folders))); \Phake::when(Arsse::$db)->subscriptionList($this->anything())->thenReturn(new Result($this->v($this->subscriptions))); @@ -1206,7 +1206,7 @@ LONG_STRING; $this->assertMessage($this->respGood($exp), $this->req($in)); } - public function testRetrieveTheLabelList():void { + public function testRetrieveTheLabelList(): void { $in = [ ['op' => "getLabels", 'sid' => "PriestsOfSyrinx"], ['op' => "getLabels", 'sid' => "PriestsOfSyrinx", 'article_id' => 1], @@ -1251,7 +1251,7 @@ LONG_STRING; } } - public function testAssignArticlesToALabel():void { + public function testAssignArticlesToALabel(): void { $list = [ range(1, 100), range(1, 50), @@ -1289,7 +1289,7 @@ LONG_STRING; $this->assertMessage($exp, $this->req($in[6])); } - public function testRetrieveFeedTree():void { + public function testRetrieveFeedTree(): void { $in = [ ['op' => "getFeedTree", 'sid' => "PriestsOfSyrinx", 'include_empty' => true], ['op' => "getFeedTree", 'sid' => "PriestsOfSyrinx"], @@ -1306,7 +1306,7 @@ LONG_STRING; $this->assertMessage($this->respGood($exp), $this->req($in[1])); } - public function testMarkFeedsAsRead():void { + public function testMarkFeedsAsRead(): void { $in1 = [ // no-ops ['op' => "catchupFeed", 'sid' => "PriestsOfSyrinx"], @@ -1357,7 +1357,7 @@ LONG_STRING; \Phake::verify(Arsse::$db)->articleMark($this->anything(), ['read' => true], $this->equalTo((new Context)->modifiedSince($t), 2)); // within two seconds } - public function testRetrieveFeedList():void { + public function testRetrieveFeedList(): void { $in1 = [ ['op' => "getFeeds", 'sid' => "PriestsOfSyrinx"], ['op' => "getFeeds", 'sid' => "PriestsOfSyrinx", 'cat_id' => -1], @@ -1519,7 +1519,7 @@ LONG_STRING; return $out; } - public function testChangeArticles():void { + public function testChangeArticles(): void { $in = [ ['op' => "updateArticle", 'sid' => "PriestsOfSyrinx"], ['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1"], @@ -1604,7 +1604,7 @@ LONG_STRING; } } - public function testListArticles():void { + public function testListArticles(): void { $in = [ // error conditions ['op' => "getArticle", 'sid' => "PriestsOfSyrinx"], @@ -1693,7 +1693,7 @@ LONG_STRING; $this->assertMessage($this->respGood([$exp[0]]), $this->req($in[5])); } - public function testRetrieveCompactHeadlines():void { + public function testRetrieveCompactHeadlines(): void { $in1 = [ // erroneous input ['op' => "getCompactHeadlines", 'sid' => "PriestsOfSyrinx"], @@ -1779,7 +1779,7 @@ LONG_STRING; } } - public function testRetrieveFullHeadlines():void { + public function testRetrieveFullHeadlines(): void { $in1 = [ // empty results ['op' => "getHeadlines", 'sid' => "PriestsOfSyrinx", 'feed_id' => 0], @@ -1895,7 +1895,7 @@ LONG_STRING; } } - public function testRetrieveFullHeadlinesCheckingExtraFields():void { + public function testRetrieveFullHeadlinesCheckingExtraFields(): void { $in = [ // empty results ['op' => "getHeadlines", 'sid' => "PriestsOfSyrinx", 'feed_id' => -4], diff --git a/tests/cases/REST/TinyTinyRSS/TestIcon.php b/tests/cases/REST/TinyTinyRSS/TestIcon.php index a90bd98d..3877ab7e 100644 --- a/tests/cases/REST/TinyTinyRSS/TestIcon.php +++ b/tests/cases/REST/TinyTinyRSS/TestIcon.php @@ -48,7 +48,7 @@ class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest { return $this->req($target, $method, ""); } - public function testRetrieveFavion():void { + public function testRetrieveFavion(): void { \Phake::when(Arsse::$db)->subscriptionFavicon->thenReturn(""); \Phake::when(Arsse::$db)->subscriptionFavicon(42, $this->anything())->thenReturn("http://example.com/favicon.ico"); \Phake::when(Arsse::$db)->subscriptionFavicon(2112, $this->anything())->thenReturn("http://example.net/logo.png"); @@ -71,7 +71,7 @@ class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("2112.ico", "PUT")); } - public function testRetrieveFavionWithHttpAuthentication():void { + public function testRetrieveFavionWithHttpAuthentication(): void { $url = "http://example.org/icon.gif\r\nLocation: http://bad.example.com/"; \Phake::when(Arsse::$db)->subscriptionFavicon->thenReturn(""); \Phake::when(Arsse::$db)->subscriptionFavicon(42, $this->user)->thenReturn($url); diff --git a/tests/cases/REST/TinyTinyRSS/TestSearch.php b/tests/cases/REST/TinyTinyRSS/TestSearch.php index 890a6bb1..f99ce7e6 100644 --- a/tests/cases/REST/TinyTinyRSS/TestSearch.php +++ b/tests/cases/REST/TinyTinyRSS/TestSearch.php @@ -118,7 +118,7 @@ class TestSearch extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideSearchStrings */ - public function testApplySearchToContext(string $search, $exp):void { + public function testApplySearchToContext(string $search, $exp): void { $act = Search::parse($search); $this->assertEquals($exp, $act); } diff --git a/tests/cases/Service/TestSerial.php b/tests/cases/Service/TestSerial.php index 4031c80e..93209798 100644 --- a/tests/cases/Service/TestSerial.php +++ b/tests/cases/Service/TestSerial.php @@ -19,16 +19,16 @@ class TestSerial extends \JKingWeb\Arsse\Test\AbstractTest { Arsse::$db = \Phake::mock(Database::class); } - public function testConstruct():void { + public function testConstruct(): void { $this->assertTrue(Driver::requirementsMet()); $this->assertInstanceOf(DriverInterface::class, new Driver); } - public function testFetchDriverName():void { + public function testFetchDriverName(): void { $this->assertTrue(strlen(Driver::driverName()) > 0); } - public function testEnqueueFeeds():void { + public function testEnqueueFeeds(): void { $d = new Driver; $this->assertSame(3, $d->queue(1, 2, 3)); $this->assertSame(5, $d->queue(4, 5)); @@ -36,7 +36,7 @@ class TestSerial extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(1, $d->queue(5)); } - public function testRefreshFeeds():void { + public function testRefreshFeeds(): void { $d = new Driver; $d->queue(1, 4, 3); $this->assertSame(Arsse::$conf->serviceQueueWidth, $d->exec()); diff --git a/tests/cases/Service/TestService.php b/tests/cases/Service/TestService.php index 55930602..804cd553 100644 --- a/tests/cases/Service/TestService.php +++ b/tests/cases/Service/TestService.php @@ -22,14 +22,14 @@ class TestService extends \JKingWeb\Arsse\Test\AbstractTest { $this->srv = new Service(); } - public function testCheckIn():void { + public function testCheckIn(): void { $now = time(); $this->srv->checkIn(); \Phake::verify(Arsse::$db)->metaSet("service_last_checkin", \Phake::capture($then), "datetime"); $this->assertTime($now, $then); } - public function testReportHavingCheckedIn():void { + public function testReportHavingCheckedIn(): void { // the mock's metaGet() returns null by default $this->assertFalse(Service::hasCheckedIn()); $interval = Arsse::$conf->serviceFrequency; @@ -40,27 +40,27 @@ class TestService extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertFalse(Service::hasCheckedIn()); } - public function testPerformPreCleanup():void { + public function testPerformPreCleanup(): void { $this->assertTrue(Service::cleanupPre()); \Phake::verify(Arsse::$db)->feedCleanup(); \Phake::verify(Arsse::$db)->sessionCleanup(); } - public function testPerformShortPostCleanup():void { + public function testPerformShortPostCleanup(): void { \Phake::when(Arsse::$db)->articleCleanup()->thenReturn(0); $this->assertTrue(Service::cleanupPost()); \Phake::verify(Arsse::$db)->articleCleanup(); \Phake::verify(Arsse::$db, \Phake::times(0))->driverMaintenance(); } - public function testPerformFullPostCleanup():void { + public function testPerformFullPostCleanup(): void { \Phake::when(Arsse::$db)->articleCleanup()->thenReturn(1); $this->assertTrue(Service::cleanupPost()); \Phake::verify(Arsse::$db)->articleCleanup(); \Phake::verify(Arsse::$db)->driverMaintenance(); } - public function testRefreshFeeds():void { + public function testRefreshFeeds(): void { // set up mock database actions \Phake::when(Arsse::$db)->metaSet->thenReturn(true); \Phake::when(Arsse::$db)->feedCleanup->thenReturn(true); diff --git a/tests/cases/Service/TestSubprocess.php b/tests/cases/Service/TestSubprocess.php index 9562048c..f5c3a371 100644 --- a/tests/cases/Service/TestSubprocess.php +++ b/tests/cases/Service/TestSubprocess.php @@ -18,16 +18,16 @@ class TestSubprocess extends \JKingWeb\Arsse\Test\AbstractTest { self::setConf(); } - public function testConstruct():void { + public function testConstruct(): void { $this->assertTrue(Driver::requirementsMet()); $this->assertInstanceOf(DriverInterface::class, new Driver); } - public function testFetchDriverName():void { + public function testFetchDriverName(): void { $this->assertTrue(strlen(Driver::driverName()) > 0); } - public function testEnqueueFeeds():void { + public function testEnqueueFeeds(): void { $d = new Driver; $this->assertSame(3, $d->queue(1, 2, 3)); $this->assertSame(5, $d->queue(4, 5)); @@ -35,7 +35,7 @@ class TestSubprocess extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame(1, $d->queue(5)); } - public function testRefreshFeeds():void { + public function testRefreshFeeds(): void { $d = \Phake::partialMock(Driver::class); \Phake::when($d)->execCmd->thenReturnCallback(function(string $cmd) { // FIXME: Does this work in Windows? diff --git a/tests/cases/TestArsse.php b/tests/cases/TestArsse.php index a6b28e7c..edb7e121 100644 --- a/tests/cases/TestArsse.php +++ b/tests/cases/TestArsse.php @@ -22,7 +22,7 @@ class TestArsse extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); } - public function testLoadExistingData():void { + public function testLoadExistingData(): void { $lang = Arsse::$lang = \Phake::mock(Lang::class); $db = Arsse::$db = \Phake::mock(Database::class); $user = Arsse::$user = \Phake::mock(User::class); @@ -36,7 +36,7 @@ class TestArsse extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($lang)->set("test"); } - public function testLoadNewData():void { + public function testLoadNewData(): void { if (!\JKingWeb\Arsse\Db\SQLite3\Driver::requirementsMet() && !\JKingWeb\Arsse\Db\SQLite3\PDODriver::requirementsMet()) { $this->markTestSkipped("A functional SQLite interface is required for this test"); } diff --git a/tests/cases/User/TestInternal.php b/tests/cases/User/TestInternal.php index ea1221b3..4b9cfb80 100644 --- a/tests/cases/User/TestInternal.php +++ b/tests/cases/User/TestInternal.php @@ -21,11 +21,11 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::when(Arsse::$db)->begin->thenReturn(\Phake::mock(\JKingWeb\Arsse\Db\Transaction::class)); } - public function testConstruct():void { + public function testConstruct(): void { $this->assertInstanceOf(DriverInterface::class, new Driver); } - public function testFetchDriverName():void { + public function testFetchDriverName(): void { $this->assertTrue(strlen(Driver::driverName()) > 0); } @@ -33,7 +33,7 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { * @dataProvider provideAuthentication * @group slow */ - public function testAuthenticateAUser(bool $authorized, string $user, $password, bool $exp):void { + public function testAuthenticateAUser(bool $authorized, string $user, $password, bool $exp): void { if ($authorized) { \Phake::when(Arsse::$db)->userPasswordGet("john.doe@example.com")->thenReturn('$2y$10$1zbqRJhxM8uUjeSBPp4IhO90xrqK0XjEh9Z16iIYEFRV4U.zeAFom'); // hash of "secret" \Phake::when(Arsse::$db)->userPasswordGet("jane.doe@example.com")->thenReturn('$2y$10$bK1ljXfTSyc2D.NYvT.Eq..OpehLRXVbglW.23ihVuyhgwJCd.7Im'); // hash of "superman" @@ -74,12 +74,12 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { ]; } - public function testAuthorizeAnAction():void { + public function testAuthorizeAnAction(): void { \Phake::verifyNoFurtherInteraction(Arsse::$db); $this->assertTrue((new Driver)->authorize("someone", "something")); } - public function testListUsers():void { + public function testListUsers(): void { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; \Phake::when(Arsse::$db)->userList->thenReturn([$john, $jane])->thenReturn([$jane, $john]); @@ -89,7 +89,7 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db, \Phake::times(2))->userList; } - public function testCheckThatAUserExists():void { + public function testCheckThatAUserExists(): void { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; \Phake::when(Arsse::$db)->userExists($john)->thenReturn(true); @@ -101,7 +101,7 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->userExists($jane); } - public function testAddAUser():void { + public function testAddAUser(): void { $john = "john.doe@example.com"; \Phake::when(Arsse::$db)->userAdd->thenReturnCallback(function($user, $pass) { return $pass; @@ -114,7 +114,7 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->userAdd; } - public function testRemoveAUser():void { + public function testRemoveAUser(): void { $john = "john.doe@example.com"; \Phake::when(Arsse::$db)->userRemove->thenReturn(true)->thenThrow(new \JKingWeb\Arsse\User\Exception("doesNotExist")); $driver = new Driver; @@ -128,21 +128,21 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function testSetAPassword():void { + public function testSetAPassword(): void { $john = "john.doe@example.com"; \Phake::verifyNoFurtherInteraction(Arsse::$db); $this->assertSame("superman", (new Driver)->userPasswordSet($john, "superman")); $this->assertSame(null, (new Driver)->userPasswordSet($john, null)); } - public function testUnsetAPassword():void { + public function testUnsetAPassword(): void { $drv = \Phake::partialMock(Driver::class); \Phake::when($drv)->userExists->thenReturn(true); \Phake::verifyNoFurtherInteraction(Arsse::$db); $this->assertTrue($drv->userPasswordUnset("john.doe@example.com")); } - public function testUnsetAPasswordForAMssingUser():void { + public function testUnsetAPasswordForAMssingUser(): void { $drv = \Phake::partialMock(Driver::class); \Phake::when($drv)->userExists->thenReturn(false); \Phake::verifyNoFurtherInteraction(Arsse::$db); diff --git a/tests/cases/User/TestUser.php b/tests/cases/User/TestUser.php index 4b0c3998..df31c591 100644 --- a/tests/cases/User/TestUser.php +++ b/tests/cases/User/TestUser.php @@ -24,12 +24,12 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { $this->drv = \Phake::mock(Driver::class); } - public function testConstruct():void { + public function testConstruct(): void { $this->assertInstanceOf(User::class, new User($this->drv)); $this->assertInstanceOf(User::class, new User); } - public function testConversionToString():void { + public function testConversionToString(): void { $u = new User; $u->id = "john.doe@example.com"; $this->assertSame("john.doe@example.com", (string) $u); @@ -38,7 +38,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideAuthentication */ - public function testAuthenticateAUser(bool $preAuth, string $user, string $password, bool $exp):void { + public function testAuthenticateAUser(bool $preAuth, string $user, string $password, bool $exp): void { Arsse::$conf->userPreAuth = $preAuth; \Phake::when($this->drv)->auth->thenReturn(false); \Phake::when($this->drv)->auth("john.doe@example.com", "secret")->thenReturn(true); @@ -69,7 +69,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideUserList */ - public function testListUsers(bool $authorized, $exp):void { + public function testListUsers(bool $authorized, $exp): void { $u = new User($this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userList->thenReturn(["john.doe@example.com", "jane.doe@example.com"]); @@ -89,7 +89,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideExistence */ - public function testCheckThatAUserExists(bool $authorized, string $user, $exp):void { + public function testCheckThatAUserExists(bool $authorized, string $user, $exp): void { $u = new User($this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userExists("john.doe@example.com")->thenReturn(true); @@ -112,7 +112,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideAdditions */ - public function testAddAUser(bool $authorized, string $user, $password, $exp):void { + public function testAddAUser(bool $authorized, string $user, $password, $exp): void { $u = new User($this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userAdd("john.doe@example.com", $this->anything())->thenThrow(new \JKingWeb\Arsse\User\Exception("alreadyExists")); @@ -130,7 +130,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideAdditions */ - public function testAddAUserWithARandomPassword(bool $authorized, string $user, $password, $exp):void { + public function testAddAUserWithARandomPassword(bool $authorized, string $user, $password, $exp): void { $u = \Phake::partialMock(User::class, $this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userAdd($this->anything(), $this->isNull())->thenReturn(null); @@ -172,7 +172,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider provideRemovals */ - public function testRemoveAUser(bool $authorized, string $user, bool $exists, $exp):void { + public function testRemoveAUser(bool $authorized, string $user, bool $exists, $exp): void { $u = new User($this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userRemove("john.doe@example.com")->thenReturn(true); @@ -210,7 +210,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider providePasswordChanges */ - public function testChangeAPassword(bool $authorized, string $user, $password, bool $exists, $exp):void { + public function testChangeAPassword(bool $authorized, string $user, $password, bool $exists, $exp): void { $u = new User($this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userPasswordSet("john.doe@example.com", $this->anything(), $this->anything())->thenReturnCallback(function($user, $pass, $old) { @@ -237,7 +237,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider providePasswordChanges */ - public function testChangeAPasswordToARandomPassword(bool $authorized, string $user, $password, bool $exists, $exp):void { + public function testChangeAPasswordToARandomPassword(bool $authorized, string $user, $password, bool $exists, $exp): void { $u = \Phake::partialMock(User::class, $this->drv); \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userPasswordSet($this->anything(), $this->isNull(), $this->anything())->thenReturn(null); @@ -289,7 +289,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } /** @dataProvider providePasswordClearings */ - public function testClearAPassword(bool $authorized, bool $exists, string $user, $exp):void { + public function testClearAPassword(bool $authorized, bool $exists, string $user, $exp): void { \Phake::when($this->drv)->authorize->thenReturn($authorized); \Phake::when($this->drv)->userPasswordUnset->thenReturn(true); \Phake::when($this->drv)->userPasswordUnset("jane.doe@example.net", null)->thenThrow(new \JKingWeb\Arsse\User\Exception("doesNotExist")); From e583ffea6728852da6946ecfbe9af29ecbfc8885 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Tue, 21 Jan 2020 08:42:38 -0500 Subject: [PATCH 07/14] Start on integrating well-maintained picofeed fork Picofeed configuration does not seem to get passed to Guzzle. --- composer.json | 8 +- composer.lock | 445 +++++++++++++++++++++++++++--- lib/AbstractException.php | 3 +- lib/Feed.php | 6 + lib/Feed/Exception.php | 36 ++- locale/en.php | 3 +- tests/cases/Feed/TestFetching.php | 6 +- 7 files changed, 457 insertions(+), 50 deletions(-) diff --git a/composer.json b/composer.json index 0fef64b7..6d05da07 100644 --- a/composer.json +++ b/composer.json @@ -17,13 +17,19 @@ } ], + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/JKingweb/picoFeed-1" + } + ], "require": { "php": "^7.1", "ext-intl": "*", "ext-json": "*", "ext-hash": "*", "ext-dom": "*", - "p3k/picofeed": "0.1.*", + "nicolus/picofeed": "dev-fixed", "hosteurope/password-generator": "1.*", "docopt/docopt": "1.*", "jkingweb/druuid": "3.*", diff --git a/composer.lock b/composer.lock index bc0f82a0..f61e035b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "356cebec1e1e689b4249b661f787b7d9", + "content-hash": "9710e0638278222dc8d6207d4141e529", "packages": [ { "name": "docopt/docopt", @@ -52,6 +52,195 @@ ], "time": "2019-12-03T02:48:46+00:00" }, + { + "name": "guzzlehttp/guzzle", + "version": "6.5.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.6.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.1" + }, + "suggest": { + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.5-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2019-12-23T11:57:10+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2019-07-01T23:21:34+00:00" + }, { "name": "hosteurope/password-generator", "version": "v1.0.1", @@ -137,6 +326,81 @@ ], "time": "2017-02-09T14:17:01+00:00" }, + { + "name": "kevinrob/guzzle-cache-middleware", + "version": "v2.1.1", + "source": { + "type": "git", + "url": "https://github.com/Kevinrob/guzzle-cache-middleware.git", + "reference": "6952064f7747756b0be7b4c234c0fd7535ea4c8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Kevinrob/guzzle-cache-middleware/zipball/6952064f7747756b0be7b4c234c0fd7535ea4c8c", + "reference": "6952064f7747756b0be7b4c234c0fd7535ea4c8c", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "cache/array-adapter": "^0.4", + "doctrine/cache": "^1.0", + "guzzlehttp/guzzle": "^6.0", + "illuminate/cache": "^5.0", + "league/flysystem": "^1.0", + "phpunit/phpunit": "^4.0 || ^5.0", + "psr/cache": "^1.0" + }, + "suggest": { + "doctrine/cache": "This library have a lot of ready-to-use cache storage (to be use with Kevinrob\\GuzzleCache\\Storage\\DoctrineCacheStorage)", + "guzzlehttp/guzzle": "For using this library. It was created for Guzzle6. (but you can use it with any PSR-7 HTTP Client)", + "laravel/framework": "To be use with Kevinrob\\GuzzleCache\\Storage\\LaravelCacheStorage", + "league/flysystem": "To be use with Kevinrob\\GuzzleCache\\Storage\\FlysystemStorage", + "psr/cache": "To be use with Kevinrob\\GuzzleCache\\Storage\\Psr6CacheStorage" + }, + "type": "library", + "autoload": { + "psr-4": { + "Kevinrob\\GuzzleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kevin Robatel", + "email": "kevinrob2@gmail.com", + "homepage": "https://github.com/Kevinrob" + } + ], + "description": "A HTTP/1.1 Cache for Guzzle 6. It's a simple Middleware to be added in the HandlerStack. (RFC 7234)", + "homepage": "https://github.com/Kevinrob/guzzle-cache-middleware", + "keywords": [ + "Etag", + "Flysystem", + "Guzzle", + "cache", + "cache-control", + "doctrine", + "expiration", + "guzzle6", + "handler", + "http", + "http 1.1", + "middleware", + "performance", + "php", + "promise", + "psr6", + "psr7", + "rfc7234", + "validation" + ], + "time": "2017-08-17T12:23:43+00:00" + }, { "name": "laminas/laminas-diactoros", "version": "2.2.2", @@ -280,6 +544,56 @@ ], "time": "2019-12-31T17:06:16+00:00" }, + { + "name": "laminas/laminas-xml", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-xml.git", + "reference": "879cc66d1bba6a37705e98074f52a6960c220020" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-xml/zipball/879cc66d1bba6a37705e98074f52a6960c220020", + "reference": "879cc66d1bba6a37705e98074f52a6960c220020", + "shasum": "" + }, + "require": { + "laminas/laminas-zendframework-bridge": "^1.0", + "php": "^5.6 || ^7.0" + }, + "replace": { + "zendframework/zendxml": "self.version" + }, + "require-dev": { + "laminas/laminas-coding-standard": "~1.0.0", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev", + "dev-develop": "1.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Laminas\\Xml\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Utility library for XML usage, best practices, and security in PHP", + "homepage": "https://laminas.dev", + "keywords": [ + "laminas", + "security", + "xml" + ], + "time": "2019-12-31T18:05:42+00:00" + }, { "name": "laminas/laminas-zendframework-bridge", "version": "1.0.1", @@ -333,17 +647,17 @@ "time": "2020-01-07T22:58:31+00:00" }, { - "name": "p3k/picofeed", - "version": "v0.1.35", + "name": "nicolus/picofeed", + "version": "dev-fixed", "source": { "type": "git", - "url": "https://github.com/aaronpk/picofeed.git", - "reference": "b2a48acb026df91d2e21dfc8b4edbc1fc48f01f1" + "url": "https://github.com/JKingweb/picoFeed-1.git", + "reference": "419bc85afb18a84e43274029cf8e198cc5785425" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aaronpk/picofeed/zipball/b2a48acb026df91d2e21dfc8b4edbc1fc48f01f1", - "reference": "b2a48acb026df91d2e21dfc8b4edbc1fc48f01f1", + "url": "https://api.github.com/repos/JKingweb/picoFeed-1/zipball/419bc85afb18a84e43274029cf8e198cc5785425", + "reference": "419bc85afb18a84e43274029cf8e198cc5785425", "shasum": "" }, "require": { @@ -352,16 +666,22 @@ "ext-libxml": "*", "ext-simplexml": "*", "ext-xml": "*", - "php": ">=5.3.0", - "zendframework/zendxml": "^1.0" + "guzzlehttp/guzzle": "~6.0", + "kevinrob/guzzle-cache-middleware": "^2.1", + "laminas/laminas-xml": "^1.0", + "php": ">=7.1", + "psr/log": "^1.0" }, "require-dev": { + "blastcloud/guzzler": "^1.5", + "monolog/monolog": "^1.23", + "php-coveralls/php-coveralls": "^2.1", "phpdocumentor/reflection-docblock": "2.0.4", - "phpunit/phpunit": "4.8.26", - "symfony/yaml": "2.8.7" + "phpunit/phpunit": "^7.0.0" }, "suggest": { - "ext-curl": "PicoFeed will use cURL if present" + "ext-curl": "PicoFeed will use cURL if present", + "monolog/monolog": "You can set a monolog Logger to get debug information from PicoFeed" }, "bin": [ "picofeed" @@ -372,18 +692,23 @@ "PicoFeed": "lib/" } }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Frédéric Guillot" + }, + { + "name": "Nicolas Bailly" } ], - "description": "Modern library to handle RSS/Atom feeds", - "homepage": "https://github.com/aaronpk/picoFeed", - "time": "2019-01-17T17:26:41+00:00" + "description": "RSS/Atom parsing library", + "homepage": "https://github.com/nicolus/picoFeed", + "support": { + "source": "https://github.com/JKingweb/picoFeed-1/tree/fixed" + }, + "time": "2020-01-21T00:09:22+00:00" }, { "name": "psr/http-factory", @@ -541,51 +866,91 @@ "time": "2018-10-30T16:46:14+00:00" }, { - "name": "zendframework/zendxml", - "version": "1.2.0", + "name": "psr/log", + "version": "1.1.2", "source": { "type": "git", - "url": "https://github.com/zendframework/ZendXml.git", - "reference": "eceab37a591c9e140772a1470338258857339e00" + "url": "https://github.com/php-fig/log.git", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/ZendXml/zipball/eceab37a591c9e140772a1470338258857339e00", - "reference": "eceab37a591c9e140772a1470338258857339e00", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4", - "zendframework/zend-coding-standard": "~1.0.0" + "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev", - "dev-develop": "1.3.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { "psr-4": { - "ZendXml\\": "src/" + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], - "description": "Utility library for XML usage, best practices, and security in PHP", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "ZendFramework", - "security", - "xml", - "zf" + "log", + "psr", + "psr-3" ], - "abandoned": "laminas/laminas-xml", - "time": "2019-01-22T19:42:14+00:00" + "time": "2019-11-01T11:05:21+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" } ], "packages-dev": [ @@ -631,7 +996,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "nicolus/picofeed": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/lib/AbstractException.php b/lib/AbstractException.php index 0165d464..4c0496a6 100644 --- a/lib/AbstractException.php +++ b/lib/AbstractException.php @@ -77,11 +77,12 @@ abstract class AbstractException extends \Exception { "User/ExceptionSession.invalid" => 10431, "Feed/Exception.invalidCertificate" => 10501, "Feed/Exception.invalidUrl" => 10502, - "Feed/Exception.maxRedirect" => 10503, + "Feed/Exception.tooManyRedirects" => 10503, "Feed/Exception.maxSize" => 10504, "Feed/Exception.timeout" => 10505, "Feed/Exception.forbidden" => 10506, "Feed/Exception.unauthorized" => 10507, + "Feed/Exception.transmissionError" => 10508, "Feed/Exception.malformedXml" => 10511, "Feed/Exception.xmlEntity" => 10512, "Feed/Exception.subscriptionNotFound" => 10521, diff --git a/lib/Feed.php b/lib/Feed.php index 87e6016f..71f30da0 100644 --- a/lib/Feed.php +++ b/lib/Feed.php @@ -101,6 +101,8 @@ class Feed { return $client; } catch (PicoFeedException $e) { throw new Feed\Exception($url, $e); + } catch (\GuzzleHttp\Exception\GuzzleException $e) { + throw new Feed\Exception($url, $e); } } @@ -121,6 +123,10 @@ class Feed { // work around a PicoFeed memory leak libxml_use_internal_errors(false); throw new Feed\Exception($this->resource->getUrl(), $e); + } catch (\GuzzleHttp\Exception\GuzzleException $e) { + // work around a PicoFeed memory leak + libxml_use_internal_errors(false); + throw new Feed\Exception($this->resource->getUrl(), $e); } // PicoFeed does not provide valid ids when there is no id element. Its solution diff --git a/lib/Feed/Exception.php b/lib/Feed/Exception.php index 91fe085c..8e7bbab4 100644 --- a/lib/Feed/Exception.php +++ b/lib/Feed/Exception.php @@ -6,13 +6,39 @@ declare(strict_types=1); namespace JKingWeb\Arsse\Feed; +use GuzzleHttp\Exception\GuzzleException; + class Exception extends \JKingWeb\Arsse\AbstractException { public function __construct($url, \Throwable $e) { - $className = get_class($e); - // Convert the exception thrown by PicoFeed to the one to be thrown here. - $msgID = preg_replace('/^PicoFeed\\\(?:Client|Parser|Reader)\\\([A-Za-z]+)Exception$/', '$1', $className); - // If the message ID doesn't change then it's unknown. - $msgID = ($msgID !== $className) ? lcfirst($msgID) : ''; + if ($e instanceof GuzzleException) { + switch ($e->getCode()) { + case 401: + $msgID = "unauthorized"; + break; + case 403: + $msgID = "forbidden"; + break; + case 404: + case 410: + $msgID = "invalidUrl"; + break; + case 508: + $msgID = "tooManyRedirects"; + break; + default: + $c = $e->getCode(); + if ($c >= 400 && $c < 600) { + $msgID = "transmissionError"; + } + } + } + if (!($msgID ?? "")) { + $className = get_class($e); + // Convert the exception thrown by PicoFeed to the one to be thrown here. + $msgID = preg_replace('/^(?:PicoFeed\\\(?:Client|Parser|Reader)|GuzzleHttp\\\Exception)\\\([A-Za-z]+)Exception$/', '$1', $className); + // If the message ID doesn't change then it's unknown. + $msgID = ($msgID !== $className) ? lcfirst($msgID) : ''; + } parent::__construct($msgID, ['url' => $url], $e); } } diff --git a/locale/en.php b/locale/en.php index e095db8a..ff75bc8b 100644 --- a/locale/en.php +++ b/locale/en.php @@ -146,11 +146,12 @@ return [ 'Exception.JKingWeb/Arsse/User/ExceptionSession.invalid' => 'Session with ID {0} does not exist', 'Exception.JKingWeb/Arsse/Feed/Exception.invalidCertificate' => 'Could not download feed "{url}" because its server is serving an invalid SSL certificate', 'Exception.JKingWeb/Arsse/Feed/Exception.invalidUrl' => 'Feed URL "{url}" is invalid', - 'Exception.JKingWeb/Arsse/Feed/Exception.maxRedirect' => 'Could not download feed "{url}" because its server reached its maximum number of HTTP redirections', + 'Exception.JKingWeb/Arsse/Feed/Exception.tooManyRedirects' => 'Could not download feed "{url}" because its server reached its maximum number of HTTP redirections', 'Exception.JKingWeb/Arsse/Feed/Exception.maxSize' => 'Could not download feed "{url}" because its size exceeds the maximum allowed on its server', 'Exception.JKingWeb/Arsse/Feed/Exception.timeout' => 'Could not download feed "{url}" because its server timed out', 'Exception.JKingWeb/Arsse/Feed/Exception.forbidden' => 'Could not download feed "{url}" because you do not have permission to access it', 'Exception.JKingWeb/Arsse/Feed/Exception.unauthorized' => 'Could not download feed "{url}" because you provided insufficient or invalid credentials', + 'Exception.JKingWeb/Arsse/Feed/Exception.transmissionError' => 'Could not download feed "{url}" because of a network error', 'Exception.JKingWeb/Arsse/Feed/Exception.malformedXml' => 'Could not parse feed "{url}" because it is malformed', 'Exception.JKingWeb/Arsse/Feed/Exception.xmlEntity' => 'Refused to parse feed "{url}" because it contains an XXE attack', 'Exception.JKingWeb/Arsse/Feed/Exception.subscriptionNotFound' => 'Unable to find a feed at location "{url}"', diff --git a/tests/cases/Feed/TestFetching.php b/tests/cases/Feed/TestFetching.php index 573c7e96..c83f269c 100644 --- a/tests/cases/Feed/TestFetching.php +++ b/tests/cases/Feed/TestFetching.php @@ -28,7 +28,7 @@ class TestFetching extends \JKingWeb\Arsse\Test\AbstractTest { } public function testHandle400(): void { - $this->assertException("unsupportedFeedFormat", "Feed"); + $this->assertException("transmissionError", "Feed"); new Feed(null, $this->base."Fetching/Error?code=400"); } @@ -48,12 +48,12 @@ class TestFetching extends \JKingWeb\Arsse\Test\AbstractTest { } public function testHandle500(): void { - $this->assertException("unsupportedFeedFormat", "Feed"); + $this->assertException("transmissionError", "Feed"); new Feed(null, $this->base."Fetching/Error?code=500"); } public function testHandleARedirectLoop(): void { - $this->assertException("maxRedirect", "Feed"); + $this->assertException("tooManyRedirects", "Feed"); new Feed(null, $this->base."Fetching/EndlessLoop?i=0"); } From 49d003082d46e2eb1859a75fabc527916db31aac Mon Sep 17 00:00:00 2001 From: "J. King" Date: Thu, 23 Jan 2020 17:07:20 -0500 Subject: [PATCH 08/14] Fix problems with nicolus/picofeed This involved multiple fixes to Picofeed itself, not all of which have been merged upstream yet --- composer.lock | 8 +++--- lib/AbstractException.php | 2 +- lib/Feed.php | 2 +- lib/Feed/Exception.php | 27 +++++++++++++++--- locale/en.php | 2 +- tests/cases/Feed/TestFeed.php | 28 ++++++++++--------- tests/cases/Feed/TestFetching.php | 3 +- tests/docroot/Feed/Caching/304Conditional.php | 23 +++++++++++++++ tests/docroot/Feed/Caching/304ETagOnly.php | 2 +- tests/docroot/Feed/Caching/304LastModOnly.php | 2 +- tests/server.php | 2 ++ 11 files changed, 74 insertions(+), 27 deletions(-) create mode 100644 tests/docroot/Feed/Caching/304Conditional.php diff --git a/composer.lock b/composer.lock index f61e035b..55e69958 100644 --- a/composer.lock +++ b/composer.lock @@ -652,12 +652,12 @@ "source": { "type": "git", "url": "https://github.com/JKingweb/picoFeed-1.git", - "reference": "419bc85afb18a84e43274029cf8e198cc5785425" + "reference": "009250e98ff0975335176f74e5fea95104058d09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JKingweb/picoFeed-1/zipball/419bc85afb18a84e43274029cf8e198cc5785425", - "reference": "419bc85afb18a84e43274029cf8e198cc5785425", + "url": "https://api.github.com/repos/JKingweb/picoFeed-1/zipball/009250e98ff0975335176f74e5fea95104058d09", + "reference": "009250e98ff0975335176f74e5fea95104058d09", "shasum": "" }, "require": { @@ -708,7 +708,7 @@ "support": { "source": "https://github.com/JKingweb/picoFeed-1/tree/fixed" }, - "time": "2020-01-21T00:09:22+00:00" + "time": "2020-01-23T22:03:32+00:00" }, { "name": "psr/http-factory", diff --git a/lib/AbstractException.php b/lib/AbstractException.php index 4c0496a6..8aaff950 100644 --- a/lib/AbstractException.php +++ b/lib/AbstractException.php @@ -77,7 +77,7 @@ abstract class AbstractException extends \Exception { "User/ExceptionSession.invalid" => 10431, "Feed/Exception.invalidCertificate" => 10501, "Feed/Exception.invalidUrl" => 10502, - "Feed/Exception.tooManyRedirects" => 10503, + "Feed/Exception.maxRedirect" => 10503, "Feed/Exception.maxSize" => 10504, "Feed/Exception.timeout" => 10505, "Feed/Exception.forbidden" => 10506, diff --git a/lib/Feed.php b/lib/Feed.php index 71f30da0..984b4493 100644 --- a/lib/Feed.php +++ b/lib/Feed.php @@ -50,7 +50,7 @@ class Feed { $this->resource = self::download($url, $lastModified, $etag, $username, $password); // format the HTTP Last-Modified date returned $lastMod = $this->resource->getLastModified(); - if (strlen($lastMod)) { + if (strlen($lastMod ?? "")) { $this->lastModified = Date::normalize($lastMod, "http"); } $this->modified = $this->resource->isModified(); diff --git a/lib/Feed/Exception.php b/lib/Feed/Exception.php index 8e7bbab4..3cab2c93 100644 --- a/lib/Feed/Exception.php +++ b/lib/Feed/Exception.php @@ -6,11 +6,14 @@ declare(strict_types=1); namespace JKingWeb\Arsse\Feed; +use GuzzleHttp\Exception\BadResponseException; use GuzzleHttp\Exception\GuzzleException; +use GuzzleHttp\Exception\TooManyRedirectsException; +use PicoFeed\PicoFeedException; class Exception extends \JKingWeb\Arsse\AbstractException { public function __construct($url, \Throwable $e) { - if ($e instanceof GuzzleException) { + if ($e instanceof BadResponseException) { switch ($e->getCode()) { case 401: $msgID = "unauthorized"; @@ -31,13 +34,29 @@ class Exception extends \JKingWeb\Arsse\AbstractException { $msgID = "transmissionError"; } } - } - if (!($msgID ?? "")) { + } elseif ($e instanceof TooManyRedirectsException) { + $msgID = "maxRedirect"; + } elseif ($e instanceof GuzzleException) { + $m = $e->getMessage(); + if (preg_match("/^Error creating resource:/", $m)) { + // PHP stream error; the class of error is ambiguous + $msgID = "transmissionError"; // @codeCoverageIgnore + } elseif (preg_match("/^cURL error 35:/", $m)) { + $msgID = "invalidCertificate"; + } elseif (preg_match("/^cURL error 28:/", $m)) { + $msgID = "timeout"; + } else { + var_export($m); + exit; + } + } elseif ($e instanceof PicoFeedException) { $className = get_class($e); // Convert the exception thrown by PicoFeed to the one to be thrown here. - $msgID = preg_replace('/^(?:PicoFeed\\\(?:Client|Parser|Reader)|GuzzleHttp\\\Exception)\\\([A-Za-z]+)Exception$/', '$1', $className); + $msgID = preg_replace('/^PicoFeed\\\(?:Client|Parser|Reader)\\\([A-Za-z]+)Exception$/', '$1', $className); // If the message ID doesn't change then it's unknown. $msgID = ($msgID !== $className) ? lcfirst($msgID) : ''; + } else { + $msgID = get_class($e); } parent::__construct($msgID, ['url' => $url], $e); } diff --git a/locale/en.php b/locale/en.php index ff75bc8b..d66fddf3 100644 --- a/locale/en.php +++ b/locale/en.php @@ -146,7 +146,7 @@ return [ 'Exception.JKingWeb/Arsse/User/ExceptionSession.invalid' => 'Session with ID {0} does not exist', 'Exception.JKingWeb/Arsse/Feed/Exception.invalidCertificate' => 'Could not download feed "{url}" because its server is serving an invalid SSL certificate', 'Exception.JKingWeb/Arsse/Feed/Exception.invalidUrl' => 'Feed URL "{url}" is invalid', - 'Exception.JKingWeb/Arsse/Feed/Exception.tooManyRedirects' => 'Could not download feed "{url}" because its server reached its maximum number of HTTP redirections', + 'Exception.JKingWeb/Arsse/Feed/Exception.maxRedirect' => 'Could not download feed "{url}" because its server reached its maximum number of HTTP redirections', 'Exception.JKingWeb/Arsse/Feed/Exception.maxSize' => 'Could not download feed "{url}" because its size exceeds the maximum allowed on its server', 'Exception.JKingWeb/Arsse/Feed/Exception.timeout' => 'Could not download feed "{url}" because its server timed out', 'Exception.JKingWeb/Arsse/Feed/Exception.forbidden' => 'Could not download feed "{url}" because you do not have permission to access it', diff --git a/tests/cases/Feed/TestFeed.php b/tests/cases/Feed/TestFeed.php index e86628d3..1bcf50e5 100644 --- a/tests/cases/Feed/TestFeed.php +++ b/tests/cases/Feed/TestFeed.php @@ -198,24 +198,26 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame("http://example.com/1", $f->newItems[0]->url); } - public function testHandleCacheHeadersOn304(): void { - // upon 304, the client should re-use the caching header values it supplied the server - $t = time(); + /** @dataProvider provide304ResponseURLs */ + public function testHandleCacheHeadersOn304(string $url): void { + // upon 304, the client should re-use the caching header values it supplied to the server + $t = Date::transform("2010-01-01T00:00:00Z", "unix"); $e = "78567a"; - $f = new Feed(null, $this->base."Caching/304Random", Date::transform($t, "http"), $e); - $this->assertTime($t, $f->lastModified); - $this->assertSame($e, $f->resource->getETag()); - $f = new Feed(null, $this->base."Caching/304ETagOnly", Date::transform($t, "http"), $e); - $this->assertTime($t, $f->lastModified); - $this->assertSame($e, $f->resource->getETag()); - $f = new Feed(null, $this->base."Caching/304LastModOnly", Date::transform($t, "http"), $e); - $this->assertTime($t, $f->lastModified); - $this->assertSame($e, $f->resource->getETag()); - $f = new Feed(null, $this->base."Caching/304None", Date::transform($t, "http"), $e); + $f = new Feed(null, $this->base.$url."?t=$t&e=$e", Date::transform($t, "http"), $e); $this->assertTime($t, $f->lastModified); $this->assertSame($e, $f->resource->getETag()); } + public function provide304ResponseURLs() { + return [ + 'Control' => ["Caching/304Conditional"], + 'Random last-mod and ETag' => ["Caching/304Random"], + 'ETag only' => ["Caching/304ETagOnly"], + 'Last-mod only' => ["Caching/304LastModOnly"], + 'Neither last-mod nor ETag' => ["Caching/304None"], + ]; + } + public function testHandleCacheHeadersOn200(): void { // these tests should trust the server-returned time, even in cases of obviously incorrect results $t = time() - 2000; diff --git a/tests/cases/Feed/TestFetching.php b/tests/cases/Feed/TestFetching.php index c83f269c..4ac7ece5 100644 --- a/tests/cases/Feed/TestFetching.php +++ b/tests/cases/Feed/TestFetching.php @@ -53,11 +53,12 @@ class TestFetching extends \JKingWeb\Arsse\Test\AbstractTest { } public function testHandleARedirectLoop(): void { - $this->assertException("tooManyRedirects", "Feed"); + $this->assertException("maxRedirect", "Feed"); new Feed(null, $this->base."Fetching/EndlessLoop?i=0"); } public function testHandleAnOverlyLargeFeed(): void { + $this->markTestIncomplete(); Arsse::$conf->fetchSizeLimit = 512; $this->assertException("maxSize", "Feed"); new Feed(null, $this->base."Fetching/TooLarge"); diff --git a/tests/docroot/Feed/Caching/304Conditional.php b/tests/docroot/Feed/Caching/304Conditional.php new file mode 100644 index 00000000..3f55bb28 --- /dev/null +++ b/tests/docroot/Feed/Caching/304Conditional.php @@ -0,0 +1,23 @@ + 400, + ]; +} else { + return [ + 'code' => 304, + 'lastMod' => random_int(0, 2^31), + 'fields' => [ + "ETag: ".bin2hex(random_bytes(8)), + ], + ]; +} + diff --git a/tests/docroot/Feed/Caching/304ETagOnly.php b/tests/docroot/Feed/Caching/304ETagOnly.php index 3572d57d..e4986092 100644 --- a/tests/docroot/Feed/Caching/304ETagOnly.php +++ b/tests/docroot/Feed/Caching/304ETagOnly.php @@ -2,6 +2,6 @@ 'code' => 304, 'cache' => false, 'fields' => [ - "ETag: ".$_SERVER['HTTP_IF_NONE_MATCH'], + "ETag: ".($_SERVER['HTTP_IF_NONE_MATCH'] ?? "No ETag supplied"), ], ]; diff --git a/tests/docroot/Feed/Caching/304LastModOnly.php b/tests/docroot/Feed/Caching/304LastModOnly.php index 34838dc0..6576d60f 100644 --- a/tests/docroot/Feed/Caching/304LastModOnly.php +++ b/tests/docroot/Feed/Caching/304LastModOnly.php @@ -2,6 +2,6 @@ 'code' => 304, 'cache' => false, 'fields' => [ - 'Last-Modified: '.$_SERVER['HTTP_IF_MODIFIED_SINCE'], + 'Last-Modified: '.($_SERVER['HTTP_IF_MODIFIED_SINCE'] ?? "No timestamp supplied"), ], ]; diff --git a/tests/server.php b/tests/server.php index 713e0ee4..df9f28e1 100644 --- a/tests/server.php +++ b/tests/server.php @@ -31,6 +31,7 @@ which include the following data: ignore_user_abort(false); +ob_start(); $defaults = [ // default values for response 'code' => 200, 'content' => "", @@ -74,3 +75,4 @@ foreach ($response['fields'] as $h) { } // send the content echo $response['content']; +ob_end_flush(); From e29c57321056a9045ea6693bc6e29f4b2e33df9b Mon Sep 17 00:00:00 2001 From: "J. King" Date: Thu, 23 Jan 2020 17:07:32 -0500 Subject: [PATCH 09/14] Update tools --- vendor-bin/csfixer/composer.lock | 70 ++++++++++++++++---------------- vendor-bin/daux/composer.lock | 60 +++++++++++++-------------- vendor-bin/phpunit/composer.lock | 14 +++---- vendor-bin/robo/composer.lock | 60 +++++++++++++-------------- 4 files changed, 102 insertions(+), 102 deletions(-) diff --git a/vendor-bin/csfixer/composer.lock b/vendor-bin/csfixer/composer.lock index bfe93215..5c8486a2 100644 --- a/vendor-bin/csfixer/composer.lock +++ b/vendor-bin/csfixer/composer.lock @@ -571,16 +571,16 @@ }, { "name": "symfony/console", - "version": "v5.0.2", + "version": "v5.0.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47" + "reference": "345ab6ecb456b5147ea3b3271d7f1f00aadfd257" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fe6e3cd889ca64172d7a742a2eb058541404ef47", - "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47", + "url": "https://api.github.com/repos/symfony/console/zipball/345ab6ecb456b5147ea3b3271d7f1f00aadfd257", + "reference": "345ab6ecb456b5147ea3b3271d7f1f00aadfd257", "shasum": "" }, "require": { @@ -643,20 +643,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-12-17T13:20:22+00:00" + "time": "2020-01-19T11:13:19+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.0.2", + "version": "v5.0.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "7b738a51645e10f864cc25c24d232fb03f37b475" + "reference": "4a7a8cdca1120c091b4797f0e5bba69c1e783224" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7b738a51645e10f864cc25c24d232fb03f37b475", - "reference": "7b738a51645e10f864cc25c24d232fb03f37b475", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4a7a8cdca1120c091b4797f0e5bba69c1e783224", + "reference": "4a7a8cdca1120c091b4797f0e5bba69c1e783224", "shasum": "" }, "require": { @@ -713,7 +713,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-11-18T17:27:11+00:00" + "time": "2020-01-10T21:57:37+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -775,16 +775,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.0.2", + "version": "v5.0.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "1d71f670bc5a07b9ccc97dc44f932177a322d4e6" + "reference": "3afadc0f57cd74f86379d073e694b0f2cda2a88c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/1d71f670bc5a07b9ccc97dc44f932177a322d4e6", - "reference": "1d71f670bc5a07b9ccc97dc44f932177a322d4e6", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3afadc0f57cd74f86379d073e694b0f2cda2a88c", + "reference": "3afadc0f57cd74f86379d073e694b0f2cda2a88c", "shasum": "" }, "require": { @@ -821,20 +821,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-11-26T23:25:11+00:00" + "time": "2020-01-21T08:40:24+00:00" }, { "name": "symfony/finder", - "version": "v5.0.2", + "version": "v5.0.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "17874dd8ab9a19422028ad56172fb294287a701b" + "reference": "4176e7cb846fe08f32518b7e0ed8462e2db8d9bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/17874dd8ab9a19422028ad56172fb294287a701b", - "reference": "17874dd8ab9a19422028ad56172fb294287a701b", + "url": "https://api.github.com/repos/symfony/finder/zipball/4176e7cb846fe08f32518b7e0ed8462e2db8d9bb", + "reference": "4176e7cb846fe08f32518b7e0ed8462e2db8d9bb", "shasum": "" }, "require": { @@ -870,20 +870,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-11-18T17:27:11+00:00" + "time": "2020-01-04T14:08:26+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.0.2", + "version": "v5.0.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68" + "reference": "b1ab86ce52b0c0abe031367a173005a025e30e04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68", - "reference": "1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b1ab86ce52b0c0abe031367a173005a025e30e04", + "reference": "b1ab86ce52b0c0abe031367a173005a025e30e04", "shasum": "" }, "require": { @@ -924,7 +924,7 @@ "configuration", "options" ], - "time": "2019-11-18T17:27:11+00:00" + "time": "2020-01-04T14:08:26+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1217,16 +1217,16 @@ }, { "name": "symfony/process", - "version": "v5.0.2", + "version": "v5.0.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e" + "reference": "f9ffd870f5ac01abec7b2b5e15f904ca9400ecd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e", - "reference": "ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e", + "url": "https://api.github.com/repos/symfony/process/zipball/f9ffd870f5ac01abec7b2b5e15f904ca9400ecd1", + "reference": "f9ffd870f5ac01abec7b2b5e15f904ca9400ecd1", "shasum": "" }, "require": { @@ -1262,7 +1262,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-12-10T11:06:55+00:00" + "time": "2020-01-09T09:53:06+00:00" }, { "name": "symfony/service-contracts", @@ -1324,16 +1324,16 @@ }, { "name": "symfony/stopwatch", - "version": "v5.0.2", + "version": "v5.0.3", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "d410282956706e0b08681a5527447a8e6b6f421e" + "reference": "5d9add8034135b9a5f7b101d1e42c797e7f053e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/d410282956706e0b08681a5527447a8e6b6f421e", - "reference": "d410282956706e0b08681a5527447a8e6b6f421e", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5d9add8034135b9a5f7b101d1e42c797e7f053e4", + "reference": "5d9add8034135b9a5f7b101d1e42c797e7f053e4", "shasum": "" }, "require": { @@ -1370,7 +1370,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2019-11-18T17:27:11+00:00" + "time": "2020-01-04T14:08:26+00:00" } ], "aliases": [], diff --git a/vendor-bin/daux/composer.lock b/vendor-bin/daux/composer.lock index c53a0572..c6383be1 100644 --- a/vendor-bin/daux/composer.lock +++ b/vendor-bin/daux/composer.lock @@ -648,16 +648,16 @@ }, { "name": "symfony/console", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0" + "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/82437719dab1e6bdd28726af14cb345c2ec816d0", - "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0", + "url": "https://api.github.com/repos/symfony/console/zipball/e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", + "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", "shasum": "" }, "require": { @@ -720,20 +720,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-12-17T10:32:23+00:00" + "time": "2020-01-10T21:54:01+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "fcae1cff5b57b2a9c3aabefeb1527678705ddb62" + "reference": "c33998709f3fe9b8e27e0277535b07fbf6fde37a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/fcae1cff5b57b2a9c3aabefeb1527678705ddb62", - "reference": "fcae1cff5b57b2a9c3aabefeb1527678705ddb62", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/c33998709f3fe9b8e27e0277535b07fbf6fde37a", + "reference": "c33998709f3fe9b8e27e0277535b07fbf6fde37a", "shasum": "" }, "require": { @@ -775,20 +775,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2019-12-19T15:57:49+00:00" + "time": "2020-01-04T13:00:46+00:00" }, { "name": "symfony/intl", - "version": "v5.0.2", + "version": "v5.0.3", "source": { "type": "git", "url": "https://github.com/symfony/intl.git", - "reference": "41f910d47883c6ab37087ca4a3332e21e1d682f4" + "reference": "2b3694976f02ed6a7894d8a772c9d55cee5d9677" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/intl/zipball/41f910d47883c6ab37087ca4a3332e21e1d682f4", - "reference": "41f910d47883c6ab37087ca4a3332e21e1d682f4", + "url": "https://api.github.com/repos/symfony/intl/zipball/2b3694976f02ed6a7894d8a772c9d55cee5d9677", + "reference": "2b3694976f02ed6a7894d8a772c9d55cee5d9677", "shasum": "" }, "require": { @@ -850,20 +850,20 @@ "l10n", "localization" ], - "time": "2019-11-26T23:25:11+00:00" + "time": "2020-01-04T14:08:26+00:00" }, { "name": "symfony/mime", - "version": "v5.0.2", + "version": "v5.0.3", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "0e6a4ced216e49d457eddcefb61132173a876d79" + "reference": "2a3c7fee1f1a0961fa9cf360d5da553d05095e59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/0e6a4ced216e49d457eddcefb61132173a876d79", - "reference": "0e6a4ced216e49d457eddcefb61132173a876d79", + "url": "https://api.github.com/repos/symfony/mime/zipball/2a3c7fee1f1a0961fa9cf360d5da553d05095e59", + "reference": "2a3c7fee1f1a0961fa9cf360d5da553d05095e59", "shasum": "" }, "require": { @@ -912,7 +912,7 @@ "mime", "mime-type" ], - "time": "2019-11-30T14:12:50+00:00" + "time": "2020-01-04T14:08:26+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1266,16 +1266,16 @@ }, { "name": "symfony/process", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b" + "reference": "f5697ab4cb14a5deed7473819e63141bf5352c36" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b84501ad50adb72a94fb460a5b5c91f693e99c9b", - "reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b", + "url": "https://api.github.com/repos/symfony/process/zipball/f5697ab4cb14a5deed7473819e63141bf5352c36", + "reference": "f5697ab4cb14a5deed7473819e63141bf5352c36", "shasum": "" }, "require": { @@ -1311,7 +1311,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-12-06T10:06:46+00:00" + "time": "2020-01-09T09:50:08+00:00" }, { "name": "symfony/service-contracts", @@ -1373,16 +1373,16 @@ }, { "name": "symfony/yaml", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c" + "reference": "cd014e425b3668220adb865f53bff64b3ad21767" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/a08832b974dd5fafe3085a66d41fe4c84bb2628c", - "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c", + "url": "https://api.github.com/repos/symfony/yaml/zipball/cd014e425b3668220adb865f53bff64b3ad21767", + "reference": "cd014e425b3668220adb865f53bff64b3ad21767", "shasum": "" }, "require": { @@ -1428,7 +1428,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-12-10T10:33:21+00:00" + "time": "2020-01-21T11:12:16+00:00" }, { "name": "webuni/commonmark-table-extension", diff --git a/vendor-bin/phpunit/composer.lock b/vendor-bin/phpunit/composer.lock index 3c3867b5..5b65c64b 100644 --- a/vendor-bin/phpunit/composer.lock +++ b/vendor-bin/phpunit/composer.lock @@ -561,24 +561,24 @@ }, { "name": "phpspec/prophecy", - "version": "1.10.1", + "version": "v1.10.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc" + "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/cbe1df668b3fe136bcc909126a0f529a78d4cbbc", - "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b4400efc9d206e83138e2bb97ed7f5b14b831cd9", + "reference": "b4400efc9d206e83138e2bb97ed7f5b14b831cd9", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" }, "require-dev": { "phpspec/phpspec": "^2.5 || ^3.2", @@ -620,7 +620,7 @@ "spy", "stub" ], - "time": "2019-12-22T21:05:45+00:00" + "time": "2020-01-20T15:57:02+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/vendor-bin/robo/composer.lock b/vendor-bin/robo/composer.lock index 49fe7d99..d7637a99 100644 --- a/vendor-bin/robo/composer.lock +++ b/vendor-bin/robo/composer.lock @@ -1095,16 +1095,16 @@ }, { "name": "symfony/console", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0" + "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/82437719dab1e6bdd28726af14cb345c2ec816d0", - "reference": "82437719dab1e6bdd28726af14cb345c2ec816d0", + "url": "https://api.github.com/repos/symfony/console/zipball/e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", + "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", "shasum": "" }, "require": { @@ -1167,20 +1167,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-12-17T10:32:23+00:00" + "time": "2020-01-10T21:54:01+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "b3c3068a72623287550fe20b84a2b01dcba2686f" + "reference": "9e3de195e5bc301704dd6915df55892f6dfc208b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b3c3068a72623287550fe20b84a2b01dcba2686f", - "reference": "b3c3068a72623287550fe20b84a2b01dcba2686f", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9e3de195e5bc301704dd6915df55892f6dfc208b", + "reference": "9e3de195e5bc301704dd6915df55892f6dfc208b", "shasum": "" }, "require": { @@ -1237,7 +1237,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-11-28T13:33:56+00:00" + "time": "2020-01-10T21:54:01+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -1299,16 +1299,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "40c2606131d56eff6f193b6e2ceb92414653b591" + "reference": "266c9540b475f26122b61ef8b23dd9198f5d1cfd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/40c2606131d56eff6f193b6e2ceb92414653b591", - "reference": "40c2606131d56eff6f193b6e2ceb92414653b591", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/266c9540b475f26122b61ef8b23dd9198f5d1cfd", + "reference": "266c9540b475f26122b61ef8b23dd9198f5d1cfd", "shasum": "" }, "require": { @@ -1345,20 +1345,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-11-26T23:16:41+00:00" + "time": "2020-01-21T08:20:44+00:00" }, { "name": "symfony/finder", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "ce8743441da64c41e2a667b8eb66070444ed911e" + "reference": "3a50be43515590faf812fbd7708200aabc327ec3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/ce8743441da64c41e2a667b8eb66070444ed911e", - "reference": "ce8743441da64c41e2a667b8eb66070444ed911e", + "url": "https://api.github.com/repos/symfony/finder/zipball/3a50be43515590faf812fbd7708200aabc327ec3", + "reference": "3a50be43515590faf812fbd7708200aabc327ec3", "shasum": "" }, "require": { @@ -1394,7 +1394,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-11-17T21:56:56+00:00" + "time": "2020-01-04T13:00:46+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1573,16 +1573,16 @@ }, { "name": "symfony/process", - "version": "v3.4.36", + "version": "v3.4.37", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "9a4545c01e1e4f473492bd52b71e574dcc401ca2" + "reference": "5b9d2bcffe4678911a4c941c00b7c161252cf09a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/9a4545c01e1e4f473492bd52b71e574dcc401ca2", - "reference": "9a4545c01e1e4f473492bd52b71e574dcc401ca2", + "url": "https://api.github.com/repos/symfony/process/zipball/5b9d2bcffe4678911a4c941c00b7c161252cf09a", + "reference": "5b9d2bcffe4678911a4c941c00b7c161252cf09a", "shasum": "" }, "require": { @@ -1618,7 +1618,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-11-28T10:05:51+00:00" + "time": "2020-01-01T11:03:25+00:00" }, { "name": "symfony/service-contracts", @@ -1680,16 +1680,16 @@ }, { "name": "symfony/yaml", - "version": "v4.4.2", + "version": "v4.4.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c" + "reference": "cd014e425b3668220adb865f53bff64b3ad21767" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/a08832b974dd5fafe3085a66d41fe4c84bb2628c", - "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c", + "url": "https://api.github.com/repos/symfony/yaml/zipball/cd014e425b3668220adb865f53bff64b3ad21767", + "reference": "cd014e425b3668220adb865f53bff64b3ad21767", "shasum": "" }, "require": { @@ -1735,7 +1735,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-12-10T10:33:21+00:00" + "time": "2020-01-21T11:12:16+00:00" } ], "aliases": [], From 9cb7cf485df0452bea335ed94b22d1282fab4079 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Thu, 23 Jan 2020 17:07:58 -0500 Subject: [PATCH 10/14] Style fix --- tests/docroot/Feed/Caching/304Conditional.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/docroot/Feed/Caching/304Conditional.php b/tests/docroot/Feed/Caching/304Conditional.php index 3f55bb28..6b2002f0 100644 --- a/tests/docroot/Feed/Caching/304Conditional.php +++ b/tests/docroot/Feed/Caching/304Conditional.php @@ -1,9 +1,9 @@ Date: Fri, 24 Jan 2020 15:54:08 -0500 Subject: [PATCH 11/14] Fix remaining Picofeed-related test failures --- lib/Feed/Exception.php | 5 +---- tests/cases/CLI/TestCLI.php | 3 ++- tests/cases/Database/SeriesSubscription.php | 3 ++- tests/cases/Feed/TestFetching.php | 2 +- tests/cases/REST/TinyTinyRSS/TestAPI.php | 9 +++++---- tests/lib/AbstractTest.php | 14 ++++++++++++++ 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/lib/Feed/Exception.php b/lib/Feed/Exception.php index 3cab2c93..b9d20560 100644 --- a/lib/Feed/Exception.php +++ b/lib/Feed/Exception.php @@ -29,10 +29,7 @@ class Exception extends \JKingWeb\Arsse\AbstractException { $msgID = "tooManyRedirects"; break; default: - $c = $e->getCode(); - if ($c >= 400 && $c < 600) { - $msgID = "transmissionError"; - } + $msgID = "transmissionError"; } } elseif ($e instanceof TooManyRedirectsException) { $msgID = "maxRedirect"; diff --git a/tests/cases/CLI/TestCLI.php b/tests/cases/CLI/TestCLI.php index 6056912b..ef302f22 100644 --- a/tests/cases/CLI/TestCLI.php +++ b/tests/cases/CLI/TestCLI.php @@ -6,6 +6,7 @@ declare(strict_types=1); namespace JKingWeb\Arsse\TestCase\CLI; +use GuzzleHttp\Exception\ClientException; use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\Conf; use JKingWeb\Arsse\User; @@ -81,7 +82,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { public function testRefreshAFeed(string $cmd, int $exitStatus, string $output): void { Arsse::$db = \Phake::mock(Database::class); \Phake::when(Arsse::$db)->feedUpdate(1, true)->thenReturn(true); - \Phake::when(Arsse::$db)->feedUpdate(2, true)->thenThrow(new \JKingWeb\Arsse\Feed\Exception("http://example.com/", new \PicoFeed\Client\InvalidUrlException)); + \Phake::when(Arsse::$db)->feedUpdate(2, true)->thenThrow(new \JKingWeb\Arsse\Feed\Exception("http://example.com/", $this->mockGuzzleException(ClientException::class, "", 404))); $this->assertConsole($this->cli, $cmd, $exitStatus, $output); \Phake::verify($this->cli)->loadConf; \Phake::verify(Arsse::$db)->feedUpdate; diff --git a/tests/cases/Database/SeriesSubscription.php b/tests/cases/Database/SeriesSubscription.php index 434427e5..a89319e9 100644 --- a/tests/cases/Database/SeriesSubscription.php +++ b/tests/cases/Database/SeriesSubscription.php @@ -6,6 +6,7 @@ declare(strict_types=1); namespace JKingWeb\Arsse\TestCase\Database; +use GuzzleHttp\Exception\ClientException; use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\Test\Database; use JKingWeb\Arsse\Feed\Exception as FeedException; @@ -200,7 +201,7 @@ trait SeriesSubscription { public function testAddASubscriptionToAnInvalidFeed(): void { $url = "http://example.org/feed1"; $feedID = $this->nextID("arsse_feeds"); - \Phake::when(Arsse::$db)->feedUpdate->thenThrow(new FeedException($url, new \PicoFeed\Client\InvalidUrlException())); + \Phake::when(Arsse::$db)->feedUpdate->thenThrow(new FeedException($url, $this->mockGuzzleException(ClientException::class, "", 404))); $this->assertException("invalidUrl", "Feed"); try { Arsse::$db->subscriptionAdd($this->user, $url, "", "", false); diff --git a/tests/cases/Feed/TestFetching.php b/tests/cases/Feed/TestFetching.php index 4ac7ece5..3ce3e8d2 100644 --- a/tests/cases/Feed/TestFetching.php +++ b/tests/cases/Feed/TestFetching.php @@ -58,7 +58,7 @@ class TestFetching extends \JKingWeb\Arsse\Test\AbstractTest { } public function testHandleAnOverlyLargeFeed(): void { - $this->markTestIncomplete(); + $this->markTestIncomplete("The nicolus/picofeed library does not implement miniflux/picofeed's max-size setting"); Arsse::$conf->fetchSizeLimit = 512; $this->assertException("maxSize", "Feed"); new Feed(null, $this->base."Fetching/TooLarge"); diff --git a/tests/cases/REST/TinyTinyRSS/TestAPI.php b/tests/cases/REST/TinyTinyRSS/TestAPI.php index 8f94c76c..0db7f1f8 100644 --- a/tests/cases/REST/TinyTinyRSS/TestAPI.php +++ b/tests/cases/REST/TinyTinyRSS/TestAPI.php @@ -6,6 +6,7 @@ declare(strict_types=1); namespace JKingWeb\Arsse\TestCase\REST\TinyTinyRSS; +use GuzzleHttp\Exception\ClientException; use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\User; use JKingWeb\Arsse\Database; @@ -785,12 +786,12 @@ LONG_STRING; ]; $out = [ ['code' => 1, 'feed_id' => 2], - ['code' => 5, 'message' => (new \JKingWeb\Arsse\Feed\Exception("http://example.com/1", new \PicoFeed\Client\UnauthorizedException()))->getMessage()], + ['code' => 5, 'message' => (new \JKingWeb\Arsse\Feed\Exception("http://example.com/1", $this->mockGuzzleException(ClientException::class, "", 401)))->getMessage()], ['code' => 1, 'feed_id' => 0], ['code' => 0, 'feed_id' => 3], ['code' => 0, 'feed_id' => 1], ['code' => 3, 'message' => (new \JKingWeb\Arsse\Feed\Exception("http://localhost:8000/Feed/Discovery/Invalid", new \PicoFeed\Reader\SubscriptionNotFoundException()))->getMessage()], - ['code' => 2, 'message' => (new \JKingWeb\Arsse\Feed\Exception("http://example.com/6", new \PicoFeed\Client\InvalidUrlException()))->getMessage()], + ['code' => 2, 'message' => (new \JKingWeb\Arsse\Feed\Exception("http://example.com/6", $this->mockGuzzleException(ClientException::class, "", 404)))->getMessage()], ['code' => 6, 'message' => (new \JKingWeb\Arsse\Feed\Exception("http://example.com/7", new \PicoFeed\Parser\MalformedXmlException()))->getMessage()], ['code' => 1, 'feed_id' => 4], ['code' => 0, 'feed_id' => 4], @@ -802,12 +803,12 @@ LONG_STRING; ['id' => 4, 'url' => "http://example.com/9"], ]; \Phake::when(Arsse::$db)->subscriptionAdd(...$db[0])->thenReturn(2); - \Phake::when(Arsse::$db)->subscriptionAdd(...$db[1])->thenThrow(new \JKingWeb\Arsse\Feed\Exception("http://example.com/1", new \PicoFeed\Client\UnauthorizedException())); + \Phake::when(Arsse::$db)->subscriptionAdd(...$db[1])->thenThrow(new \JKingWeb\Arsse\Feed\Exception("http://example.com/1", $this->mockGuzzleException(ClientException::class, "", 401))); \Phake::when(Arsse::$db)->subscriptionAdd(...$db[2])->thenReturn(2); \Phake::when(Arsse::$db)->subscriptionAdd(...$db[3])->thenThrow(new ExceptionInput("constraintViolation")); \Phake::when(Arsse::$db)->subscriptionAdd(...$db[4])->thenThrow(new ExceptionInput("constraintViolation")); \Phake::when(Arsse::$db)->subscriptionAdd(...$db[5])->thenThrow(new ExceptionInput("constraintViolation")); - \Phake::when(Arsse::$db)->subscriptionAdd(...$db[6])->thenThrow(new \JKingWeb\Arsse\Feed\Exception("http://example.com/6", new \PicoFeed\Client\InvalidUrlException())); + \Phake::when(Arsse::$db)->subscriptionAdd(...$db[6])->thenThrow(new \JKingWeb\Arsse\Feed\Exception("http://example.com/6", $this->mockGuzzleException(ClientException::class, "", 404))); \Phake::when(Arsse::$db)->subscriptionAdd(...$db[7])->thenThrow(new \JKingWeb\Arsse\Feed\Exception("http://example.com/7", new \PicoFeed\Parser\MalformedXmlException())); \Phake::when(Arsse::$db)->subscriptionAdd(...$db[8])->thenReturn(4); \Phake::when(Arsse::$db)->subscriptionAdd(...$db[9])->thenThrow(new ExceptionInput("constraintViolation")); diff --git a/tests/lib/AbstractTest.php b/tests/lib/AbstractTest.php index 0a553d13..1a032788 100644 --- a/tests/lib/AbstractTest.php +++ b/tests/lib/AbstractTest.php @@ -6,6 +6,8 @@ declare(strict_types=1); namespace JKingWeb\Arsse\Test; +use GuzzleHttp\Exception\GuzzleException; +use GuzzleHttp\Exception\RequestException; use JKingWeb\Arsse\Exception; use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\Conf; @@ -325,4 +327,16 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { $this->assertArraySubset($expected, [], false, "Expectations not in result set."); } } + + /** Guzzle's exception classes require some fairly complicated construction; this abstracts it all away so that only message and code need be supplied */ + protected function mockGuzzleException(string $class, ?string $message = null, ?int $code = null, ?\Throwable $e = null): GuzzleException { + if (is_a($class, RequestException::class, true)) { + $req = \Phake::mock(RequestInterface::class); + $res = \Phake::mock(ResponseInterface::class); + \Phake::when($res)->getStatusCode->thenReturn($code ?? 0); + return new $class($message ?? "", $req, $res, $e); + } else { + return new $class($message ?? "", $code ?? 0, $e); + } + } } From 04878bda9d82db8a4c58e339b90a18431bc2e8a5 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Sat, 25 Jan 2020 11:18:51 -0500 Subject: [PATCH 12/14] Documentation changes --- CHANGELOG | 3 ++- UPGRADING | 14 ++++++++++++++ docs/en/020_Getting_Started/010_Requirements.md | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index f5618ba8..5894c7c5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,7 +2,8 @@ Version 0.8.3 (2020-??-??) ========================== Changes: -- Officially require PHP 7.1 (effectively required since version 0.8.0) +- Officially require PHP 7.1 (accidentally required since version 0.8.0) +- Various internal changes pursuant to use of PHP 7.1 Version 0.8.2 (2019-12-07) ========================== diff --git a/UPGRADING b/UPGRADING index a78867b1..42687d74 100644 --- a/UPGRADING +++ b/UPGRADING @@ -11,6 +11,20 @@ usually prudent: `composer install -o --no-dev` +Upgrading from 0.8.2 to 0.8.3 +============================= + +- PHP 7.1 is now required +- The following Composer dependencies have been added: + - nicolus/picofeed + - laminas/laminas-diactoros + - laminas/laminas-httphandlerrunner +- The following Composer dependencies have been removed: + - p3k/picofeed + - zendframework/zend-diactoros + - zendframework/zend-httphandlerrunner + + Upgrading from 0.8.1 to 0.8.2 ============================= diff --git a/docs/en/020_Getting_Started/010_Requirements.md b/docs/en/020_Getting_Started/010_Requirements.md index f7818699..7b3b6ef1 100644 --- a/docs/en/020_Getting_Started/010_Requirements.md +++ b/docs/en/020_Getting_Started/010_Requirements.md @@ -8,6 +8,7 @@ The Arsse has the following requirements: - [sqlite3](http://php.net/manual/en/book.sqlite3.php) or [pdo_sqlite](http://php.net/manual/en/ref.pdo-sqlite.php) for SQLite databases - [pgsql](http://php.net/manual/en/book.pgsql.php) or [pdo_pgsql](http://php.net/manual/en/ref.pdo-pgsql.php) for PostgreSQL 10 or later databases - [mysqli](http://php.net/manual/en/book.mysqli.php) or [pdo_mysql](http://php.net/manual/en/ref.pdo-mysql.php) for MySQL/Percona 8.0.11 or later databases + - [curl](http://php.net/manual/en/book.curl.php) (optional) - Privileges either to create and run systemd services, or to run cron jobs Instructions for how to satisfy the PHP extension requirements for Debian systems are included in the next section. From 39a1895867aa674ff8611b20c35adfd77d77897f Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 3 Feb 2020 16:54:45 -0500 Subject: [PATCH 13/14] Refine and cover new Guzzle error handling --- lib/AbstractException.php | 2 + lib/Feed.php | 12 +- lib/Feed/Exception.php | 40 ++----- locale/en.php | 2 + tests/cases/Feed/TestException.php | 177 +++++++++++++++++++++++++++++ tests/cases/Feed/TestFeed.php | 1 - tests/phpunit.dist.xml | 1 + 7 files changed, 197 insertions(+), 38 deletions(-) create mode 100644 tests/cases/Feed/TestException.php diff --git a/lib/AbstractException.php b/lib/AbstractException.php index 8aaff950..31623458 100644 --- a/lib/AbstractException.php +++ b/lib/AbstractException.php @@ -75,6 +75,7 @@ abstract class AbstractException extends \Exception { "User/Exception.authFailed" => 10412, "User/ExceptionAuthz.notAuthorized" => 10421, "User/ExceptionSession.invalid" => 10431, + "Feed/Exception.internalError" => 10500, "Feed/Exception.invalidCertificate" => 10501, "Feed/Exception.invalidUrl" => 10502, "Feed/Exception.maxRedirect" => 10503, @@ -83,6 +84,7 @@ abstract class AbstractException extends \Exception { "Feed/Exception.forbidden" => 10506, "Feed/Exception.unauthorized" => 10507, "Feed/Exception.transmissionError" => 10508, + "Feed/Exception.connectionFailed" => 10509, "Feed/Exception.malformedXml" => 10511, "Feed/Exception.xmlEntity" => 10512, "Feed/Exception.subscriptionNotFound" => 10521, diff --git a/lib/Feed.php b/lib/Feed.php index 984b4493..e8e5dac2 100644 --- a/lib/Feed.php +++ b/lib/Feed.php @@ -100,7 +100,7 @@ class Feed { $client->reader = $reader; return $client; } catch (PicoFeedException $e) { - throw new Feed\Exception($url, $e); + throw new Feed\Exception($url, $e); // @codeCoverageIgnore } catch (\GuzzleHttp\Exception\GuzzleException $e) { throw new Feed\Exception($url, $e); } @@ -117,16 +117,10 @@ class Feed { // Some feeds might use a different domain (eg: feedburner), so the site url is // used instead of the feed's url. $this->favicon = (new Favicon)->find($feed->siteUrl); - // work around a PicoFeed memory leak - libxml_use_internal_errors(false); } catch (PicoFeedException $e) { - // work around a PicoFeed memory leak - libxml_use_internal_errors(false); - throw new Feed\Exception($this->resource->getUrl(), $e); - } catch (\GuzzleHttp\Exception\GuzzleException $e) { - // work around a PicoFeed memory leak - libxml_use_internal_errors(false); throw new Feed\Exception($this->resource->getUrl(), $e); + } catch (\GuzzleHttp\Exception\GuzzleException $e) { // @codeCoverageIgnore + throw new Feed\Exception($this->resource->getUrl(), $e); // @codeCoverageIgnore } // PicoFeed does not provide valid ids when there is no id element. Its solution diff --git a/lib/Feed/Exception.php b/lib/Feed/Exception.php index b9d20560..00c76524 100644 --- a/lib/Feed/Exception.php +++ b/lib/Feed/Exception.php @@ -12,48 +12,32 @@ use GuzzleHttp\Exception\TooManyRedirectsException; use PicoFeed\PicoFeedException; class Exception extends \JKingWeb\Arsse\AbstractException { + const CURL_ERROR_MAP = [1=>"invalidUrl",3=>"invalidUrl",5=>"transmissionError","connectionFailed","connectionFailed","transmissionError","forbidden","unauthorized","transmissionError","transmissionError","transmissionError","transmissionError","connectionFailed","connectionFailed","transmissionError","transmissionError","transmissionError","transmissionError","transmissionError","invalidUrl","transmissionError","transmissionError","transmissionError","transmissionError",28=>"timeout","transmissionError","transmissionError","transmissionError","transmissionError","transmissionError",35=>"invalidCertificate","transmissionError","transmissionError","transmissionError","transmissionError",45=>"transmissionError","unauthorized","maxRedirect",52=>"transmissionError","invalidCertificate","invalidCertificate","transmissionError","transmissionError",58=>"invalidCertificate","invalidCertificate","invalidCertificate","transmissionError","invalidUrl","transmissionError","invalidCertificate","transmissionError","invalidCertificate","forbidden","invalidUrl","forbidden","transmissionError",73=>"transmissionError","transmissionError",77=>"invalidCertificate","invalidUrl",90=>"invalidCertificate","invalidCertificate","transmissionError",94=>"unauthorized","transmissionError","connectionFailed"]; + const HTTP_ERROR_MAP = [401=>"unauthorized",403=>"forbidden",404=>"invalidUrl",408=>"timeout",410=>"invalidUrl",414=>"invalidUrl",451=>"invalidUrl"]; + public function __construct($url, \Throwable $e) { if ($e instanceof BadResponseException) { - switch ($e->getCode()) { - case 401: - $msgID = "unauthorized"; - break; - case 403: - $msgID = "forbidden"; - break; - case 404: - case 410: - $msgID = "invalidUrl"; - break; - case 508: - $msgID = "tooManyRedirects"; - break; - default: - $msgID = "transmissionError"; - } + $msgID = self::HTTP_ERROR_MAP[$e->getCode()] ?? "transmissionError"; } elseif ($e instanceof TooManyRedirectsException) { $msgID = "maxRedirect"; } elseif ($e instanceof GuzzleException) { - $m = $e->getMessage(); - if (preg_match("/^Error creating resource:/", $m)) { + $msg = $e->getMessage(); + if (preg_match("/^Error creating resource:/", $msg)) { // PHP stream error; the class of error is ambiguous - $msgID = "transmissionError"; // @codeCoverageIgnore - } elseif (preg_match("/^cURL error 35:/", $m)) { - $msgID = "invalidCertificate"; - } elseif (preg_match("/^cURL error 28:/", $m)) { - $msgID = "timeout"; + $msgID = "transmissionError"; + } elseif (preg_match("/^cURL error (\d+):/", $msg, $match)) { + $msgID = self::CURL_ERROR_MAP[(int) $match[1]] ?? "internalError"; } else { - var_export($m); - exit; + $msgID = "internalError"; } } elseif ($e instanceof PicoFeedException) { $className = get_class($e); // Convert the exception thrown by PicoFeed to the one to be thrown here. $msgID = preg_replace('/^PicoFeed\\\(?:Client|Parser|Reader)\\\([A-Za-z]+)Exception$/', '$1', $className); // If the message ID doesn't change then it's unknown. - $msgID = ($msgID !== $className) ? lcfirst($msgID) : ''; + $msgID = ($msgID !== $className) ? lcfirst($msgID) : "internalError"; } else { - $msgID = get_class($e); + $msgID = "internalError"; } parent::__construct($msgID, ['url' => $url], $e); } diff --git a/locale/en.php b/locale/en.php index d66fddf3..c19ac94b 100644 --- a/locale/en.php +++ b/locale/en.php @@ -144,6 +144,7 @@ return [ other {Authenticated user is not authorized to perform the action "{action}" on behalf of {user}} }', 'Exception.JKingWeb/Arsse/User/ExceptionSession.invalid' => 'Session with ID {0} does not exist', + 'Exception.JKingWeb/Arsse/Feed/Exception.internalError' => 'Could not download feed "{url}" because of an internal error which is probably a bug', 'Exception.JKingWeb/Arsse/Feed/Exception.invalidCertificate' => 'Could not download feed "{url}" because its server is serving an invalid SSL certificate', 'Exception.JKingWeb/Arsse/Feed/Exception.invalidUrl' => 'Feed URL "{url}" is invalid', 'Exception.JKingWeb/Arsse/Feed/Exception.maxRedirect' => 'Could not download feed "{url}" because its server reached its maximum number of HTTP redirections', @@ -152,6 +153,7 @@ return [ 'Exception.JKingWeb/Arsse/Feed/Exception.forbidden' => 'Could not download feed "{url}" because you do not have permission to access it', 'Exception.JKingWeb/Arsse/Feed/Exception.unauthorized' => 'Could not download feed "{url}" because you provided insufficient or invalid credentials', 'Exception.JKingWeb/Arsse/Feed/Exception.transmissionError' => 'Could not download feed "{url}" because of a network error', + 'Exception.JKingWeb/Arsse/Feed/Exception.connectionFailed' => 'Could not download feed "{url}" because its server could not be reached', 'Exception.JKingWeb/Arsse/Feed/Exception.malformedXml' => 'Could not parse feed "{url}" because it is malformed', 'Exception.JKingWeb/Arsse/Feed/Exception.xmlEntity' => 'Refused to parse feed "{url}" because it contains an XXE attack', 'Exception.JKingWeb/Arsse/Feed/Exception.subscriptionNotFound' => 'Unable to find a feed at location "{url}"', diff --git a/tests/cases/Feed/TestException.php b/tests/cases/Feed/TestException.php new file mode 100644 index 00000000..9fc35747 --- /dev/null +++ b/tests/cases/Feed/TestException.php @@ -0,0 +1,177 @@ +mockGuzzleException(TransferException::class, "cURL error $code: Some message", 0); + $this->assertException($message, "Feed"); + throw new FeedException("https://example.com/", $e); + } + + public function provideCurlErrors() { + return [ + 'CURLE_UNSUPPORTED_PROTOCOL' => [1, "invalidUrl"], + 'CURLE_FAILED_INIT' => [2, "internalError"], + 'CURLE_URL_MALFORMAT' => [3, "invalidUrl"], + 'CURLE_URL_MALFORMAT_USER' => [4, "internalError"], + 'CURLE_COULDNT_RESOLVE_PROXY' => [5, "transmissionError"], + 'CURLE_COULDNT_RESOLVE_HOST' => [6, "connectionFailed"], + 'CURLE_COULDNT_CONNECT' => [7, "connectionFailed"], + 'CURLE_WEIRD_SERVER_REPLY' => [8, "transmissionError"], + 'CURLE_FTP_ACCESS_DENIED' => [9, "forbidden"], + 'CURLE_FTP_USER_PASSWORD_INCORRECT' => [10, "unauthorized"], + 'CURLE_FTP_WEIRD_PASS_REPLY' => [11, "transmissionError"], + 'CURLE_FTP_WEIRD_USER_REPLY' => [12, "transmissionError"], + 'CURLE_FTP_WEIRD_PASV_REPLY' => [13, "transmissionError"], + 'CURLE_FTP_WEIRD_227_FORMAT' => [14, "transmissionError"], + 'CURLE_FTP_CANT_GET_HOST' => [15, "connectionFailed"], + 'CURLE_FTP_CANT_RECONNECT' => [16, "connectionFailed"], + 'CURLE_FTP_COULDNT_SET_BINARY' => [17, "transmissionError"], + 'CURLE_PARTIAL_FILE' => [18, "transmissionError"], + 'CURLE_FTP_COULDNT_RETR_FILE' => [19, "transmissionError"], + 'CURLE_FTP_WRITE_ERROR' => [20, "transmissionError"], + 'CURLE_FTP_QUOTE_ERROR' => [21, "transmissionError"], + 'CURLE_HTTP_NOT_FOUND' => [22, "invalidUrl"], + 'CURLE_WRITE_ERROR' => [23, "transmissionError"], + 'CURLE_MALFORMAT_USER' => [24, "transmissionError"], + 'CURLE_FTP_COULDNT_STOR_FILE' => [25, "transmissionError"], + 'CURLE_READ_ERROR' => [26, "transmissionError"], + 'CURLE_OUT_OF_MEMORY' => [27, "internalError"], + 'CURLE_OPERATION_TIMEDOUT' => [28, "timeout"], + 'CURLE_FTP_COULDNT_SET_ASCII' => [29, "transmissionError"], + 'CURLE_FTP_PORT_FAILED' => [30, "transmissionError"], + 'CURLE_FTP_COULDNT_USE_REST' => [31, "transmissionError"], + 'CURLE_FTP_COULDNT_GET_SIZE' => [32, "transmissionError"], + 'CURLE_HTTP_RANGE_ERROR' => [33, "transmissionError"], + 'CURLE_HTTP_POST_ERROR' => [34, "internalError"], + 'CURLE_SSL_CONNECT_ERROR' => [35, "invalidCertificate"], + 'CURLE_BAD_DOWNLOAD_RESUME' => [36, "transmissionError"], + 'CURLE_FILE_COULDNT_READ_FILE' => [37, "transmissionError"], + 'CURLE_LDAP_CANNOT_BIND' => [38, "transmissionError"], + 'CURLE_LDAP_SEARCH_FAILED' => [39, "transmissionError"], + 'CURLE_LIBRARY_NOT_FOUND' => [40, "internalError"], + 'CURLE_FUNCTION_NOT_FOUND' => [41, "internalError"], + 'CURLE_ABORTED_BY_CALLBACK' => [42, "internalError"], + 'CURLE_BAD_FUNCTION_ARGUMENT' => [43, "internalError"], + 'CURLE_BAD_CALLING_ORDER' => [44, "internalError"], + 'CURLE_HTTP_PORT_FAILED' => [45, "transmissionError"], + 'CURLE_BAD_PASSWORD_ENTERED' => [46, "unauthorized"], + 'CURLE_TOO_MANY_REDIRECTS' => [47, "maxRedirect"], + 'CURLE_UNKNOWN_TELNET_OPTION' => [48, "internalError"], + 'CURLE_TELNET_OPTION_SYNTAX' => [49, "internalError"], + 'Unknown error 50' => [50, "internalError"], + 'Unknown error 51' => [51, "internalError"], + 'CURLE_GOT_NOTHING' => [52, "transmissionError"], + 'CURLE_SSL_ENGINE_NOTFOUND' => [53, "invalidCertificate"], + 'CURLE_SSL_ENGINE_SETFAILED' => [54, "invalidCertificate"], + 'CURLE_SEND_ERROR' => [55, "transmissionError"], + 'CURLE_RECV_ERROR' => [56, "transmissionError"], + 'CURLE_SHARE_IN_USE' => [57, "internalError"], + 'CURLE_SSL_CERTPROBLEM' => [58, "invalidCertificate"], + 'CURLE_SSL_CIPHER' => [59, "invalidCertificate"], + 'CURLE_SSL_CACERT' => [60, "invalidCertificate"], + 'CURLE_BAD_CONTENT_ENCODING' => [61, "transmissionError"], + 'CURLE_LDAP_INVALID_URL' => [62, "invalidUrl"], + 'CURLE_FILESIZE_EXCEEDED' => [63, "transmissionError"], + 'CURLE_USE_SSL_FAILED' => [64, "invalidCertificate"], + 'CURLE_SEND_FAIL_REWIND' => [65, "transmissionError"], + 'CURLE_SSL_ENGINE_INITFAILED' => [66, "invalidCertificate"], + 'CURLE_LOGIN_DENIED' => [67, "forbidden"], + 'CURLE_TFTP_NOTFOUND' => [68, "invalidUrl"], + 'CURLE_TFTP_PERM' => [69, "forbidden"], + 'CURLE_REMOTE_DISK_FULL' => [70, "transmissionError"], + 'CURLE_TFTP_ILLEGAL' => [71, "internalError"], + 'CURLE_TFTP_UNKNOWNID' => [72, "internalError"], + 'CURLE_REMOTE_FILE_EXISTS' => [73, "transmissionError"], + 'CURLE_TFTP_NOSUCHUSER' => [74, "transmissionError"], + 'CURLE_CONV_FAILED' => [75, "internalError"], + 'CURLE_CONV_REQD' => [76, "internalError"], + 'CURLE_SSL_CACERT_BADFILE' => [77, "invalidCertificate"], + 'CURLE_REMOTE_FILE_NOT_FOUND' => [78, "invalidUrl"], + 'CURLE_SSH' => [79, "internalError"], + 'CURLE_SSL_PINNEDPUBKEYNOTMATCH' => [90, "invalidCertificate"], + 'CURLE_SSL_INVALIDCERTSTATUS' => [91, "invalidCertificate"], + 'CURLE_HTTP2_STREAM' => [92, "transmissionError"], + 'CURLE_RECURSIVE_API_CALL' => [93, "internalError"], + 'CURLE_AUTH_ERROR' => [94, "unauthorized"], + 'CURLE_HTTP3' => [95, "transmissionError"], + 'CURLE_QUIC_CONNECT_ERROR' => [96, "connectionFailed"], + 'Hypothetical error 2112' => [2112, "internalError"], + ]; + } + + /** @dataProvider provideHTTPErrors */ + public function testHandleHttpErrors(int $code, string $message): void { + $e = $this->mockGuzzleException(BadResponseException::class, "Irrelevant message", $code); + $this->assertException($message, "Feed"); + throw new FeedException("https://example.com/", $e); + } + + public function provideHTTPErrors() { + $specials = [ + 401 => "unauthorized", + 403 => "forbidden", + 404 => "invalidUrl", + 408 => "timeout", + 410 => "invalidUrl", + 414 => "invalidUrl", + 451 => "invalidUrl" + ]; + $out = array_fill(400, (600 - 400), "transmissionError"); + foreach ($specials as $k => $t) { + $out[$k] = $t; + } + foreach ($out as $k => $t) { + $out[$k] = [$k, $t]; + } + return $out; + } + + /** @dataProvider providePicoFeedException */ + public function testHandlePicofeedException(PicoFeedException $e, string $message) { + $this->assertException($message, "Feed"); + throw new FeedException("https://example.com/", $e); + } + + public function providePicoFeedException() { + return [ + 'Failed feed discovery' => [new \PicoFeed\Reader\SubscriptionNotFoundException(), "subscriptionNotFound"], + 'Unsupported format' => [new \PicoFeed\Reader\UnsupportedFeedFormatException(), "unsupportedFeedFormat"], + 'Malformed XML' => [new \PicoFeed\Parser\MalformedXmlException(), "malformedXml"], + 'XML entity expansion' => [new \PicoFeed\Parser\XmlEntityException(), "xmlEntity"], + ]; + } + + public function testHandleExcessRedirections() { + $e = $this->mockGuzzleException(TooManyRedirectsException::class, "Irrelevant message", 404); + $this->assertException("maxRedirect", "Feed"); + throw new FeedException("https://example.com/", $e); + } + + public function testHandleGenericStreamErrors() { + $e = $this->mockGuzzleException(TransferException::class, "Error creating resource: Irrelevant message", 403); + $this->assertException("transmissionError", "Feed"); + throw new FeedException("https://example.com/", $e); + } + + public function testHandleUnexpectedError() { + $e = new \Exception; + $this->assertException("internalError", "Feed"); + throw new FeedException("https://example.com/", $e); + } +} diff --git a/tests/cases/Feed/TestFeed.php b/tests/cases/Feed/TestFeed.php index 1bcf50e5..c419100e 100644 --- a/tests/cases/Feed/TestFeed.php +++ b/tests/cases/Feed/TestFeed.php @@ -14,7 +14,6 @@ use JKingWeb\Arsse\Test\Result; /** * @covers \JKingWeb\Arsse\Feed - * @covers \JKingWeb\Arsse\Feed\Exception * @group slow */ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { protected static $host = "http://localhost:8000/"; diff --git a/tests/phpunit.dist.xml b/tests/phpunit.dist.xml index 6732b56a..ece5eef9 100644 --- a/tests/phpunit.dist.xml +++ b/tests/phpunit.dist.xml @@ -56,6 +56,7 @@ cases/User/TestUser.php + cases/Feed/TestException.php cases/Feed/TestFetching.php cases/Feed/TestFeed.php From 1d514e4739523b6ef675b5e4bfde8931a3b5e17c Mon Sep 17 00:00:00 2001 From: "J. King" Date: Sun, 16 Feb 2020 17:37:13 -0500 Subject: [PATCH 14/14] Remove forked picofeed repository --- composer.json | 8 +- composer.lock | 18 ++--- vendor-bin/csfixer/composer.lock | 82 ++++++++++---------- vendor-bin/daux/composer.lock | 124 +++++++++++++++---------------- vendor-bin/phpunit/composer.lock | 57 +++++++------- vendor-bin/robo/composer.lock | 54 +++++++------- 6 files changed, 168 insertions(+), 175 deletions(-) diff --git a/composer.json b/composer.json index 6d05da07..eb42d847 100644 --- a/composer.json +++ b/composer.json @@ -17,19 +17,13 @@ } ], - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/JKingweb/picoFeed-1" - } - ], "require": { "php": "^7.1", "ext-intl": "*", "ext-json": "*", "ext-hash": "*", "ext-dom": "*", - "nicolus/picofeed": "dev-fixed", + "nicolus/picofeed": "dev-master#0ebdf92852a4725f4807c200dd49bf9fff3905b7", "hosteurope/password-generator": "1.*", "docopt/docopt": "1.*", "jkingweb/druuid": "3.*", diff --git a/composer.lock b/composer.lock index 55e69958..b56c64bf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9710e0638278222dc8d6207d4141e529", + "content-hash": "1d03b34d159fbf69097aa783994f9cfa", "packages": [ { "name": "docopt/docopt", @@ -648,16 +648,16 @@ }, { "name": "nicolus/picofeed", - "version": "dev-fixed", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/JKingweb/picoFeed-1.git", - "reference": "009250e98ff0975335176f74e5fea95104058d09" + "url": "https://github.com/nicolus/picoFeed.git", + "reference": "0ebdf92852a4725f4807c200dd49bf9fff3905b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JKingweb/picoFeed-1/zipball/009250e98ff0975335176f74e5fea95104058d09", - "reference": "009250e98ff0975335176f74e5fea95104058d09", + "url": "https://api.github.com/repos/nicolus/picoFeed/zipball/0ebdf92852a4725f4807c200dd49bf9fff3905b7", + "reference": "0ebdf92852a4725f4807c200dd49bf9fff3905b7", "shasum": "" }, "require": { @@ -692,6 +692,7 @@ "PicoFeed": "lib/" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -705,10 +706,7 @@ ], "description": "RSS/Atom parsing library", "homepage": "https://github.com/nicolus/picoFeed", - "support": { - "source": "https://github.com/JKingweb/picoFeed-1/tree/fixed" - }, - "time": "2020-01-23T22:03:32+00:00" + "time": "2020-02-13T06:43:47+00:00" }, { "name": "psr/http-factory", diff --git a/vendor-bin/csfixer/composer.lock b/vendor-bin/csfixer/composer.lock index 5c8486a2..eb68d097 100644 --- a/vendor-bin/csfixer/composer.lock +++ b/vendor-bin/csfixer/composer.lock @@ -571,16 +571,16 @@ }, { "name": "symfony/console", - "version": "v5.0.3", + "version": "v5.0.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "345ab6ecb456b5147ea3b3271d7f1f00aadfd257" + "reference": "91c294166c38d8c0858a86fad76d8c14dc1144c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/345ab6ecb456b5147ea3b3271d7f1f00aadfd257", - "reference": "345ab6ecb456b5147ea3b3271d7f1f00aadfd257", + "url": "https://api.github.com/repos/symfony/console/zipball/91c294166c38d8c0858a86fad76d8c14dc1144c8", + "reference": "91c294166c38d8c0858a86fad76d8c14dc1144c8", "shasum": "" }, "require": { @@ -643,11 +643,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2020-01-19T11:13:19+00:00" + "time": "2020-01-25T15:56:29+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.0.3", + "version": "v5.0.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -775,7 +775,7 @@ }, { "name": "symfony/filesystem", - "version": "v5.0.3", + "version": "v5.0.4", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -825,7 +825,7 @@ }, { "name": "symfony/finder", - "version": "v5.0.3", + "version": "v5.0.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -874,7 +874,7 @@ }, { "name": "symfony/options-resolver", - "version": "v5.0.3", + "version": "v5.0.4", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", @@ -928,16 +928,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", "shasum": "" }, "require": { @@ -949,7 +949,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -982,20 +982,20 @@ "polyfill", "portable" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", "shasum": "" }, "require": { @@ -1007,7 +1007,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1041,20 +1041,20 @@ "portable", "shim" ], - "time": "2019-11-27T14:18:11+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "af23c7bb26a73b850840823662dda371484926c4" + "reference": "419c4940024c30ccc033650373a1fe13890d3255" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/af23c7bb26a73b850840823662dda371484926c4", - "reference": "af23c7bb26a73b850840823662dda371484926c4", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/419c4940024c30ccc033650373a1fe13890d3255", + "reference": "419c4940024c30ccc033650373a1fe13890d3255", "shasum": "" }, "require": { @@ -1064,7 +1064,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1100,20 +1100,20 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" + "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf", + "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf", "shasum": "" }, "require": { @@ -1122,7 +1122,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1155,20 +1155,20 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" + "reference": "5e66a0fa1070bf46bec4bea7962d285108edd675" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/5e66a0fa1070bf46bec4bea7962d285108edd675", + "reference": "5e66a0fa1070bf46bec4bea7962d285108edd675", "shasum": "" }, "require": { @@ -1177,7 +1177,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1213,11 +1213,11 @@ "portable", "shim" ], - "time": "2019-11-27T16:25:15+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/process", - "version": "v5.0.3", + "version": "v5.0.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -1324,7 +1324,7 @@ }, { "name": "symfony/stopwatch", - "version": "v5.0.3", + "version": "v5.0.4", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", diff --git a/vendor-bin/daux/composer.lock b/vendor-bin/daux/composer.lock index c6383be1..83b0143f 100644 --- a/vendor-bin/daux/composer.lock +++ b/vendor-bin/daux/composer.lock @@ -580,16 +580,16 @@ }, { "name": "scrivo/highlight.php", - "version": "v9.17.1.0", + "version": "v9.18.1.0", "source": { "type": "git", "url": "https://github.com/scrivo/highlight.php.git", - "reference": "5451a9ad6d638559cf2a092880f935c39776134e" + "reference": "a57c858cb753f543965a1e17af386a648012ed8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/5451a9ad6d638559cf2a092880f935c39776134e", - "reference": "5451a9ad6d638559cf2a092880f935c39776134e", + "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/a57c858cb753f543965a1e17af386a648012ed8f", + "reference": "a57c858cb753f543965a1e17af386a648012ed8f", "shasum": "" }, "require": { @@ -599,8 +599,8 @@ }, "require-dev": { "phpunit/phpunit": "^4.8|^5.7", - "symfony/finder": "^3.4", - "symfony/var-dumper": "^3.4" + "symfony/finder": "^2.8|^3.4", + "symfony/var-dumper": "^2.8|^3.4" }, "suggest": { "ext-dom": "Needed to make use of the features in the utilities namespace" @@ -644,20 +644,20 @@ "highlight.php", "syntax" ], - "time": "2019-12-13T21:54:06+00:00" + "time": "2020-02-03T02:19:36+00:00" }, { "name": "symfony/console", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f" + "reference": "f512001679f37e6a042b51897ed24a2f05eba656" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", - "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", + "url": "https://api.github.com/repos/symfony/console/zipball/f512001679f37e6a042b51897ed24a2f05eba656", + "reference": "f512001679f37e6a042b51897ed24a2f05eba656", "shasum": "" }, "require": { @@ -720,20 +720,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2020-01-10T21:54:01+00:00" + "time": "2020-01-25T12:44:29+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "c33998709f3fe9b8e27e0277535b07fbf6fde37a" + "reference": "491a20dfa87e0b3990170593bc2de0bb34d828a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/c33998709f3fe9b8e27e0277535b07fbf6fde37a", - "reference": "c33998709f3fe9b8e27e0277535b07fbf6fde37a", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/491a20dfa87e0b3990170593bc2de0bb34d828a5", + "reference": "491a20dfa87e0b3990170593bc2de0bb34d828a5", "shasum": "" }, "require": { @@ -775,20 +775,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2020-01-04T13:00:46+00:00" + "time": "2020-01-31T09:11:17+00:00" }, { "name": "symfony/intl", - "version": "v5.0.3", + "version": "v5.0.4", "source": { "type": "git", "url": "https://github.com/symfony/intl.git", - "reference": "2b3694976f02ed6a7894d8a772c9d55cee5d9677" + "reference": "519bcb27ea53835c1e8e7f7c8a799c867d570156" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/intl/zipball/2b3694976f02ed6a7894d8a772c9d55cee5d9677", - "reference": "2b3694976f02ed6a7894d8a772c9d55cee5d9677", + "url": "https://api.github.com/repos/symfony/intl/zipball/519bcb27ea53835c1e8e7f7c8a799c867d570156", + "reference": "519bcb27ea53835c1e8e7f7c8a799c867d570156", "shasum": "" }, "require": { @@ -850,11 +850,11 @@ "l10n", "localization" ], - "time": "2020-01-04T14:08:26+00:00" + "time": "2020-01-31T09:13:47+00:00" }, { "name": "symfony/mime", - "version": "v5.0.3", + "version": "v5.0.4", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", @@ -916,16 +916,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", "shasum": "" }, "require": { @@ -937,7 +937,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -970,20 +970,20 @@ "polyfill", "portable" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-intl-icu", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-icu.git", - "reference": "b3dffd68afa61ca70f2327f2dd9bbeb6aa53d70b" + "reference": "727b3bb5bfa7ca9eeb86416784cf1c08a6289b86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/b3dffd68afa61ca70f2327f2dd9bbeb6aa53d70b", - "reference": "b3dffd68afa61ca70f2327f2dd9bbeb6aa53d70b", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/727b3bb5bfa7ca9eeb86416784cf1c08a6289b86", + "reference": "727b3bb5bfa7ca9eeb86416784cf1c08a6289b86", "shasum": "" }, "require": { @@ -996,7 +996,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1028,26 +1028,26 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "6f9c239e61e1b0c9229a28ff89a812dc449c3d46" + "reference": "6842f1a39cf7d580655688069a03dd7cd83d244a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6f9c239e61e1b0c9229a28ff89a812dc449c3d46", - "reference": "6f9c239e61e1b0c9229a28ff89a812dc449c3d46", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6842f1a39cf7d580655688069a03dd7cd83d244a", + "reference": "6842f1a39cf7d580655688069a03dd7cd83d244a", "shasum": "" }, "require": { "php": ">=5.3.3", "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php72": "^1.9" + "symfony/polyfill-php72": "^1.10" }, "suggest": { "ext-intl": "For best performance" @@ -1055,7 +1055,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1090,20 +1090,20 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-17T12:01:36+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", "shasum": "" }, "require": { @@ -1115,7 +1115,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1149,20 +1149,20 @@ "portable", "shim" ], - "time": "2019-11-27T14:18:11+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" + "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf", + "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf", "shasum": "" }, "require": { @@ -1171,7 +1171,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1204,20 +1204,20 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" + "reference": "5e66a0fa1070bf46bec4bea7962d285108edd675" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/5e66a0fa1070bf46bec4bea7962d285108edd675", + "reference": "5e66a0fa1070bf46bec4bea7962d285108edd675", "shasum": "" }, "require": { @@ -1226,7 +1226,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1262,11 +1262,11 @@ "portable", "shim" ], - "time": "2019-11-27T16:25:15+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/process", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -1373,7 +1373,7 @@ }, { "name": "symfony/yaml", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", diff --git a/vendor-bin/phpunit/composer.lock b/vendor-bin/phpunit/composer.lock index 5b65c64b..7dd90d31 100644 --- a/vendor-bin/phpunit/composer.lock +++ b/vendor-bin/phpunit/composer.lock @@ -462,41 +462,38 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c" + "reference": "a48807183a4b819072f26e347bbd0b5199a9d15f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c", - "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/a48807183a4b819072f26e347bbd0b5199a9d15f", + "reference": "a48807183a4b819072f26e347bbd0b5199a9d15f", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", - "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", - "webmozart/assert": "^1.0" + "ext-filter": "^7.1", + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1" }, "require-dev": { - "doctrine/instantiator": "^1.0.5", - "mockery/mockery": "^1.0", - "phpdocumentor/type-resolver": "0.4.*", - "phpunit/phpunit": "^6.4" + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "5.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -507,10 +504,14 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-12-28T18:55:12+00:00" + "time": "2020-02-09T09:16:15+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -1574,16 +1575,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", "shasum": "" }, "require": { @@ -1595,7 +1596,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1628,7 +1629,7 @@ "polyfill", "portable" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "theseer/tokenizer", @@ -1672,16 +1673,16 @@ }, { "name": "webmozart/assert", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" + "reference": "aed98a490f9a8f78468232db345ab9cf606cf598" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", + "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598", + "reference": "aed98a490f9a8f78468232db345ab9cf606cf598", "shasum": "" }, "require": { @@ -1716,7 +1717,7 @@ "check", "validate" ], - "time": "2019-11-24T13:36:37+00:00" + "time": "2020-02-14T12:15:55+00:00" }, { "name": "webmozart/glob", diff --git a/vendor-bin/robo/composer.lock b/vendor-bin/robo/composer.lock index d7637a99..84e95e1f 100644 --- a/vendor-bin/robo/composer.lock +++ b/vendor-bin/robo/composer.lock @@ -1095,16 +1095,16 @@ }, { "name": "symfony/console", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f" + "reference": "f512001679f37e6a042b51897ed24a2f05eba656" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", - "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", + "url": "https://api.github.com/repos/symfony/console/zipball/f512001679f37e6a042b51897ed24a2f05eba656", + "reference": "f512001679f37e6a042b51897ed24a2f05eba656", "shasum": "" }, "require": { @@ -1167,11 +1167,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2020-01-10T21:54:01+00:00" + "time": "2020-01-25T12:44:29+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1299,7 +1299,7 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -1349,7 +1349,7 @@ }, { "name": "symfony/finder", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -1398,16 +1398,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", "shasum": "" }, "require": { @@ -1419,7 +1419,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1452,20 +1452,20 @@ "polyfill", "portable" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", "shasum": "" }, "require": { @@ -1477,7 +1477,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1511,20 +1511,20 @@ "portable", "shim" ], - "time": "2019-11-27T14:18:11+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" + "reference": "5e66a0fa1070bf46bec4bea7962d285108edd675" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/5e66a0fa1070bf46bec4bea7962d285108edd675", + "reference": "5e66a0fa1070bf46bec4bea7962d285108edd675", "shasum": "" }, "require": { @@ -1533,7 +1533,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -1569,7 +1569,7 @@ "portable", "shim" ], - "time": "2019-11-27T16:25:15+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/process", @@ -1680,7 +1680,7 @@ }, { "name": "symfony/yaml", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git",