1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Merge branch 'master' into phake

This commit is contained in:
J. King 2024-12-15 22:38:22 -05:00
commit 1cd3f29fe3
89 changed files with 3397 additions and 1387 deletions

View file

@ -1,8 +1,16 @@
Version 0.??.? (????-??-??) Version 0.??.? (2024-??-??)
===========================
Bug fixes:
- Do not hang when language files are missing or corrupted
Version 0.10.5 (2024-01-10)
=========================== ===========================
Changes: Changes:
- Require PHP 7.3 - Require PHP 7.3
- Adapt the Arch package to make using alternative PHP interpreters easier
(see manual for details)
- Multiple editorial and stylistic changes to the UNIX manual page - Multiple editorial and stylistic changes to the UNIX manual page
Version 0.10.4 (2023-01-24) Version 0.10.4 (2023-01-24)

View file

@ -40,7 +40,7 @@ The `/dist/` directory, on the other hand, contains general and system-specific
The source text for The Arsse's manual can be found in `/docs/`, with pages written in [Markdown](https://spec.commonmark.org/current/) and converted to HTML [with Daux](#building-the-manual). If a static manual is generated its files will appear under `/manual/`. The source text for The Arsse's manual can be found in `/docs/`, with pages written in [Markdown](https://spec.commonmark.org/current/) and converted to HTML [with Daux](#building-the-manual). If a static manual is generated its files will appear under `/manual/`.
The Arsse also has a UNIX manual page, also written in Markdown, which can be found under `/manpages/`. [Pandoc](https://pandoc.org/) is needed to convert it to the appropriate format, with the results stored under `/dist/man/`. The Arsse also has a UNIX manual page written in [mdoc](https://man.archlinux.org/man/extra/mandoc/mandoc_mdoc.7.en) format, which can be found under `/dist/man/`.
In addition to the manuals the files `/README.md` (this file), `/CHANGELOG`, `/UPGRADING`, `/LICENSE`, and `/AUTHORS` also document various things about the software, rather than the software itself. In addition to the manuals the files `/README.md` (this file), `/CHANGELOG`, `/UPGRADING`, `/LICENSE`, and `/AUTHORS` also document various things about the software, rather than the software itself.

View file

@ -188,9 +188,9 @@ class RoboFile extends \Robo\Tasks {
* may not be equivalent due to subsequent changes in the exclude list, or because * may not be equivalent due to subsequent changes in the exclude list, or because
* of new tooling. * of new tooling.
*/ */
public function packageGeneric(string $commit = null): Result { public function packageGeneric(?string $commit = null): Result {
if (!$this->toolExists("git", "pandoc")) { if (!$this->toolExists("git")) {
throw new \Exception("Git and Pandoc are required in PATH to produce generic release tarballs"); throw new \Exception("Git is required in PATH to produce generic release tarballs");
} }
// establish which commit to package // establish which commit to package
[$commit, $version] = $this->commitVersion($commit); [$commit, $version] = $this->commitVersion($commit);
@ -308,7 +308,7 @@ class RoboFile extends \Robo\Tasks {
* or any commit hash. If none is provided on the command line, Robo will prompt * or any commit hash. If none is provided on the command line, Robo will prompt
* for a commit to package; the default is "HEAD". * for a commit to package; the default is "HEAD".
*/ */
public function packageDebsrc(string $commit = null): Result { public function packageDebsrc(?string $commit = null): Result {
// establish which commit to package // establish which commit to package
[$commit, $version] = $this->commitVersion($commit); [$commit, $version] = $this->commitVersion($commit);
$tarball = BASE."release/$version/arsse-$version.tar.gz"; $tarball = BASE."release/$version/arsse-$version.tar.gz";
@ -362,7 +362,7 @@ class RoboFile extends \Robo\Tasks {
* Build Service instances and with slight modification the Arch User Repository. * Build Service instances and with slight modification the Arch User Repository.
* Use for Launchpad PPAs has not been tested. * Use for Launchpad PPAs has not been tested.
*/ */
public function package(string $commit = null): Result { public function package(?string $commit = null): Result {
if (!$this->toolExists("git")) { if (!$this->toolExists("git")) {
throw new \Exception("Git is required in PATH to produce packages"); throw new \Exception("Git is required in PATH to produce packages");
} }
@ -517,7 +517,7 @@ class RoboFile extends \Robo\Tasks {
} elseif (in_array("item", $expected) && preg_match('/^- (\w.*)$/D', $l, $m)) { } elseif (in_array("item", $expected) && preg_match('/^- (\w.*)$/D', $l, $m)) {
$entry[$section][] = $m[1]; $entry[$section][] = $m[1];
$expected = ["item", "continuation", "blank line"]; $expected = ["item", "continuation", "blank line"];
} elseif (in_array("continuation", $expected) && preg_match('/^ (\w.*)$/D', $l, $m)) { } elseif (in_array("continuation", $expected) && preg_match('/^ (\S.*)$/D', $l, $m)) {
$last = sizeof($entry[$section]) - 1; $last = sizeof($entry[$section]) - 1;
$entry[$section][$last] .= "\n".$m[1]; $entry[$section][$last] .= "\n".$m[1];
} else { } else {

View file

@ -11,10 +11,13 @@ usually prudent:
`composer install -o --no-dev` `composer install -o --no-dev`
Upgrading from 0.10.4 to 0.10.? Upgrading from 0.10.4 to 0.10.5
============================= =============================
- PHP 7.3 is now required - PHP 7.3 is now required
- Web server configuration in the Arch Linux package has been modified to ease
the use of alternative PHP interpreters; please review the sample
configuration files for changes
Upgrading from 0.10.2 to 0.10.3 Upgrading from 0.10.2 to 0.10.3

View file

@ -24,11 +24,12 @@
"ext-hash": "*", "ext-hash": "*",
"ext-filter": "*", "ext-filter": "*",
"ext-dom": "*", "ext-dom": "*",
"nicolus/picofeed": "dev-patch-3", "nicolus/picofeed": "dev-php84",
"hosteurope/password-generator": "1.*", "hosteurope/password-generator": "1.*",
"docopt/docopt": "1.*", "docopt/docopt": "dev-master",
"jkingweb/druuid": "3.*", "jkingweb/druuid": "3.*",
"guzzlehttp/psr7": "2.*", "guzzlehttp/psr7": "2.*",
"laminas/laminas-xml": "dev-fixup as 1.4.0",
"laminas/laminas-httphandlerrunner": "2.*" "laminas/laminas-httphandlerrunner": "2.*"
}, },
"require-dev": { "require-dev": {
@ -66,6 +67,15 @@
{ {
"type": "vcs", "type": "vcs",
"url": "https://github.com/JKingweb/picoFeed-1/" "url": "https://github.com/JKingweb/picoFeed-1/"
},
{
"type": "vcs",
"url": "https://github.com/JKingweb/laminas-xml/"
},
{
"type": "vcs",
"url": "https://github.com/mensbeam/docopt.php/"
} }
] ]
} }

176
composer.lock generated
View file

@ -4,32 +4,32 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "8d22dd66c6cde0b1ed4ca0009293bf88", "content-hash": "149ece489c5ed860109686b09d2293e3",
"packages": [ "packages": [
{ {
"name": "docopt/docopt", "name": "docopt/docopt",
"version": "1.0.5", "version": "dev-master",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/docopt/docopt.php.git", "url": "https://github.com/mensbeam/docopt.php.git",
"reference": "0e3db660cf2f2eb07a83253790b7d97cdb398826" "reference": "91f3980e42442344d60d5b83e49baddc355e079f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/docopt/docopt.php/zipball/0e3db660cf2f2eb07a83253790b7d97cdb398826", "url": "https://api.github.com/repos/mensbeam/docopt.php/zipball/91f3980e42442344d60d5b83e49baddc355e079f",
"reference": "0e3db660cf2f2eb07a83253790b7d97cdb398826", "reference": "91f3980e42442344d60d5b83e49baddc355e079f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=5.3.0"
}, },
"default-branch": true,
"type": "library", "type": "library",
"autoload": { "autoload": {
"classmap": [ "classmap": [
"src/docopt.php" "src/docopt.php"
] ]
}, },
"notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"MIT" "MIT"
], ],
@ -48,29 +48,28 @@
"docs" "docs"
], ],
"support": { "support": {
"issues": "https://github.com/docopt/docopt.php/issues", "source": "https://github.com/mensbeam/docopt.php/tree/master"
"source": "https://github.com/docopt/docopt.php/tree/1.0.5"
}, },
"time": "2023-03-22T12:31:48+00:00" "time": "2024-12-12T02:51:22+00:00"
}, },
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
"version": "7.8.0", "version": "7.9.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/guzzle.git", "url": "https://github.com/guzzle/guzzle.git",
"reference": "1110f66a6530a40fe7aea0378fe608ee2b2248f9" "reference": "d281ed313b989f213357e3be1a179f02196ac99b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/1110f66a6530a40fe7aea0378fe608ee2b2248f9", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b",
"reference": "1110f66a6530a40fe7aea0378fe608ee2b2248f9", "reference": "d281ed313b989f213357e3be1a179f02196ac99b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-json": "*",
"guzzlehttp/promises": "^1.5.3 || ^2.0.1", "guzzlehttp/promises": "^1.5.3 || ^2.0.3",
"guzzlehttp/psr7": "^1.9.1 || ^2.5.1", "guzzlehttp/psr7": "^2.7.0",
"php": "^7.2.5 || ^8.0", "php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0", "psr/http-client": "^1.0",
"symfony/deprecation-contracts": "^2.2 || ^3.0" "symfony/deprecation-contracts": "^2.2 || ^3.0"
@ -79,11 +78,11 @@
"psr/http-client-implementation": "1.0" "psr/http-client-implementation": "1.0"
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.8.1", "bamarni/composer-bin-plugin": "^1.8.2",
"ext-curl": "*", "ext-curl": "*",
"php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", "guzzle/client-integration-tests": "3.0.2",
"php-http/message-factory": "^1.1", "php-http/message-factory": "^1.1",
"phpunit/phpunit": "^8.5.29 || ^9.5.23", "phpunit/phpunit": "^8.5.39 || ^9.6.20",
"psr/log": "^1.1 || ^2.0 || ^3.0" "psr/log": "^1.1 || ^2.0 || ^3.0"
}, },
"suggest": { "suggest": {
@ -161,7 +160,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/guzzle/issues", "issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.8.0" "source": "https://github.com/guzzle/guzzle/tree/7.9.2"
}, },
"funding": [ "funding": [
{ {
@ -177,28 +176,28 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-08-27T10:20:53+00:00" "time": "2024-07-24T11:22:20+00:00"
}, },
{ {
"name": "guzzlehttp/promises", "name": "guzzlehttp/promises",
"version": "2.0.1", "version": "2.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/promises.git", "url": "https://github.com/guzzle/promises.git",
"reference": "111166291a0f8130081195ac4556a5587d7f1b5d" "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/111166291a0f8130081195ac4556a5587d7f1b5d", "url": "https://api.github.com/repos/guzzle/promises/zipball/f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
"reference": "111166291a0f8130081195ac4556a5587d7f1b5d", "reference": "f9c436286ab2892c7db7be8c8da4ef61ccf7b455",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2.5 || ^8.0" "php": "^7.2.5 || ^8.0"
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.8.1", "bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.29 || ^9.5.23" "phpunit/phpunit": "^8.5.39 || ^9.6.20"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -244,7 +243,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/promises/issues", "issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/2.0.1" "source": "https://github.com/guzzle/promises/tree/2.0.4"
}, },
"funding": [ "funding": [
{ {
@ -260,20 +259,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-08-03T15:11:55+00:00" "time": "2024-10-17T10:06:22+00:00"
}, },
{ {
"name": "guzzlehttp/psr7", "name": "guzzlehttp/psr7",
"version": "2.6.1", "version": "2.7.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/psr7.git", "url": "https://github.com/guzzle/psr7.git",
"reference": "be45764272e8873c72dbe3d2edcfdfcc3bc9f727" "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/be45764272e8873c72dbe3d2edcfdfcc3bc9f727", "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
"reference": "be45764272e8873c72dbe3d2edcfdfcc3bc9f727", "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -287,9 +286,9 @@
"psr/http-message-implementation": "1.0" "psr/http-message-implementation": "1.0"
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.8.1", "bamarni/composer-bin-plugin": "^1.8.2",
"http-interop/http-factory-tests": "^0.9", "http-interop/http-factory-tests": "0.9.0",
"phpunit/phpunit": "^8.5.29 || ^9.5.23" "phpunit/phpunit": "^8.5.39 || ^9.6.20"
}, },
"suggest": { "suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
@ -360,7 +359,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/psr7/issues", "issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.6.1" "source": "https://github.com/guzzle/psr7/tree/2.7.0"
}, },
"funding": [ "funding": [
{ {
@ -376,7 +375,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-08-27T10:13:57+00:00" "time": "2024-07-18T11:15:46+00:00"
}, },
{ {
"name": "hosteurope/password-generator", "name": "hosteurope/password-generator",
@ -619,16 +618,16 @@
}, },
{ {
"name": "laminas/laminas-xml", "name": "laminas/laminas-xml",
"version": "1.4.0", "version": "dev-fixup",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laminas/laminas-xml.git", "url": "https://github.com/JKingweb/laminas-xml.git",
"reference": "dcadeefdb6d7ed6b39d772b47e3845003d6ea60f" "reference": "3a6903c9f7b61c96355532d90525d04c3a67ba7a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laminas/laminas-xml/zipball/dcadeefdb6d7ed6b39d772b47e3845003d6ea60f", "url": "https://api.github.com/repos/JKingweb/laminas-xml/zipball/3a6903c9f7b61c96355532d90525d04c3a67ba7a",
"reference": "dcadeefdb6d7ed6b39d772b47e3845003d6ea60f", "reference": "3a6903c9f7b61c96355532d90525d04c3a67ba7a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -651,7 +650,29 @@
"Laminas\\Xml\\": "src/" "Laminas\\Xml\\": "src/"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "autoload-dev": {
"psr-4": {
"LaminasTest\\Xml\\": "test/"
}
},
"scripts": {
"check": [
"@cs-check",
"@test"
],
"cs-check": [
"phpcs"
],
"cs-fix": [
"phpcbf"
],
"test": [
"phpunit --colors=always"
],
"test-coverage": [
"phpunit --colors=always --coverage-clover clover.xml"
]
},
"license": [ "license": [
"BSD-3-Clause" "BSD-3-Clause"
], ],
@ -663,32 +684,26 @@
"xml" "xml"
], ],
"support": { "support": {
"chat": "https://laminas.dev/chat",
"forum": "https://discourse.laminas.dev",
"issues": "https://github.com/laminas/laminas-xml/issues", "issues": "https://github.com/laminas/laminas-xml/issues",
"source": "https://github.com/laminas/laminas-xml",
"rss": "https://github.com/laminas/laminas-xml/releases.atom", "rss": "https://github.com/laminas/laminas-xml/releases.atom",
"source": "https://github.com/laminas/laminas-xml" "chat": "https://laminas.dev/chat",
"forum": "https://discourse.laminas.dev"
}, },
"funding": [ "time": "2024-12-16T02:41:12+00:00"
{
"url": "https://funding.communitybridge.org/projects/laminas-project",
"type": "community_bridge"
}
],
"time": "2021-11-30T02:16:35+00:00"
}, },
{ {
"name": "nicolus/picofeed", "name": "nicolus/picofeed",
"version": "dev-patch-3", "version": "dev-php84",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/JKingweb/picoFeed-1.git", "url": "https://github.com/JKingweb/picoFeed-1.git",
"reference": "536911c180651fea79d6e1894a826fff6ab87a52" "reference": "d25f100fb079a23ec05a3af291e5d97899ede3f2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/JKingweb/picoFeed-1/zipball/536911c180651fea79d6e1894a826fff6ab87a52", "url": "https://api.github.com/repos/JKingweb/picoFeed-1/zipball/d25f100fb079a23ec05a3af291e5d97899ede3f2",
"reference": "536911c180651fea79d6e1894a826fff6ab87a52", "reference": "d25f100fb079a23ec05a3af291e5d97899ede3f2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -737,9 +752,9 @@
"description": "RSS/Atom parsing library", "description": "RSS/Atom parsing library",
"homepage": "https://github.com/nicolus/picoFeed", "homepage": "https://github.com/nicolus/picoFeed",
"support": { "support": {
"source": "https://github.com/JKingweb/picoFeed-1/tree/patch-3" "source": "https://github.com/JKingweb/picoFeed-1/tree/php84"
}, },
"time": "2023-03-23T01:54:27+00:00" "time": "2024-12-15T22:23:39+00:00"
}, },
{ {
"name": "psr/http-client", "name": "psr/http-client",
@ -795,20 +810,20 @@
}, },
{ {
"name": "psr/http-factory", "name": "psr/http-factory",
"version": "1.0.2", "version": "1.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/http-factory.git", "url": "https://github.com/php-fig/http-factory.git",
"reference": "e616d01114759c4c489f93b099585439f795fe35" "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"reference": "e616d01114759c4c489f93b099585439f795fe35", "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.0.0", "php": ">=7.1",
"psr/http-message": "^1.0 || ^2.0" "psr/http-message": "^1.0 || ^2.0"
}, },
"type": "library", "type": "library",
@ -832,7 +847,7 @@
"homepage": "https://www.php-fig.org/" "homepage": "https://www.php-fig.org/"
} }
], ],
"description": "Common interfaces for PSR-7 HTTP message factories", "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
"keywords": [ "keywords": [
"factory", "factory",
"http", "http",
@ -844,9 +859,9 @@
"response" "response"
], ],
"support": { "support": {
"source": "https://github.com/php-fig/http-factory/tree/1.0.2" "source": "https://github.com/php-fig/http-factory"
}, },
"time": "2023-04-10T20:10:41+00:00" "time": "2024-04-15T12:06:14+00:00"
}, },
{ {
"name": "psr/http-message", "name": "psr/http-message",
@ -1053,16 +1068,16 @@
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
"version": "v2.5.2", "version": "v2.5.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git", "url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918",
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1100,7 +1115,7 @@
"description": "A generic function and convention to trigger deprecation notices", "description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.4"
}, },
"funding": [ "funding": [
{ {
@ -1116,7 +1131,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-01-02T09:53:40+00:00" "time": "2024-09-25T14:11:13+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@ -1178,9 +1193,18 @@
"time": "2022-10-31T08:38:03+00:00" "time": "2022-10-31T08:38:03+00:00"
} }
], ],
"aliases": [], "aliases": [
{
"package": "laminas/laminas-xml",
"version": "dev-fixup",
"alias": "1.4.0",
"alias_normalized": "1.4.0.0"
}
],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": { "stability-flags": {
"docopt/docopt": 20,
"laminas/laminas-xml": 20,
"nicolus/picofeed": 20 "nicolus/picofeed": 20
}, },
"prefer-stable": false, "prefer-stable": false,
@ -1193,7 +1217,7 @@
"ext-filter": "*", "ext-filter": "*",
"ext-dom": "*" "ext-dom": "*"
}, },
"platform-dev": [], "platform-dev": {},
"platform-overrides": { "platform-overrides": {
"php": "7.3.33" "php": "7.3.33"
}, },

5
dist/apache/arsse-fcgi.conf vendored Normal file
View file

@ -0,0 +1,5 @@
ProxyPreserveHost On
ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "/usr/share/arsse/arsse.php"
ProxyFCGISetEnvIf "-n req('Authorization')" HTTP_AUTHORIZATION "%{req:Authorization}"
ProxyPass "unix:/var/run/php/arsse.sock|fcgi://localhost/usr/share/arsse/"

View file

@ -1,34 +1,34 @@
# Nextcloud News protocol # Nextcloud News protocol
<Location "/index.php/apps/news/api"> <Location "/index.php/apps/news/api">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Tiny Tiny RSS protocol # Tiny Tiny RSS protocol
<Location "/tt-rss/api"> <Location "/tt-rss/api">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Tiny Tiny RSS feed icons # Tiny Tiny RSS feed icons
<Location "/tt-rss/feed-icons"> <Location "/tt-rss/feed-icons">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Fever protocol # Fever protocol
<Location "/fever"> <Location "/fever">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Miniflux protocol # Miniflux protocol
<Location "/v1"> <Location "/v1">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Miniflux version number # Miniflux version number
<Location "/version"> <Location "/version">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>
# Miniflux "health check" # Miniflux "health check"
<Location "/healthcheck"> <Location "/healthcheck">
ProxyPass ${ARSSE_PROXY} Include "/etc/arsse/apache/arsse-fcgi.conf"
</Location> </Location>

View file

@ -3,9 +3,4 @@ DocumentRoot "/usr/share/arsse/www"
Require all granted Require all granted
</Directory> </Directory>
Define ARSSE_PROXY "unix:/var/run/php/arsse.sock|fcgi://localhost/usr/share/arsse/"
ProxyPreserveHost On
ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "/usr/share/arsse/arsse.php"
ProxyFCGISetEnvIf "-n req('Authorization')" HTTP_AUTHORIZATION "%{req:Authorization}"
Include "/etc/arsse/apache/arsse-loc.conf" Include "/etc/arsse/apache/arsse-loc.conf"

25
dist/arch/PKGBUILD vendored
View file

@ -7,6 +7,7 @@ pkgdesc="Multi-protocol RSS/Atom newsfeed synchronization server"
arch=("any") arch=("any")
url="https://thearsse.com/" url="https://thearsse.com/"
license=("MIT") license=("MIT")
conflicts=("arsse-git")
depends=() depends=()
makedepends=() makedepends=()
checkdepends=() checkdepends=()
@ -14,44 +15,50 @@ optdepends=("nginx: HTTP server"
"apache>=2.4: HTTP server" "apache>=2.4: HTTP server"
"percona-server: Alternate database" "percona-server: Alternate database"
"postgresql>=10: Alternate database" "postgresql>=10: Alternate database"
"php-pgsql>=7.3: PostgreSQL database support") "php-pgsql-interpreter>=7.3: PostgreSQL database support")
backup=("etc/webapps/arsse/config.php" backup=("etc/webapps/arsse/config.php"
"etc/webapps/arsse/systemd-environment"
"etc/php/php-fpm.d/arsse.conf" "etc/php/php-fpm.d/arsse.conf"
"etc/php-legacy/php-fpm.d/arsse.conf"
"etc/webapps/arsse/nginx/example.conf" "etc/webapps/arsse/nginx/example.conf"
"etc/webapps/arsse/nginx/arsse.conf" "etc/webapps/arsse/nginx/arsse.conf"
"etc/webapps/arsse/nginx/arsse-loc.conf" "etc/webapps/arsse/nginx/arsse-loc.conf"
"etc/webapps/arsse/nginx/arsse-fcgi.conf" "etc/webapps/arsse/nginx/arsse-fcgi.conf"
"etc/webapps/arsse/apache/example.conf" "etc/webapps/arsse/apache/example.conf"
"etc/webapps/arsse/apache/arsse.conf" "etc/webapps/arsse/apache/arsse.conf"
"etc/webapps/arsse/apache/arsse-fcgi.conf"
"etc/webapps/arsse/apache/arsse-loc.conf") "etc/webapps/arsse/apache/arsse-loc.conf")
source=("arsse-0.10.4.tar.gz") source=("arsse-0.10.4.tar.gz")
md5sums=("SKIP") md5sums=("SKIP")
package() { package() {
# define runtime dependencies # define runtime dependencies
depends=("php>=7.3" "php-intl>=7.3" "php-sqlite>=7.3" "php-fpm>=7.3") depends=("php-interpreter>=7.3" "php-sqlite-interpreter>=7.3" "php-fpm-interpreter>=7.3")
# create most directories necessary for the final package # create most directories necessary for the final package
cd "$pkgdir" cd "$pkgdir"
mkdir -p "usr/share/webapps/arsse" "usr/share/doc/arsse" "usr/share/licenses/arsse" "usr/lib/systemd/system" "usr/lib/sysusers.d" "usr/lib/tmpfiles.d" "etc/php/php-fpm.d" "etc/webapps/arsse" mkdir -p "usr/share/webapps/arsse" "usr/share/doc/arsse" "usr/share/licenses/arsse" "usr/lib/systemd/system" "usr/lib/sysusers.d" "usr/lib/tmpfiles.d" "etc/php/php-fpm.d" "etc/php-legacy/php-fpm.d" "etc/webapps/arsse"
# copy requisite files # copy requisite files
cd "$srcdir/arsse" cd "$srcdir/arsse"
cp -r lib locale sql vendor www CHANGELOG UPGRADING README.md arsse.php "$pkgdir/usr/share/webapps/arsse" cp -r lib locale sql vendor www CHANGELOG UPGRADING README.md arsse.php "$pkgdir/usr/share/webapps/arsse"
cp -r manual/* "$pkgdir/usr/share/doc/arsse" cp -r manual/* "$pkgdir/usr/share/doc/arsse"
cp LICENSE AUTHORS "$pkgdir/usr/share/licenses/arsse" cp LICENSE AUTHORS "$pkgdir/usr/share/licenses/arsse"
cp dist/systemd/* "$pkgdir/usr/lib/systemd/system"
cp dist/sysuser.conf "$pkgdir/usr/lib/sysusers.d/arsse.conf" cp dist/sysuser.conf "$pkgdir/usr/lib/sysusers.d/arsse.conf"
cp dist/tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/arsse.conf" cp dist/tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/arsse.conf"
cp dist/php-fpm.conf "$pkgdir/etc/php/php-fpm.d/arsse.conf" cp dist/php-fpm.conf "$pkgdir/etc/php/php-fpm.d/arsse.conf"
cp -r dist/man "$pkgdir/usr/share" cp -r dist/man "$pkgdir/usr/share"
cp -r dist/nginx dist/apache config.defaults.php "$pkgdir/etc/webapps/arsse" cp -r dist/nginx dist/apache config.defaults.php "$pkgdir/etc/webapps/arsse"
cd "$pkgdir"
# copy files requiring special permissions # copy files requiring special permissions
cd "$srcdir/arsse"
install -Dm755 dist/arsse "$pkgdir/usr/bin/arsse"
install -Dm640 dist/config.php "$pkgdir/etc/webapps/arsse" install -Dm640 dist/config.php "$pkgdir/etc/webapps/arsse"
# patch generic configuration files to use Arch-specific paths and identifiers # patch generic configuration files to use Arch-specific paths and identifiers
sed -i -se 's/\/\(etc\|usr\/share\)\/arsse\//\/\1\/webapps\/arsse\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/usr/lib/tmpfiles.d/arsse.conf" "$pkgdir/usr/lib/systemd/system/"* "$pkgdir/usr/bin/"* sed -i -se 's/\/\(etc\|usr\/share\)\/arsse\//\/\1\/webapps\/arsse\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/usr/lib/tmpfiles.d/arsse.conf"
sed -i -se 's/\/var\/run\/php\//\/run\/php-fpm\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/etc/php/php-fpm.d/arsse.conf" sed -i -se 's/\/var\/run\/php\//\/run\/php-fpm\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/etc/php/php-fpm.d/arsse.conf"
sed -i -se 's/www-data/http/g' "$pkgdir/etc/php/php-fpm.d/arsse.conf" sed -i -se 's/www-data/http/g' "$pkgdir/etc/php/php-fpm.d/arsse.conf"
sed -i -e 's/^WorkingDirectory=.*$/WorkingDirectory=\/usr\/share\/webapps\/arsse/g' -e 's/^ConfigurationDirectory=.*$/ConfigurationDirectory=webapps\/arsse/g' "$pkgdir/usr/lib/systemd/system/arsse-fetch.service" # make a duplicate PHP-FPM pool for php-legacy
sed -se 's/php-fpm/php-fpm-legacy/' "$pkgdir/etc/php/php-fpm.d/arsse.conf" > "$pkgdir/etc/php-legacy/php-fpm.d/arsse.conf"
# copy Arch-specific versions of files
install -Dm755 dist/arch/arsse "$pkgdir/usr/bin/arsse"
cp dist/arch/nginx-arsse-fcgi.conf "$pkgdir/etc/webapps/arsse/nginx/arsse-fcgi.conf"
cp dist/arch/apache-arsse-fcgi.conf "$pkgdir/etc/webapps/arsse/apache/arsse-fcgi.conf"
cp dist/arch/*.service "$pkgdir/usr/lib/systemd/system"
cp dist/arch/systemd-environment "$pkgdir/etc/webapps/arsse/systemd-environment"
} }

View file

@ -9,22 +9,25 @@ url="https://thearsse.com/"
license=("MIT") license=("MIT")
provides=("arsse") provides=("arsse")
conflicts=("arsse") conflicts=("arsse")
depends=("php>=7.3" "php-intl>=7.3" "php-sqlite>=7.3") depends=("php-interpreter>=7.3" "php-intl-interpreter>=7.3" "php-sqlite-interpreter>=7.3")
makedepends=("composer" "pandoc") makedepends=("composer")
checkdepends=() checkdepends=()
optdepends=("nginx: HTTP server" optdepends=("nginx: HTTP server"
"apache>=2.4: HTTP server" "apache>=2.4: HTTP server"
"percona-server: Alternate database" "percona-server: Alternate database"
"postgresql>=10: Alternate database" "postgresql>=10: Alternate database"
"php-pgsql>=7.3: PostgreSQL database support") "php-pgsql-interpreter>=7.3: PostgreSQL database support")
backup=("etc/webapps/arsse/config.php" backup=("etc/webapps/arsse/config.php"
"etc/webapps/arsse/systemd-environment"
"etc/php/php-fpm.d/arsse.conf" "etc/php/php-fpm.d/arsse.conf"
"etc/php-legacy/php-fpm.d/arsse.conf"
"etc/webapps/arsse/nginx/example.conf" "etc/webapps/arsse/nginx/example.conf"
"etc/webapps/arsse/nginx/arsse.conf" "etc/webapps/arsse/nginx/arsse.conf"
"etc/webapps/arsse/nginx/arsse-loc.conf" "etc/webapps/arsse/nginx/arsse-loc.conf"
"etc/webapps/arsse/nginx/arsse-fcgi.conf" "etc/webapps/arsse/nginx/arsse-fcgi.conf"
"etc/webapps/arsse/apache/example.conf" "etc/webapps/arsse/apache/example.conf"
"etc/webapps/arsse/apache/arsse.conf" "etc/webapps/arsse/apache/arsse.conf"
"etc/webapps/arsse/apache/arsse-fcgi.conf"
"etc/webapps/arsse/apache/arsse-loc.conf") "etc/webapps/arsse/apache/arsse-loc.conf")
source=("git+https://code.mensbeam.com/MensBeam/arsse/") source=("git+https://code.mensbeam.com/MensBeam/arsse/")
md5sums=("SKIP") md5sums=("SKIP")
@ -37,7 +40,6 @@ pkgver() {
build() { build() {
cd "$srcdir/arsse" cd "$srcdir/arsse"
composer install composer install
./robo manpage
./robo manual ./robo manual
composer install --no-dev -o --no-scripts composer install --no-dev -o --no-scripts
php arsse.php conf save-defaults config.defaults.php php arsse.php conf save-defaults config.defaults.php
@ -46,29 +48,32 @@ build() {
package() { package() {
# define runtime dependencies # define runtime dependencies
depends=("php>=7.3" "php-intl>=7.3" "php-sqlite>=7.3" "php-fpm>=7.3") depends=("php-interpreter>=7.3" "php-sqlite-interpreter>=7.3" "php-fpm-interpreter>=7.3")
# create most directories necessary for the final package # create most directories necessary for the final package
cd "$pkgdir" cd "$pkgdir"
mkdir -p "usr/share/webapps/arsse" "usr/share/doc/arsse" "usr/share/licenses/arsse" "usr/lib/systemd/system" "usr/lib/sysusers.d" "usr/lib/tmpfiles.d" "etc/php/php-fpm.d" "etc/webapps/arsse" mkdir -p "usr/share/webapps/arsse" "usr/share/doc/arsse" "usr/share/licenses/arsse" "usr/lib/systemd/system" "usr/lib/sysusers.d" "usr/lib/tmpfiles.d" "etc/php/php-fpm.d" "etc/php-legacy/php-fpm.d" "etc/webapps/arsse"
# copy requisite files # copy requisite files
cd "$srcdir/arsse" cd "$srcdir/arsse"
cp -r lib locale sql vendor www CHANGELOG UPGRADING README.md arsse.php "$pkgdir/usr/share/webapps/arsse" cp -r lib locale sql vendor www CHANGELOG UPGRADING README.md arsse.php "$pkgdir/usr/share/webapps/arsse"
cp -r manual/* "$pkgdir/usr/share/doc/arsse" cp -r manual/* "$pkgdir/usr/share/doc/arsse"
cp LICENSE AUTHORS "$pkgdir/usr/share/licenses/arsse" cp LICENSE AUTHORS "$pkgdir/usr/share/licenses/arsse"
cp dist/systemd/* "$pkgdir/usr/lib/systemd/system"
cp dist/sysuser.conf "$pkgdir/usr/lib/sysusers.d/arsse.conf" cp dist/sysuser.conf "$pkgdir/usr/lib/sysusers.d/arsse.conf"
cp dist/tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/arsse.conf" cp dist/tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/arsse.conf"
cp dist/php-fpm.conf "$pkgdir/etc/php/php-fpm.d/arsse.conf" cp dist/php-fpm.conf "$pkgdir/etc/php/php-fpm.d/arsse.conf"
cp -r dist/man "$pkgdir/usr/share" cp -r dist/man "$pkgdir/usr/share"
cp -r dist/nginx dist/apache config.defaults.php "$pkgdir/etc/webapps/arsse" cp -r dist/nginx dist/apache config.defaults.php "$pkgdir/etc/webapps/arsse"
cd "$pkgdir"
# copy files requiring special permissions # copy files requiring special permissions
cd "$srcdir/arsse"
install -Dm755 dist/arsse "$pkgdir/usr/bin/arsse"
install -Dm640 dist/config.php "$pkgdir/etc/webapps/arsse" install -Dm640 dist/config.php "$pkgdir/etc/webapps/arsse"
# patch generic configuration files to use Arch-specific paths and identifiers # patch generic configuration files to use Arch-specific paths and identifiers
sed -i -se 's/\/\(etc\|usr\/share\)\/arsse\//\/\1\/webapps\/arsse\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/usr/lib/tmpfiles.d/arsse.conf" "$pkgdir/usr/lib/systemd/system/"* "$pkgdir/usr/bin/"* sed -i -se 's/\/\(etc\|usr\/share\)\/arsse\//\/\1\/webapps\/arsse\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/usr/lib/tmpfiles.d/arsse.conf"
sed -i -se 's/\/var\/run\/php\//\/run\/php-fpm\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/etc/php/php-fpm.d/arsse.conf" sed -i -se 's/\/var\/run\/php\//\/run\/php-fpm\//g' "$pkgdir/etc/webapps/arsse/nginx/"* "$pkgdir/etc/webapps/arsse/apache/"* "$pkgdir/etc/php/php-fpm.d/arsse.conf"
sed -i -se 's/www-data/http/g' "$pkgdir/etc/php/php-fpm.d/arsse.conf" sed -i -se 's/www-data/http/g' "$pkgdir/etc/php/php-fpm.d/arsse.conf"
sed -i -e 's/^WorkingDirectory=.*$/WorkingDirectory=\/usr\/share\/webapps\/arsse/g' -e 's/^ConfigurationDirectory=.*$/ConfigurationDirectory=webapps\/arsse/g' "$pkgdir/usr/lib/systemd/system/arsse-fetch.service" # make a duplicate PHP-FPM pool for php-legacy
sed -se 's/php-fpm/php-fpm-legacy/' "$pkgdir/etc/php/php-fpm.d/arsse.conf" > "$pkgdir/etc/php-legacy/php-fpm.d/arsse.conf"
# copy Arch-specific versions of files
install -Dm755 dist/arch/arsse "$pkgdir/usr/bin/arsse"
cp dist/arch/nginx-arsse-fcgi.conf "$pkgdir/etc/webapps/arsse/nginx/arsse-fcgi.conf"
cp dist/arch/apache-arsse-fcgi.conf "$pkgdir/etc/webapps/arsse/apache/arsse-fcgi.conf"
cp dist/arch/*.service "$pkgdir/usr/lib/systemd/system"
cp dist/arch/systemd-environment "$pkgdir/etc/webapps/arsse/systemd-environment"
} }

6
dist/arch/apache-arsse-fcgi.conf vendored Normal file
View file

@ -0,0 +1,6 @@
ProxyPreserveHost On
ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "/usr/share/webapps/arsse/arsse.php"
ProxyFCGISetEnvIf "-n req('Authorization')" HTTP_AUTHORIZATION "%{req:Authorization}"
# Modify the below line to begin with "unix:/run/php-fpm-legacy/" if using the php-legacy package
ProxyPass "unix:/run/php-fpm/arsse.sock|fcgi://localhost/usr/share/webapps/arsse/"

28
dist/arch/arsse vendored Normal file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
readonly default_php="/usr/bin/php"
php=""
check_sudo() {
if ! command -v sudo > /dev/null; then
printf "The sudo command is not available.\n"
exit 1
fi
}
# allow overriding the php executable
if [ -n "${ARSSE_PHP}" ] && command -v "${ARSSE_PHP}" > /dev/null; then
php="${ARSSE_PHP}"
else
php="${default_php}"
fi
if [ "$(whoami)" = "arsse" ]; then
"$php" /usr/share/webapps/arsse/arsse "$@"
elif [ "${UID}" -eq 0 ]; then
runuser -u "arsse" -- "$php" /usr/share/webapps/arsse/arsse "$@"
else
check_sudo
sudo -u "arsse" "$php" /usr/share/webapps/arsse/arsse "$@"
fi

37
dist/arch/arsse-fetch.service vendored Normal file
View file

@ -0,0 +1,37 @@
[Unit]
Description=The Arsse newsfeed fetching service
Documentation=https://thearsse.com/manual/
PartOf=arsse.service
[Install]
WantedBy=multi-user.target
[Service]
User=arsse
Group=arsse
Type=simple
WorkingDirectory=/usr/share/webapps/arsse
EnvironmentFile=/etc/webapps/arsse/systemd-environment
ExecStart=/usr/bin/arsse daemon
ProtectProc=invisible
NoNewPrivileges=true
ProtectSystem=full
ProtectHome=true
StateDirectory=arsse
ConfigurationDirectory=arsse
PrivateTmp=true
PrivateDevices=true
RestrictSUIDSGID=true
StandardOutput=journal
StandardError=journal
SyslogIdentifier=arsse
Restart=on-failure
RestartPreventStatus=
# These directives can be used for extra security, but are disabled for now for compatibility
#ReadOnlyPaths=/
#ReadWriePaths=/var/lib/arsse
#NoExecPaths=/
#ExecPaths=/usr/bin/php

13
dist/arch/arsse.service vendored Normal file
View file

@ -0,0 +1,13 @@
[Unit]
Description=The Arsse newsfeed management service
Documentation=https://thearsse.com/manual/
Requires=arsse-fetch.service
Wants=php-fpm.service php-legacy-fpm.service
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/bin/true

16
dist/arch/nginx-arsse-fcgi.conf vendored Normal file
View file

@ -0,0 +1,16 @@
fastcgi_pass_header Authorization; # required if the Arsse is to perform its own HTTP authentication
fastcgi_pass_request_body on;
fastcgi_pass_request_headers on;
fastcgi_intercept_errors off;
fastcgi_buffering off;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REQUEST_URI $uri;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param SCRIPT_FILENAME /usr/share/webapps/arsse/arsse.php;
# Modify the below line to begin with "/run/php-fpm-legacy/" if using the php-legacy package
fastcgi_pass unix:/run/php-fpm/arsse.sock;

1
dist/arch/systemd-environment vendored Normal file
View file

@ -0,0 +1 @@
ARSSE_PHP=/usr/bin/php

View file

@ -10,3 +10,6 @@ fastcgi_param REQUEST_URI $uri;
fastcgi_param QUERY_STRING $query_string; fastcgi_param QUERY_STRING $query_string;
fastcgi_param HTTPS $https if_not_empty; fastcgi_param HTTPS $https if_not_empty;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;
fastcgi_pass unix:/var/run/php/arsse.sock;
fastcgi_param SCRIPT_FILENAME /usr/share/arsse/arsse.php;

View file

@ -2,15 +2,11 @@ root /usr/share/arsse/www;
location @arsse { location @arsse {
# HTTP authentication may be enabled for this location, though this may impact some features # HTTP authentication may be enabled for this location, though this may impact some features
fastcgi_pass unix:/var/run/php/arsse.sock;
fastcgi_param SCRIPT_FILENAME /usr/share/arsse/arsse.php;
include /etc/arsse/nginx/arsse-fcgi.conf; include /etc/arsse/nginx/arsse-fcgi.conf;
} }
location @arsse_public { location @arsse_public {
# HTTP authentication should not be enabled for this location # HTTP authentication should not be enabled for this location
fastcgi_pass unix:/var/run/php/arsse.sock;
fastcgi_param SCRIPT_FILENAME /usr/share/arsse/arsse.php;
include /etc/arsse/nginx/arsse-fcgi.conf; include /etc/arsse/nginx/arsse-fcgi.conf;
} }

1
dist/tmpfiles.conf vendored
View file

@ -2,3 +2,4 @@ z /usr/bin/arsse 0755 root arsse - -
z /etc/arsse/config.php 0640 root arsse - - z /etc/arsse/config.php 0640 root arsse - -
L /usr/share/arsse/config.php - root arsse - /etc/arsse/config.php L /usr/share/arsse/config.php - root arsse - /etc/arsse/config.php
d /var/lib/arsse 0750 arsse arsse - - d /var/lib/arsse 0750 arsse arsse - -
L /usr/share/arsse/arsse - root arsse - /usr/share/arsse/arsse.php

View file

@ -35,6 +35,23 @@ LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
No additional set-up is required for Nginx. No additional set-up is required for Nginx.
# Using an alternative PHP interpreter
The above instructions assume you will be using the `php` package as your PHP interpreter. If you wish to use `php-legacy` (which is always one feature version behind, for compatibility) a few configuration tweaks are required. The follwoing commands are a short summary:
```sh
# Enable the necessary PHP extensions; curl is optional but recommended; pdo_sqlite may be used instead of sqlite3, but this is not recommended
sudo sed -i -e 's/^;\(extension=\(curl\|iconv\|intl\|sqlite3\)\)$/\1/' /etc/php-legacy/php.ini
# Modify the system service's environment
sudo sed -i -e 's/^ARSSE_PHP=.*/ARSSE_PHP=\/usr\/bin\/php-legacy/' /etc/webapps/arsse/systemd-environment
# Modify the PAM environment for the administrative CLI
echo "export ARSSE_PHP=/usr/bin/php-legacy" | sudo tee -a /etc/profile.d/arsse >/dev/null
# Modify the Nginx and Apache HTTPD configurations
sudo sed -i -se 's/\/run\/php-fpm\//\/run\/php-fpm-legacy\//' /etc/webapps/arsse/apache/arsse-fcgi.conf /etc/webapps/arsse/nginx/arsse-fcgi.conf
```
The above procedure can also be applied to use another PHP version from AUR if so desired.
# Next steps # Next steps
If using a database other than SQLite, you will likely want to [set it up](/en/Getting_Started/Database_Setup) before doing anything else. If using a database other than SQLite, you will likely want to [set it up](/en/Getting_Started/Database_Setup) before doing anything else.

View file

@ -363,7 +363,7 @@ The default value is equal to two megabytes.
|---------|---------| |---------|---------|
| boolean | `true` | | boolean | `true` |
Whether to allow the possibility of fetching full article contents from an article's source, if a newsfeed only provides excerpts. Whether fetching will actually happen is governed by a per-newsfeed toggle (defaulting to `false`) which currently can only be changed by manually editing the database. Whether to allow the possibility of fetching full article contents from an article's source, if a newsfeed only provides excerpts. Whether fetching will actually happen is governed by a per-newsfeed toggle (defaulting to `false`) which currently can only be changed via the Miniflux protocol.
### fetchUserAgentString ### fetchUserAgentString

View file

@ -121,7 +121,7 @@ abstract class AbstractException extends \Exception {
protected $symbol; protected $symbol;
protected $params; protected $params;
public function __construct(string $msgID = "", $vars = null, \Throwable $e = null) { public function __construct(string $msgID = "", $vars = null, ?\Throwable $e = null) {
$this->symbol = $msgID; $this->symbol = $msgID;
$this->params = $vars ?? []; $this->params = $vars ?? [];
if ($msgID === "") { if ($msgID === "") {

View file

@ -8,7 +8,7 @@ declare(strict_types=1);
namespace JKingWeb\Arsse; namespace JKingWeb\Arsse;
class Arsse { class Arsse {
public const VERSION = "0.10.4"; public const VERSION = "0.10.5";
public const REQUIRED_EXTENSIONS = [ public const REQUIRED_EXTENSIONS = [
"intl", // as this extension is required to prepare formatted messages, its absence will throw a distinct English-only exception "intl", // as this extension is required to prepare formatted messages, its absence will throw a distinct English-only exception
"dom", "dom",

View file

@ -72,7 +72,7 @@ USAGE_TEXT;
return ($file === "-" ? null : $file) ?? $stdinOrStdout; return ($file === "-" ? null : $file) ?? $stdinOrStdout;
} }
public function dispatch(array $argv = null): int { public function dispatch(?array $argv = null): int {
$argv = $argv ?? $_SERVER['argv']; $argv = $argv ?? $_SERVER['argv'];
$argv0 = array_shift($argv); $argv0 = array_shift($argv);
$args = \Docopt::handle($this->usage($argv0), [ $args = \Docopt::handle($this->usage($argv0), [
@ -198,7 +198,7 @@ USAGE_TEXT;
return 0; return 0;
} }
protected function userAddOrSetPassword(string $method, string $user, string $password = null, string $oldpass = null): int { protected function userAddOrSetPassword(string $method, string $user, ?string $password = null, ?string $oldpass = null): int {
$passwd = Arsse::$user->$method(...array_slice(func_get_args(), 1)); $passwd = Arsse::$user->$method(...array_slice(func_get_args(), 1));
if (is_null($password)) { if (is_null($password)) {
echo $passwd.\PHP_EOL; echo $passwd.\PHP_EOL;

View file

@ -14,23 +14,23 @@ trait BooleanMembers {
public $labelled = null; public $labelled = null;
public $annotated = null; public $annotated = null;
public function unread(bool $spec = null) { public function unread(?bool $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function starred(bool $spec = null) { public function starred(?bool $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function hidden(bool $spec = null) { public function hidden(?bool $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function labelled(bool $spec = null) { public function labelled(?bool $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function annotated(bool $spec = null) { public function annotated(?bool $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
} }

View file

@ -10,7 +10,7 @@ namespace JKingWeb\Arsse\Context;
class ExclusionContext extends AbstractContext { class ExclusionContext extends AbstractContext {
use ExclusionMembers; use ExclusionMembers;
public function __construct(Context $parent = null) { public function __construct(?Context $parent = null) {
$this->parent = $parent; $this->parent = $parent;
} }

View file

@ -83,127 +83,127 @@ trait ExclusionMembers {
return array_values(array_unique($spec, \SORT_REGULAR)); return array_values(array_unique($spec, \SORT_REGULAR));
} }
public function folder(int $spec = null) { public function folder(?int $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function folders(array $spec = null) { public function folders(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanIdArray($spec, true); $spec = $this->cleanIdArray($spec, true);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function folderShallow(int $spec = null) { public function folderShallow(?int $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function foldersShallow(array $spec = null) { public function foldersShallow(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanIdArray($spec, true); $spec = $this->cleanIdArray($spec, true);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function tag(int $spec = null) { public function tag(?int $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function tags(array $spec = null) { public function tags(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanIdArray($spec); $spec = $this->cleanIdArray($spec);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function tagName(string $spec = null) { public function tagName(?string $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function tagNames(array $spec = null) { public function tagNames(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanStringArray($spec); $spec = $this->cleanStringArray($spec);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function subscription(int $spec = null) { public function subscription(?int $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function subscriptions(array $spec = null) { public function subscriptions(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanIdArray($spec); $spec = $this->cleanIdArray($spec);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function edition(int $spec = null) { public function edition(?int $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function article(int $spec = null) { public function article(?int $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function editions(array $spec = null) { public function editions(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanIdArray($spec); $spec = $this->cleanIdArray($spec);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function articles(array $spec = null) { public function articles(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanIdArray($spec); $spec = $this->cleanIdArray($spec);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function label(int $spec = null) { public function label(?int $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function labels(array $spec = null) { public function labels(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanIdArray($spec); $spec = $this->cleanIdArray($spec);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function labelName(string $spec = null) { public function labelName(?string $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function labelNames(array $spec = null) { public function labelNames(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanStringArray($spec); $spec = $this->cleanStringArray($spec);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function annotationTerms(array $spec = null) { public function annotationTerms(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanStringArray($spec); $spec = $this->cleanStringArray($spec);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function searchTerms(array $spec = null) { public function searchTerms(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanStringArray($spec); $spec = $this->cleanStringArray($spec);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function titleTerms(array $spec = null) { public function titleTerms(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanStringArray($spec); $spec = $this->cleanStringArray($spec);
} }
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function authorTerms(array $spec = null) { public function authorTerms(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanStringArray($spec); $spec = $this->cleanStringArray($spec);
} }
@ -237,7 +237,7 @@ trait ExclusionMembers {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function modifiedRanges(array $spec = null) { public function modifiedRanges(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanDateRangeArray($spec); $spec = $this->cleanDateRangeArray($spec);
} }
@ -253,7 +253,7 @@ trait ExclusionMembers {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function markedRanges(array $spec = null) { public function markedRanges(?array $spec = null) {
if (isset($spec)) { if (isset($spec)) {
$spec = $this->cleanDateRangeArray($spec); $spec = $this->cleanDateRangeArray($spec);
} }

View file

@ -11,11 +11,11 @@ abstract class RootContext extends AbstractContext {
public $limit = 0; public $limit = 0;
public $offset = 0; public $offset = 0;
public function limit(int $spec = null) { public function limit(?int $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
public function offset(int $spec = null) { public function offset(?int $spec = null) {
return $this->act(__FUNCTION__, func_num_args(), $spec); return $this->act(__FUNCTION__, func_num_args(), $spec);
} }
} }

View file

@ -86,11 +86,16 @@ class Database {
/** Returns the bare name of the calling context's calling method, when __FUNCTION__ is not appropriate */ /** Returns the bare name of the calling context's calling method, when __FUNCTION__ is not appropriate */
protected function caller(): string { protected function caller(): string {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4); $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10);
if ($trace[2]['function'] === "articleQuery") { $out = "";
return $trace[3]['function']; foreach ($trace as $step) {
if (($step['class'] ?? "") === __CLASS__) {
$out = $step['function'];
} else {
break;
} }
return $trace[2]['function']; }
return $out;
} }
/** Returns the current (actual) schema version of the database; compared against self::SCHEMA_VERSION to know when an upgrade is required */ /** Returns the current (actual) schema version of the database; compared against self::SCHEMA_VERSION to know when an upgrade is required */
@ -408,7 +413,7 @@ class Database {
* @param string $user The user who owns the session to be destroyed * @param string $user The user who owns the session to be destroyed
* @param string|null $id The identifier of the session to destroy * @param string|null $id The identifier of the session to destroy
*/ */
public function sessionDestroy(string $user, string $id = null): bool { public function sessionDestroy(string $user, ?string $id = null): bool {
if (is_null($id)) { if (is_null($id)) {
// delete all sessions and report success unconditionally if no identifier was specified // delete all sessions and report success unconditionally if no identifier was specified
$this->db->prepare("DELETE FROM arsse_sessions where \"user\" = ?", "str")->run($user); $this->db->prepare("DELETE FROM arsse_sessions where \"user\" = ?", "str")->run($user);
@ -462,7 +467,7 @@ class Database {
* @param \DateTimeInterface|null $expires An optional expiry date and time for the token * @param \DateTimeInterface|null $expires An optional expiry date and time for the token
* @param string $data Application-specific data associated with a token * @param string $data Application-specific data associated with a token
*/ */
public function tokenCreate(string $user, string $class, string $id = null, ?\DateTimeInterface $expires = null, string $data = null): string { public function tokenCreate(string $user, string $class, ?string $id = null, ?\DateTimeInterface $expires = null, ?string $data = null): string {
if (!$this->userExists($user)) { if (!$this->userExists($user)) {
throw new User\ExceptionConflict("doesNotExist", ["action" => __FUNCTION__, "user" => $user]); throw new User\ExceptionConflict("doesNotExist", ["action" => __FUNCTION__, "user" => $user]);
} }
@ -676,7 +681,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 */ /** 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): ?int { protected function folderValidateMove(string $user, $id = null, $parent = null, ?string $name = null): ?int {
$errData = ["action" => $this->caller(), "field" => "parent", 'id' => $parent]; $errData = ["action" => $this->caller(), "field" => "parent", 'id' => $parent];
if (!$id) { if (!$id) {
// the root cannot be moved // the root cannot be moved
@ -811,7 +816,7 @@ class Database {
* @param boolean $recursive Whether to list subscriptions of descendent folders as well as the selected folder * @param boolean $recursive Whether to list subscriptions of descendent folders as well as the selected folder
* @param integer|null $id The numeric identifier of a particular subscription; used internally by subscriptionPropertiesGet * @param integer|null $id The numeric identifier of a particular subscription; used internally by subscriptionPropertiesGet
*/ */
public function subscriptionList(string $user, $folder = null, bool $recursive = true, int $id = null): Db\Result { public function subscriptionList(string $user, $folder = null, bool $recursive = true, ?int $id = null): Db\Result {
// validate inputs // validate inputs
$folder = $this->folderValidateId($user, $folder)['id']; $folder = $this->folderValidateId($user, $folder)['id'];
// create a complex query // create a complex query
@ -1051,7 +1056,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 */ /** 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): ?\DateTimeImmutable { public function subscriptionRefreshed(string $user, ?int $id = null): ?\DateTimeImmutable {
$q = new Query("SELECT max(arsse_feeds.updated) from arsse_feeds join arsse_subscriptions on arsse_subscriptions.feed = arsse_feeds.id"); $q = new Query("SELECT max(arsse_feeds.updated) from arsse_feeds join arsse_subscriptions on arsse_subscriptions.feed = arsse_feeds.id");
$q->setWhere("arsse_subscriptions.owner = ?", "str", $user); $q->setWhere("arsse_subscriptions.owner = ?", "str", $user);
if ($id) { if ($id) {
@ -1641,7 +1646,7 @@ class Database {
return $q; return $q;
} }
protected function articleFilter(Context $context, QueryFilter $q = null) { protected function articleFilter(Context $context, ?QueryFilter $q = null) {
$q = $q ?? new QueryFilter; $q = $q ?? new QueryFilter;
$colDefs = $this->articleColumns(); $colDefs = $this->articleColumns();
// handle the simple context options // handle the simple context options
@ -1820,7 +1825,7 @@ class Database {
* @param array $fieldss The columns to return in the result set, any of: id, edition, url, title, author, content, guid, fingerprint, folder, subscription, feed, starred, unread, note, published_date, edited_date, modified_date, marked_date, subscription_title, media_url, media_type * @param array $fieldss The columns to return in the result set, any of: id, edition, url, title, author, content, guid, fingerprint, folder, subscription, feed, starred, unread, note, published_date, edited_date, modified_date, marked_date, subscription_title, media_url, media_type
* @param array $sort The columns to sort the result by eg. "edition desc" in decreasing order of importance * @param array $sort The columns to sort the result by eg. "edition desc" in decreasing order of importance
*/ */
public function articleList(string $user, RootContext $context = null, array $fields = ["id"], array $sort = []): Db\Result { public function articleList(string $user, ?RootContext $context = null, array $fields = ["id"], array $sort = []): Db\Result {
// make a base query based on context and output columns // make a base query based on context and output columns
$context = $context ?? new Context; $context = $context ?? new Context;
$q = $this->articleQuery($user, $context, $fields); $q = $this->articleQuery($user, $context, $fields);
@ -1864,7 +1869,7 @@ class Database {
* @param string $user The user whose articles are to be counted * @param string $user The user whose articles are to be counted
* @param RootContext $context The search context * @param RootContext $context The search context
*/ */
public function articleCount(string $user, RootContext $context = null): int { public function articleCount(string $user, ?RootContext $context = null): int {
$context = $context ?? new Context; $context = $context ?? new Context;
$q = $this->articleQuery($user, $context, []); $q = $this->articleQuery($user, $context, []);
return (int) $this->db->prepare($q->getQuery(), $q->getTypes())->run($q->getValues())->getValue(); return (int) $this->db->prepare($q->getQuery(), $q->getTypes())->run($q->getValues())->getValue();
@ -1884,7 +1889,7 @@ class Database {
* @param RootContext $context The query context to match articles against * @param RootContext $context The query context to match articles against
* @param bool $updateTimestamp Whether to also update the timestamp. This should only be false if a mark is changed as a result of an automated action not taken by the user * @param bool $updateTimestamp Whether to also update the timestamp. This should only be false if a mark is changed as a result of an automated action not taken by the user
*/ */
public function articleMark(string $user, array $data, RootContext $context = null, bool $updateTimestamp = true): int { public function articleMark(string $user, array $data, ?RootContext $context = null, bool $updateTimestamp = true): int {
$data = [ $data = [
'read' => $data['read'] ?? null, 'read' => $data['read'] ?? null,
'starred' => $data['starred'] ?? null, 'starred' => $data['starred'] ?? null,
@ -2167,7 +2172,7 @@ class Database {
} }
/** Returns the numeric identifier of the most recent edition of an article matching the given context */ /** Returns the numeric identifier of the most recent edition of an article matching the given context */
public function editionLatest(string $user, RootContext $context = null): int { public function editionLatest(string $user, ?RootContext $context = null): int {
$context = $context ?? new Context; $context = $context ?? new Context;
$q = $this->articleQuery($user, $context, ["latest_edition"]); $q = $this->articleQuery($user, $context, ["latest_edition"]);
return (int) $this->db->prepare((string) $q, $q->getTypes())->run($q->getValues())->getValue(); return (int) $this->db->prepare((string) $q, $q->getTypes())->run($q->getValues())->getValue();

View file

@ -20,7 +20,7 @@ abstract class AbstractDriver implements Driver {
abstract protected function unlock(bool $rollback = false): bool; abstract protected function unlock(bool $rollback = false): bool;
abstract protected static function buildEngineException($code, string $msg): array; abstract protected static function buildEngineException($code, string $msg): array;
public function schemaUpdate(int $to, string $basePath = null): bool { public function schemaUpdate(int $to, ?string $basePath = null): bool {
$ver = $this->schemaVersion(); $ver = $this->schemaVersion();
if (!Arsse::$conf->dbAutoUpdate) { if (!Arsse::$conf->dbAutoUpdate) {
throw new Exception("updateManual", ['version' => $ver, 'driver_name' => $this->driverName()]); throw new Exception("updateManual", ['version' => $ver, 'driver_name' => $this->driverName()]);
@ -91,7 +91,7 @@ abstract class AbstractDriver implements Driver {
return $this->transDepth; return $this->transDepth;
} }
public function savepointRelease(int $index = null): bool { public function savepointRelease(?int $index = null): bool {
// assume the most recent savepoint if none was specified // assume the most recent savepoint if none was specified
$index = $index ?? $this->transDepth; $index = $index ?? $this->transDepth;
if (array_key_exists($index, $this->transStatus)) { if (array_key_exists($index, $this->transStatus)) {
@ -150,7 +150,7 @@ abstract class AbstractDriver implements Driver {
} }
} }
public function savepointUndo(int $index = null): bool { public function savepointUndo(?int $index = null): bool {
$index = $index ?? $this->transDepth; $index = $index ?? $this->transDepth;
if (array_key_exists($index, $this->transStatus)) { if (array_key_exists($index, $this->transStatus)) {
switch ($this->transStatus[$index]) { switch ($this->transStatus[$index]) {

View file

@ -39,10 +39,10 @@ interface Driver {
public function savepointCreate(): int; public function savepointCreate(): int;
/** Manually commits either the latest or a specified nested transaction */ /** Manually commits either the latest or a specified nested transaction */
public function savepointRelease(int $index = null): bool; public function savepointRelease(?int $index = null): bool;
/** Manually rolls back either the latest or a specified nested transaction */ /** Manually rolls back either the latest or a specified nested transaction */
public function savepointUndo(int $index = null): bool; public function savepointUndo(?int $index = null): bool;
/** Performs an in-place upgrade of the database schema /** Performs an in-place upgrade of the database schema
* *

View file

@ -99,7 +99,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
} }
} }
public function savepointRelease(int $index = null): bool { public function savepointRelease(?int $index = null): bool {
$index = $index ?? $this->transDepth; $index = $index ?? $this->transDepth;
$out = parent::savepointRelease($index); $out = parent::savepointRelease($index);
if ($index == $this->transStart) { if ($index == $this->transStart) {
@ -109,7 +109,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
return $out; return $out;
} }
public function savepointUndo(int $index = null): bool { public function savepointUndo(?int $index = null): bool {
$index = $index ?? $this->transDepth; $index = $index ?? $this->transDepth;
$out = parent::savepointUndo($index); $out = parent::savepointUndo($index);
if ($index == $this->transStart) { if ($index == $this->transStart) {

View file

@ -10,6 +10,8 @@ namespace JKingWeb\Arsse\Db;
trait PDODriver { trait PDODriver {
use PDOError; use PDOError;
protected $db;
public function exec(string $query): bool { public function exec(string $query): bool {
try { try {
$this->db->exec($query); $this->db->exec($query);

View file

@ -139,7 +139,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
} }
} }
public function savepointRelease(int $index = null): bool { public function savepointRelease(?int $index = null): bool {
$index = $index ?? $this->transDepth; $index = $index ?? $this->transDepth;
$out = parent::savepointRelease($index); $out = parent::savepointRelease($index);
if ($index == $this->transStart) { if ($index == $this->transStart) {
@ -149,7 +149,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
return $out; return $out;
} }
public function savepointUndo(int $index = null): bool { public function savepointUndo(?int $index = null): bool {
$index = $index ?? $this->transDepth; $index = $index ?? $this->transDepth;
$out = parent::savepointUndo($index); $out = parent::savepointUndo($index);
if ($index == $this->transStart) { if ($index == $this->transStart) {

View file

@ -11,4 +11,6 @@ abstract class AbstractPDODriver extends Driver {
// this class exists solely so SQLite's PDO driver can call methods of the generic PDO driver via parent::method() // this class exists solely so SQLite's PDO driver can call methods of the generic PDO driver via parent::method()
// if there's a better way to do this, please FIXME ;) // if there's a better way to do this, please FIXME ;)
use \JKingWeb\Arsse\Db\PDODriver; use \JKingWeb\Arsse\Db\PDODriver;
protected $db;
} }

View file

@ -131,7 +131,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
} }
} }
public function schemaUpdate(int $to, string $basePath = null): bool { public function schemaUpdate(int $to, ?string $basePath = null): bool {
if ($to == 1) { if ($to == 1) {
// if we're initializing the database for the first time, switch to WAL mode // if we're initializing the database for the first time, switch to WAL mode
$this->exec("PRAGMA journal_mode = wal"); $this->exec("PRAGMA journal_mode = wal");

View file

@ -26,7 +26,7 @@ class Result extends \JKingWeb\Arsse\Db\AbstractResult {
// constructor/destructor // constructor/destructor
public function __construct(\SQLite3Result $result, array $changes = [0,0], Statement $statement = null) { public function __construct(\SQLite3Result $result, array $changes = [0,0], ?Statement $statement = null) {
$this->st = $statement; //keeps the statement from being destroyed, invalidating the result set $this->st = $statement; //keeps the statement from being destroyed, invalidating the result set
$this->set = $result; $this->set = $result;
$this->rows = $changes[0]; $this->rows = $changes[0];

View file

@ -60,7 +60,7 @@ class Feed {
} }
} }
public function __construct(int $feedID = null, string $url, string $lastModified = '', string $etag = '', string $username = '', string $password = '', bool $scrape = false) { public function __construct(?int $feedID, string $url, string $lastModified = '', string $etag = '', string $username = '', string $password = '', bool $scrape = false) {
// fetch the feed // fetch the feed
[$client, $reader] = self::download($url, $lastModified, $etag, $username, $password); [$client, $reader] = self::download($url, $lastModified, $etag, $username, $password);
// format the HTTP Last-Modified date returned // format the HTTP Last-Modified date returned
@ -288,7 +288,7 @@ class Feed {
return $out; return $out;
} }
protected function matchToDatabase(int $feedID = null): void { protected function matchToDatabase(?int $feedID = null): void {
// first perform deduplication on items // first perform deduplication on items
$items = $this->deduplicateItems($this->items); $items = $this->deduplicateItems($this->items);
// if we haven't been given a database feed ID to check against, all items are new // if we haven't been given a database feed ID to check against, all items are new

View file

@ -16,7 +16,7 @@ class Exception extends \JKingWeb\Arsse\AbstractException {
protected 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"]; protected 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"];
protected const HTTP_ERROR_MAP = [401 => "unauthorized",403 => "forbidden",404 => "invalidUrl",408 => "timeout",410 => "invalidUrl",414 => "invalidUrl",451 => "invalidUrl"]; protected const HTTP_ERROR_MAP = [401 => "unauthorized",403 => "forbidden",404 => "invalidUrl",408 => "timeout",410 => "invalidUrl",414 => "invalidUrl",451 => "invalidUrl"];
public function __construct(string $msgID = "", $vars = null, \Throwable $e = null) { public function __construct(string $msgID = "", $vars = null, ?\Throwable $e = null) {
if ($msgID === "") { if ($msgID === "") {
assert($e !== null, new \Exception("Expecting Picofeed or Guzzle exception when no message specified.")); assert($e !== null, new \Exception("Expecting Picofeed or Guzzle exception when no message specified."));
if ($e instanceof BadResponseException) { if ($e instanceof BadResponseException) {
@ -31,7 +31,8 @@ class Exception extends \JKingWeb\Arsse\AbstractException {
} elseif (preg_match("/^cURL error (\d+):/", $msg, $match)) { } elseif (preg_match("/^cURL error (\d+):/", $msg, $match)) {
$msgID = self::CURL_ERROR_MAP[(int) $match[1]] ?? "internalError"; $msgID = self::CURL_ERROR_MAP[(int) $match[1]] ?? "internalError";
} else { } else {
$msgID = "internalError"; // Fallback for future Guzzle exceptions we may not know about
$msgID = "internalError"; // @codeCoverageIgnore
} }
} elseif ($e instanceof PicoFeedException) { } elseif ($e instanceof PicoFeedException) {
$className = get_class($e); $className = get_class($e);

View file

@ -124,7 +124,7 @@ class Lang {
return $out; return $out;
} }
public function match(string $locale, array $list = null): string { public function match(string $locale, ?array $list = null): string {
$list = $list ?? $this->listFiles(); $list = $list ?? $this->listFiles();
$default = ($this->locale === "") ? self::DEFAULT : $this->locale; $default = ($this->locale === "") ? self::DEFAULT : $this->locale;
return \Locale::lookup($list, $locale, true, $default); return \Locale::lookup($list, $locale, true, $default);
@ -161,12 +161,12 @@ class Lang {
if (!$this->requirementsMet) { if (!$this->requirementsMet) {
$this->checkRequirements(); $this->checkRequirements();
} }
$this->synched = true;
$this->formatter = null;
// if we've requested no locale (""), just load the fallback strings and return // if we've requested no locale (""), just load the fallback strings and return
if ($this->wanted === "") { if ($this->wanted === "") {
$this->strings = self::REQUIRED; $this->strings = self::REQUIRED;
$this->locale = $this->wanted; $this->locale = $this->wanted;
$this->synched = true;
$this->formatter = null;
return true; return true;
} }
// decompose the requested locale from specific to general, building a list of files to load // decompose the requested locale from specific to general, building a list of files to load
@ -191,16 +191,14 @@ class Lang {
$files[] = $file; $files[] = $file;
} }
// if we need to load all files, start with the fallback strings // if we need to load all files, start with the fallback strings
$strings = [];
if ($files === $loaded) { if ($files === $loaded) {
$strings[] = self::REQUIRED; $this->strings = self::REQUIRED;
} else { $this->locale = "";
// otherwise start with the strings we already have if we're going from e.g. "fr" to "fr_ca"
$strings[] = $this->strings;
} }
// read files in reverse order $this->loaded = array_diff($loaded, $files);
$files = array_reverse($files); while ($files) {
foreach ($files as $file) { // read files in reverse order, from most general to most specific
$file = array_pop($files);
if (!file_exists($this->path."$file.php")) { if (!file_exists($this->path."$file.php")) {
throw new Lang\Exception("fileMissing", $file); throw new Lang\Exception("fileMissing", $file);
} elseif (!is_readable($this->path."$file.php")) { } elseif (!is_readable($this->path."$file.php")) {
@ -218,14 +216,10 @@ class Lang {
if (!is_array($arr)) { if (!is_array($arr)) {
throw new Lang\Exception("fileCorrupt", $file); throw new Lang\Exception("fileCorrupt", $file);
} }
$strings[] = $arr; $this->strings = array_replace_recursive($this->strings, $arr);
$this->loaded[] = $file;
$this->locale = $file;
} }
// apply the results and return
$this->strings = call_user_func_array("array_replace_recursive", $strings);
$this->loaded = $loaded;
$this->locale = $this->wanted;
$this->synched = true;
$this->formatter = null;
return true; return true;
} }
} }

View file

@ -8,7 +8,7 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\Misc; namespace JKingWeb\Arsse\Misc;
abstract class Date { abstract class Date {
public static function transform($date, string $outFormat = null, string $inFormat = null) { public static function transform($date, ?string $outFormat = null, ?string $inFormat = null) {
$date = ValueInfo::normalize($date, ValueInfo::T_DATE, $inFormat); $date = ValueInfo::normalize($date, ValueInfo::T_DATE, $inFormat);
if (!$date) { if (!$date) {
return null; return null;
@ -22,7 +22,7 @@ abstract class Date {
return $out; return $out;
} }
public static function normalize($date, string $inFormat = null): ?\DateTimeImmutable { public static function normalize($date, ?string $inFormat = null): ?\DateTimeImmutable {
return ValueInfo::normalize($date, ValueInfo::T_DATE, $inFormat); return ValueInfo::normalize($date, ValueInfo::T_DATE, $inFormat);
} }

View file

@ -36,7 +36,7 @@ class URL {
* @param string $u Username to add to the URL, replacing any existing credentials * @param string $u Username to add to the URL, replacing any existing credentials
* @param string $p Password to add to the URL, if a username is specified * @param string $p Password to add to the URL, if a username is specified
*/ */
public static function normalize(string $url, string $u = null, string $p = null): string { public static function normalize(string $url, ?string $u = null, ?string $p = null): string {
extract(parse_url($url)); extract(parse_url($url));
$out = ""; $out = "";
if (isset($scheme)) { if (isset($scheme)) {

View file

@ -60,7 +60,7 @@ class ValueInfo {
'float' => ["U.u", "U.u" ], 'float' => ["U.u", "U.u" ],
]; ];
public static function normalize($value, int $type, string $dateInFormat = null, $dateOutFormat = null) { public static function normalize($value, int $type, ?string $dateInFormat = null, $dateOutFormat = null) {
$allowNull = ($type & self::M_NULL); $allowNull = ($type & self::M_NULL);
$strict = ($type & (self::M_STRICT | self::M_DROP)); $strict = ($type & (self::M_STRICT | self::M_DROP));
$drop = ($type & self::M_DROP); $drop = ($type & self::M_DROP);
@ -511,7 +511,7 @@ class ValueInfo {
} }
} }
public static function bool($value, bool $default = null): ?bool { public static function bool($value, ?bool $default = null): ?bool {
if (is_null($value) || ValueInfo::str($value) & ValueInfo::WHITE) { if (is_null($value) || ValueInfo::str($value) & ValueInfo::WHITE) {
return $default; return $default;
} }

View file

@ -76,11 +76,11 @@ class REST {
]; ];
protected $apis = []; protected $apis = [];
public function __construct(array $apis = null) { public function __construct(?array $apis = null) {
$this->apis = $apis ?? self::API_LIST; $this->apis = $apis ?? self::API_LIST;
} }
public function dispatch(ServerRequestInterface $req = null): ResponseInterface { public function dispatch(?ServerRequestInterface $req = null): ResponseInterface {
try { try {
// ensure the require extensions are loaded // ensure the require extensions are loaded
Arsse::checkExtensions(...Arsse::REQUIRED_EXTENSIONS); Arsse::checkExtensions(...Arsse::REQUIRED_EXTENSIONS);
@ -159,12 +159,12 @@ class REST {
return $req; return $req;
} }
public function challenge(ResponseInterface $res, string $realm = null): ResponseInterface { public function challenge(ResponseInterface $res, ?string $realm = null): ResponseInterface {
$realm = $realm ?? Arsse::$conf->httpRealm; $realm = $realm ?? Arsse::$conf->httpRealm;
return $res->withAddedHeader("WWW-Authenticate", 'Basic realm="'.$realm.'", charset="UTF-8"'); return $res->withAddedHeader("WWW-Authenticate", 'Basic realm="'.$realm.'", charset="UTF-8"');
} }
public function normalizeResponse(ResponseInterface $res, RequestInterface $req = null): ResponseInterface { public function normalizeResponse(ResponseInterface $res, ?RequestInterface $req = null): ResponseInterface {
// if the response code is 401, issue an HTTP authentication challenge // if the response code is 401, issue an HTTP authentication challenge
if ($res->getStatusCode() == 401) { if ($res->getStatusCode() == 401) {
$res = $this->challenge($res); $res = $this->challenge($res);
@ -203,7 +203,7 @@ class REST {
return $res; return $res;
} }
public function corsApply(ResponseInterface $res, RequestInterface $req = null): ResponseInterface { public function corsApply(ResponseInterface $res, ?RequestInterface $req = null): ResponseInterface {
if ($req && $req->getMethod() === "OPTIONS") { if ($req && $req->getMethod() === "OPTIONS") {
if ($res->hasHeader("Allow")) { if ($res->hasHeader("Allow")) {
$res = $res->withHeader("Access-Control-Allow-Methods", $res->getHeaderLine("Allow")); $res = $res->withHeader("Access-Control-Allow-Methods", $res->getHeaderLine("Allow"));
@ -218,7 +218,7 @@ class REST {
return $res->withAddedHeader("Vary", "Origin"); return $res->withAddedHeader("Vary", "Origin");
} }
public function corsNegotiate(RequestInterface $req, string $allowed = null, string $denied = null): bool { public function corsNegotiate(RequestInterface $req, ?string $allowed = null, ?string $denied = null): bool {
$allowed = trim($allowed ?? Arsse::$conf->httpOriginsAllowed); $allowed = trim($allowed ?? Arsse::$conf->httpOriginsAllowed);
$denied = trim($denied ?? Arsse::$conf->httpOriginsDenied); $denied = trim($denied ?? Arsse::$conf->httpOriginsDenied);
// continue if at least one origin is allowed // continue if at least one origin is allowed
@ -255,7 +255,7 @@ class REST {
return false; return false;
} }
public function corsNormalizeOrigin(string $origin, array $ports = null): string { public function corsNormalizeOrigin(string $origin, ?array $ports = null): string {
$origin = trim($origin); $origin = trim($origin);
if ($origin === "null") { if ($origin === "null") {
// if the origin is the special value "null", use it // if the origin is the special value "null", use it

View file

@ -11,7 +11,7 @@ use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Db\ExceptionInput; use JKingWeb\Arsse\Db\ExceptionInput;
class User { class User {
public function register(string $user, string $password = null): string { public function register(string $user, ?string $password = null): string {
$password = $password ?? Arsse::$user->generatePassword(); $password = $password ?? Arsse::$user->generatePassword();
$hash = md5("$user:$password"); $hash = md5("$user:$password");
$tr = Arsse::$db->begin(); $tr = Arsse::$db->begin();

View file

@ -1028,7 +1028,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
return ['total' => $count, 'entries' => $out]; return ['total' => $count, 'entries' => $out];
} }
protected function findEntry(int $id, Context $c = null): array { protected function findEntry(int $id, ?Context $c = null): array {
$c = ($c ?? new Context)->article($id); $c = ($c ?? new Context)->article($id);
$tr = Arsse::$db->begin(); $tr = Arsse::$db->begin();
$meta = $this->userMeta(Arsse::$user->id); $meta = $this->userMeta(Arsse::$user->id);

View file

@ -135,7 +135,7 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
return implode("/", $path); return implode("/", $path);
} }
protected function normalizeInput(array $data, array $types, string $dateFormat = null, int $mode = 0): array { protected function normalizeInput(array $data, array $types, ?string $dateFormat = null, int $mode = 0): array {
$out = []; $out = [];
foreach ($types as $key => $type) { foreach ($types as $key => $type) {
if (isset($data[$key])) { if (isset($data[$key])) {

View file

@ -33,7 +33,7 @@ class Search {
"" => "searchTerms", "" => "searchTerms",
]; ];
public static function parse(string $search, string $tz, Context $context = null): ?Context { public static function parse(string $search, string $tz, ?Context $context = null): ?Context {
// normalize the input // normalize the input
$search = strtolower(trim(preg_replace("<\s+>", " ", $search))); $search = strtolower(trim(preg_replace("<\s+>", " ", $search)));
// set initial state // set initial state
@ -283,7 +283,7 @@ class Search {
return $context; return $context;
} }
protected static function processToken(Context $c, string $value, string $tag, bool $neg, string $tz = null): Context { protected static function processToken(Context $c, string $value, string $tag, bool $neg, ?string $tz = null): Context {
if (!strlen($value) && !strlen($tag)) { if (!strlen($value) && !strlen($tag)) {
return $c; return $c;
} elseif (!strlen($value)) { } elseif (!strlen($value)) {

View file

@ -35,7 +35,7 @@ class User {
/** @var User\Driver */ /** @var User\Driver */
protected $u; protected $u;
public function __construct(\JKingWeb\Arsse\User\Driver $driver = null) { public function __construct(?\JKingWeb\Arsse\User\Driver $driver = null) {
$this->u = $driver ?? new Arsse::$conf->userDriver; $this->u = $driver ?? new Arsse::$conf->userDriver;
} }

View file

@ -24,7 +24,7 @@ interface Driver {
* @param string $user The username to create * @param string $user The username to create
* @param string|null $password The cleartext password to assign to the user, or null to generate a random password * @param string|null $password The cleartext password to assign to the user, or null to generate a random password
*/ */
public function userAdd(string $user, string $password = null): ?string; public function userAdd(string $user, ?string $password = null): ?string;
/** Renames a user /** Renames a user
* *
@ -50,14 +50,14 @@ interface Driver {
* @param string|null $password The cleartext password to assign to the user, or null to generate a random password * @param string|null $password The cleartext password to assign to the user, or null to generate a random password
* @param string|null $oldPassword The user's previous password, if known * @param string|null $oldPassword The user's previous password, if known
*/ */
public function userPasswordSet(string $user, ?string $newPassword, string $oldPassword = null): ?string; public function userPasswordSet(string $user, ?string $newPassword, ?string $oldPassword = null): ?string;
/** Removes a user's password; this makes authentication fail unconditionally /** Removes a user's password; this makes authentication fail unconditionally
* *
* @param string $user The user for whom to change the password * @param string $user The user for whom to change the password
* @param string|null $oldPassword The user's previous password, if known * @param string|null $oldPassword The user's previous password, if known
*/ */
public function userPasswordUnset(string $user, string $oldPassword = null): bool; public function userPasswordUnset(string $user, ?string $oldPassword = null): bool;
/** Retrieves metadata about a user /** Retrieves metadata about a user
* *

View file

@ -33,7 +33,7 @@ class Driver implements \JKingWeb\Arsse\User\Driver {
return password_verify($password, $hash); return password_verify($password, $hash);
} }
public function userAdd(string $user, string $password = null): ?string { public function userAdd(string $user, ?string $password = null): ?string {
if (isset($password)) { 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 // 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); Arsse::$db->userAdd($user, $password);
@ -59,7 +59,7 @@ class Driver implements \JKingWeb\Arsse\User\Driver {
return Arsse::$db->userList(); return Arsse::$db->userList();
} }
public function userPasswordSet(string $user, ?string $newPassword, string $oldPassword = null): ?string { public function userPasswordSet(string $user, ?string $newPassword, ?string $oldPassword = null): ?string {
// do nothing: the internal database is updated regardless of what the driver does (assuming it does not throw an exception) // do nothing: the internal database is updated regardless of what the driver does (assuming it does not throw an exception)
// throw an exception if the user does not exist // throw an exception if the user does not exist
if (!$this->userExists($user)) { if (!$this->userExists($user)) {
@ -69,7 +69,7 @@ class Driver implements \JKingWeb\Arsse\User\Driver {
} }
} }
public function userPasswordUnset(string $user, string $oldPassword = null): bool { public function userPasswordUnset(string $user, ?string $oldPassword = null): bool {
// do nothing: the internal database is updated regardless of what the driver does (assuming it does not throw an exception) // do nothing: the internal database is updated regardless of what the driver does (assuming it does not throw an exception)
// throw an exception if the user does not exist // throw an exception if the user does not exist
if (!$this->userExists($user)) { if (!$this->userExists($user)) {

17
robo
View file

@ -1,14 +1,17 @@
#! /bin/sh #! /bin/sh
base=`dirname "$0"` base=`dirname "$0"`
roboCommand="$1" command="$1"
robo="$base/vendor-bin/robo/vendor/bin/robo"
if [ -z "$ARSSE_PHP" ]; then
php="php"
else
php="$ARSSE_PHP"
fi
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
"$base/vendor-bin/robo/vendor/bin/robo" "$php" "$robo"
else else
shift shift
ulimit -n 2048 ulimit -n 2048
if [ "$1" = "clean" ]; then "$php" "$robo" "$command" -- "$@"
"$base/vendor-bin/robo/vendor/bin/robo" "$roboCommand" "$@"
else
"$base/vendor-bin/robo/vendor/bin/robo" "$roboCommand" -- "$@"
fi
fi fi

View file

@ -427,7 +427,15 @@ trait SeriesArticle {
unset($this->data, $this->matches, $this->fields, $this->checkTables, $this->user); unset($this->data, $this->matches, $this->fields, $this->checkTables, $this->user);
} }
/** @dataProvider provideContextMatches */ /**
* @dataProvider provideContextMatches
* @covers \JKingWeb\Arsse\Database::articleList
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testListArticlesCheckingContext(RootContext $c, array $exp): void { public function testListArticlesCheckingContext(RootContext $c, array $exp): void {
$ids = array_column($ids = Arsse::$db->articleList("john.doe@example.com", $c, ["id"], ["id"])->getAll(), "id"); $ids = array_column($ids = Arsse::$db->articleList("john.doe@example.com", $c, ["id"], ["id"])->getAll(), "id");
sort($ids); sort($ids);
@ -547,6 +555,14 @@ trait SeriesArticle {
]; ];
} }
/**
* @covers \JKingWeb\Arsse\Database::editionArticle
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testRetrieveArticleIdsForEditions(): void { public function testRetrieveArticleIdsForEditions(): void {
$exp = [ $exp = [
1 => 1, 1 => 1,
@ -584,16 +600,40 @@ trait SeriesArticle {
$this->assertEquals($exp, Arsse::$db->editionArticle(...range(1, 1001))); $this->assertEquals($exp, Arsse::$db->editionArticle(...range(1, 1001)));
} }
/**
* @covers \JKingWeb\Arsse\Database::articleList
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testListArticlesOfAMissingFolder(): void { public function testListArticlesOfAMissingFolder(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->articleList($this->user, (new Context)->folder(1)); Arsse::$db->articleList($this->user, (new Context)->folder(1));
} }
/**
* @covers \JKingWeb\Arsse\Database::articleList
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testListArticlesOfAMissingSubscription(): void { public function testListArticlesOfAMissingSubscription(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->articleList($this->user, (new Context)->subscription(1)); Arsse::$db->articleList($this->user, (new Context)->subscription(1));
} }
/**
* @covers \JKingWeb\Arsse\Database::articleList
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testListArticlesCheckingProperties(): void { public function testListArticlesCheckingProperties(): void {
$this->user = "john.doe@example.org"; $this->user = "john.doe@example.org";
// check that the different fieldset groups return the expected columns // check that the different fieldset groups return the expected columns
@ -607,7 +647,15 @@ trait SeriesArticle {
$this->assertEquals($this->fields, $test); $this->assertEquals($this->fields, $test);
} }
/** @dataProvider provideOrderedLists */ /**
* @dataProvider provideOrderedLists
* @covers \JKingWeb\Arsse\Database::articleList
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
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); $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); $this->assertSame($exp, $act);
@ -626,10 +674,26 @@ trait SeriesArticle {
]; ];
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkNothing(): void { public function testMarkNothing(): void {
$this->assertSame(0, Arsse::$db->articleMark($this->user, [])); $this->assertSame(0, Arsse::$db->articleMark($this->user, []));
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesUnread(): void { public function testMarkAllArticlesUnread(): void {
Arsse::$db->articleMark($this->user, ['read' => false]); Arsse::$db->articleMark($this->user, ['read' => false]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -641,6 +705,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesRead(): void { public function testMarkAllArticlesRead(): void {
Arsse::$db->articleMark($this->user, ['read' => true]); Arsse::$db->articleMark($this->user, ['read' => true]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -656,6 +728,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesUnstarred(): void { public function testMarkAllArticlesUnstarred(): void {
Arsse::$db->articleMark($this->user, ['starred' => false]); Arsse::$db->articleMark($this->user, ['starred' => false]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -667,6 +747,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesStarred(): void { public function testMarkAllArticlesStarred(): void {
Arsse::$db->articleMark($this->user, ['starred' => true]); Arsse::$db->articleMark($this->user, ['starred' => true]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -682,6 +770,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesUnreadAndUnstarred(): void { public function testMarkAllArticlesUnreadAndUnstarred(): void {
Arsse::$db->articleMark($this->user, ['read' => false,'starred' => false]); Arsse::$db->articleMark($this->user, ['read' => false,'starred' => false]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -696,6 +792,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesReadAndStarred(): void { public function testMarkAllArticlesReadAndStarred(): void {
Arsse::$db->articleMark($this->user, ['read' => true,'starred' => true]); Arsse::$db->articleMark($this->user, ['read' => true,'starred' => true]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -714,6 +818,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesUnreadAndStarred(): void { public function testMarkAllArticlesUnreadAndStarred(): void {
Arsse::$db->articleMark($this->user, ['read' => false,'starred' => true]); Arsse::$db->articleMark($this->user, ['read' => false,'starred' => true]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -732,6 +844,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesReadAndUnstarred(): void { public function testMarkAllArticlesReadAndUnstarred(): void {
Arsse::$db->articleMark($this->user, ['read' => true,'starred' => false]); Arsse::$db->articleMark($this->user, ['read' => true,'starred' => false]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -750,6 +870,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testSetNoteForAllArticles(): void { public function testSetNoteForAllArticles(): void {
Arsse::$db->articleMark($this->user, ['note' => "New note"]); Arsse::$db->articleMark($this->user, ['note' => "New note"]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -769,6 +897,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkATreeFolder(): void { public function testMarkATreeFolder(): void {
Arsse::$db->articleMark($this->user, ['read' => true], (new Context)->folder(7)); Arsse::$db->articleMark($this->user, ['read' => true], (new Context)->folder(7));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -780,6 +916,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkALeafFolder(): void { public function testMarkALeafFolder(): void {
Arsse::$db->articleMark($this->user, ['read' => true], (new Context)->folder(8)); Arsse::$db->articleMark($this->user, ['read' => true], (new Context)->folder(8));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -789,6 +933,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAMissingFolder(): void { public function testMarkAMissingFolder(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->articleMark($this->user, ['read' => true], (new Context)->folder(42)); Arsse::$db->articleMark($this->user, ['read' => true], (new Context)->folder(42));
@ -803,11 +955,27 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAMissingSubscription(): void { public function testMarkAMissingSubscription(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->articleMark($this->user, ['read' => true], (new Context)->folder(2112)); Arsse::$db->articleMark($this->user, ['read' => true], (new Context)->folder(2112));
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAnArticle(): void { public function testMarkAnArticle(): void {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->article(20)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->article(20));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -817,6 +985,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkMultipleArticles(): void { public function testMarkMultipleArticles(): void {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->articles([2,4,7,20])); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->articles([2,4,7,20]));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -827,6 +1003,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkMultipleArticlessUnreadAndStarred(): void { public function testMarkMultipleArticlessUnreadAndStarred(): void {
Arsse::$db->articleMark($this->user, ['read' => false,'starred' => true], (new Context)->articles([2,4,7,20])); Arsse::$db->articleMark($this->user, ['read' => false,'starred' => true], (new Context)->articles([2,4,7,20]));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -840,16 +1024,40 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkTooManyMultipleArticles(): void { public function testMarkTooManyMultipleArticles(): void {
$setSize = (new \ReflectionClassConstant(Database::class, "LIMIT_SET_SIZE"))->getValue(); $setSize = (new \ReflectionClassConstant(Database::class, "LIMIT_SET_SIZE"))->getValue();
$this->assertSame(7, Arsse::$db->articleMark($this->user, ['read' => false,'starred' => true], (new Context)->articles(range(1, $setSize * 3)))); $this->assertSame(7, Arsse::$db->articleMark($this->user, ['read' => false,'starred' => true], (new Context)->articles(range(1, $setSize * 3))));
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAMissingArticle(): void { public function testMarkAMissingArticle(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->article(1)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->article(1));
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAnEdition(): void { public function testMarkAnEdition(): void {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->edition(1001)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->edition(1001));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -859,6 +1067,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkMultipleEditions(): void { public function testMarkMultipleEditions(): void {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editions([2,4,7,20])); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editions([2,4,7,20]));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -869,12 +1085,28 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkMultipleMissingEditions(): void { public function testMarkMultipleMissingEditions(): void {
$this->assertSame(0, Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editions([500,501]))); $this->assertSame(0, Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editions([500,501])));
$state = $this->primeExpectations($this->data, $this->checkTables); $state = $this->primeExpectations($this->data, $this->checkTables);
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkMultipleEditionsUnread(): void { public function testMarkMultipleEditionsUnread(): void {
Arsse::$db->articleMark($this->user, ['read' => false], (new Context)->editions([2,4,7,1001])); Arsse::$db->articleMark($this->user, ['read' => false], (new Context)->editions([2,4,7,1001]));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -886,6 +1118,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkMultipleEditionsUnreadWithStale(): void { public function testMarkMultipleEditionsUnreadWithStale(): void {
Arsse::$db->articleMark($this->user, ['read' => false], (new Context)->editions([2,4,7,20])); Arsse::$db->articleMark($this->user, ['read' => false], (new Context)->editions([2,4,7,20]));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -895,6 +1135,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkMultipleEditionsUnreadAndStarredWithStale(): void { public function testMarkMultipleEditionsUnreadAndStarredWithStale(): void {
Arsse::$db->articleMark($this->user, ['read' => false,'starred' => true], (new Context)->editions([2,4,7,20])); Arsse::$db->articleMark($this->user, ['read' => false,'starred' => true], (new Context)->editions([2,4,7,20]));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -907,16 +1155,39 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
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)))); $this->assertSame(7, Arsse::$db->articleMark($this->user, ['read' => false,'starred' => true], (new Context)->editions(range(1, 51))));
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAStaleEditionUnread(): void { public function testMarkAStaleEditionUnread(): void {
Arsse::$db->articleMark($this->user, ['read' => false], (new Context)->edition(20)); // no changes occur Arsse::$db->articleMark($this->user, ['read' => false], (new Context)->edition(20)); // no changes occur
$state = $this->primeExpectations($this->data, $this->checkTables); $state = $this->primeExpectations($this->data, $this->checkTables);
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAStaleEditionStarred(): void { public function testMarkAStaleEditionStarred(): void {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->edition(20)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->edition(20));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -926,6 +1197,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
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 Arsse::$db->articleMark($this->user, ['read' => false,'starred' => true], (new Context)->edition(20)); // only starred is changed
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -935,17 +1214,41 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAStaleEditionUnreadAndUnstarred(): void { public function testMarkAStaleEditionUnreadAndUnstarred(): void {
Arsse::$db->articleMark($this->user, ['read' => false,'starred' => false], (new Context)->edition(20)); // no changes occur Arsse::$db->articleMark($this->user, ['read' => false,'starred' => false], (new Context)->edition(20)); // no changes occur
$state = $this->primeExpectations($this->data, $this->checkTables); $state = $this->primeExpectations($this->data, $this->checkTables);
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAMissingEdition(): void { public function testMarkAMissingEdition(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->edition(2)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->edition(2));
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkByOldestEdition(): void { public function testMarkByOldestEdition(): void {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editionRange(19, null)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editionRange(19, null));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -957,6 +1260,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkByLatestEdition(): void { public function testMarkByLatestEdition(): void {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editionRange(null, 20)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editionRange(null, 20));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -970,6 +1281,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkByLastMarked(): void { public function testMarkByLastMarked(): void {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->markedRange('2017-01-01T00:00:00Z', null)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->markedRange('2017-01-01T00:00:00Z', null));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -981,6 +1300,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkByNotLastMarked(): void { public function testMarkByNotLastMarked(): void {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->markedRange(null, '2000-01-01T00:00:00Z')); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->markedRange(null, '2000-01-01T00:00:00Z'));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -990,6 +1317,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleCount
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testCountArticles(): void { public function testCountArticles(): void {
$setSize = (new \ReflectionClassConstant(Database::class, "LIMIT_SET_SIZE"))->getValue(); $setSize = (new \ReflectionClassConstant(Database::class, "LIMIT_SET_SIZE"))->getValue();
$this->assertSame(2, Arsse::$db->articleCount("john.doe@example.com", (new Context)->starred(true))); $this->assertSame(2, Arsse::$db->articleCount("john.doe@example.com", (new Context)->starred(true)));
@ -998,6 +1333,7 @@ trait SeriesArticle {
$this->assertSame(10, Arsse::$db->articleCount("john.doe@example.com", (new Context)->articles(range(1, $setSize * 3)))); $this->assertSame(10, Arsse::$db->articleCount("john.doe@example.com", (new Context)->articles(range(1, $setSize * 3))));
} }
/** @covers \JKingWeb\Arsse\Database::articleStarred */
public function testFetchStarredCounts(): void { public function testFetchStarredCounts(): void {
$exp1 = ['total' => 2, 'unread' => 1, 'read' => 1]; $exp1 = ['total' => 2, 'unread' => 1, 'read' => 1];
$exp2 = ['total' => 0, 'unread' => 0, 'read' => 0]; $exp2 = ['total' => 0, 'unread' => 0, 'read' => 0];
@ -1005,17 +1341,20 @@ trait SeriesArticle {
$this->assertEquals($exp2, Arsse::$db->articleStarred("jane.doe@example.com")); $this->assertEquals($exp2, Arsse::$db->articleStarred("jane.doe@example.com"));
} }
/** @covers \JKingWeb\Arsse\Database::editionLatest */
public function testFetchLatestEdition(): void { public function testFetchLatestEdition(): void {
$this->assertSame(1001, Arsse::$db->editionLatest($this->user)); $this->assertSame(1001, Arsse::$db->editionLatest($this->user));
$this->assertSame(4, Arsse::$db->editionLatest($this->user, (new Context)->subscription(12))); $this->assertSame(4, Arsse::$db->editionLatest($this->user, (new Context)->subscription(12)));
$this->assertSame(5, Arsse::$db->editionLatest("john.doe@example.com", (new Context)->subscription(3)->hidden(false))); $this->assertSame(5, Arsse::$db->editionLatest("john.doe@example.com", (new Context)->subscription(3)->hidden(false)));
} }
/** @covers \JKingWeb\Arsse\Database::editionLatest */
public function testFetchLatestEditionOfMissingSubscription(): void { public function testFetchLatestEditionOfMissingSubscription(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->editionLatest($this->user, (new Context)->subscription(1)); Arsse::$db->editionLatest($this->user, (new Context)->subscription(1));
} }
/** @covers \JKingWeb\Arsse\Database::articleLabelsGet */
public function testListTheLabelsOfAnArticle(): void { public function testListTheLabelsOfAnArticle(): void {
$this->assertEquals([1,2], Arsse::$db->articleLabelsGet("john.doe@example.com", 1)); $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([2], Arsse::$db->articleLabelsGet("john.doe@example.com", 5));
@ -1025,11 +1364,13 @@ trait SeriesArticle {
$this->assertEquals([], Arsse::$db->articleLabelsGet("john.doe@example.com", 2, true)); $this->assertEquals([], Arsse::$db->articleLabelsGet("john.doe@example.com", 2, true));
} }
/** @covers \JKingWeb\Arsse\Database::articleLabelsGet */
public function testListTheLabelsOfAMissingArticle(): void { public function testListTheLabelsOfAMissingArticle(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->articleLabelsGet($this->user, 101); Arsse::$db->articleLabelsGet($this->user, 101);
} }
/** @covers \JKingWeb\Arsse\Database::articleCategoriesGet */
public function testListTheCategoriesOfAnArticle(): void { public function testListTheCategoriesOfAnArticle(): void {
$exp = ["Fascinating", "Logical"]; $exp = ["Fascinating", "Logical"];
$this->assertSame($exp, Arsse::$db->articleCategoriesGet($this->user, 19)); $this->assertSame($exp, Arsse::$db->articleCategoriesGet($this->user, 19));
@ -1039,12 +1380,21 @@ trait SeriesArticle {
$this->assertSame($exp, Arsse::$db->articleCategoriesGet($this->user, 4)); $this->assertSame($exp, Arsse::$db->articleCategoriesGet($this->user, 4));
} }
/** @covers \JKingWeb\Arsse\Database::articleCategoriesGet */
public function testListTheCategoriesOfAMissingArticle(): void { public function testListTheCategoriesOfAMissingArticle(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->articleCategoriesGet($this->user, 101); Arsse::$db->articleCategoriesGet($this->user, 101);
} }
/** @dataProvider provideArrayContextOptions */ /**
* @dataProvider provideArrayContextOptions
* @covers \JKingWeb\Arsse\Database::articleList
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testUseTooFewValuesInArrayContext(string $option): void { public function testUseTooFewValuesInArrayContext(string $option): void {
$this->assertException("tooShort", "Db", "ExceptionInput"); $this->assertException("tooShort", "Db", "ExceptionInput");
Arsse::$db->articleList($this->user, (new Context)->$option([])); Arsse::$db->articleList($this->user, (new Context)->$option([]));
@ -1062,6 +1412,14 @@ trait SeriesArticle {
} }
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesNotHidden(): void { public function testMarkAllArticlesNotHidden(): void {
Arsse::$db->articleMark("jane.doe@example.com", ['hidden' => false]); Arsse::$db->articleMark("jane.doe@example.com", ['hidden' => false]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -1073,6 +1431,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesHidden(): void { public function testMarkAllArticlesHidden(): void {
Arsse::$db->articleMark("jane.doe@example.com", ['hidden' => true]); Arsse::$db->articleMark("jane.doe@example.com", ['hidden' => true]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -1083,6 +1449,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesUnreadAndNotHidden(): void { public function testMarkAllArticlesUnreadAndNotHidden(): void {
Arsse::$db->articleMark("jane.doe@example.com", ['read' => false, 'hidden' => false]); Arsse::$db->articleMark("jane.doe@example.com", ['read' => false, 'hidden' => false]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -1097,6 +1471,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesReadAndHidden(): void { public function testMarkAllArticlesReadAndHidden(): void {
Arsse::$db->articleMark("jane.doe@example.com", ['read' => true, 'hidden' => true]); Arsse::$db->articleMark("jane.doe@example.com", ['read' => true, 'hidden' => true]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -1109,6 +1491,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesUnreadAndHidden(): void { public function testMarkAllArticlesUnreadAndHidden(): void {
Arsse::$db->articleMark("jane.doe@example.com", ['read' => false,'hidden' => true]); Arsse::$db->articleMark("jane.doe@example.com", ['read' => false,'hidden' => true]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -1122,6 +1512,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAllArticlesReadAndNotHidden(): void { public function testMarkAllArticlesReadAndNotHidden(): void {
Arsse::$db->articleMark("jane.doe@example.com", ['read' => true,'hidden' => false]); Arsse::$db->articleMark("jane.doe@example.com", ['read' => true,'hidden' => false]);
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -1135,6 +1533,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkMultipleEditionsUnreadAndHiddenWithStale(): void { public function testMarkMultipleEditionsUnreadAndHiddenWithStale(): void {
Arsse::$db->articleMark("jane.doe@example.com", ['read' => false,'hidden' => true], (new Context)->editions([1,2,19,20])); Arsse::$db->articleMark("jane.doe@example.com", ['read' => false,'hidden' => true], (new Context)->editions([1,2,19,20]));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -1148,6 +1554,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAStaleEditionHidden(): void { public function testMarkAStaleEditionHidden(): void {
Arsse::$db->articleMark("jane.doe@example.com", ['hidden' => true], (new Context)->edition(20)); Arsse::$db->articleMark("jane.doe@example.com", ['hidden' => true], (new Context)->edition(20));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -1157,6 +1571,14 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAStaleEditionUnreadAndHidden(): void { public function testMarkAStaleEditionUnreadAndHidden(): void {
Arsse::$db->articleMark("jane.doe@example.com", ['read' => false,'hidden' => true], (new Context)->edition(20)); // only starred is changed Arsse::$db->articleMark("jane.doe@example.com", ['read' => false,'hidden' => true], (new Context)->edition(20)); // only starred is changed
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -1166,12 +1588,28 @@ trait SeriesArticle {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleMark
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testMarkAStaleEditionUnreadAndNotHidden(): void { public function testMarkAStaleEditionUnreadAndNotHidden(): void {
Arsse::$db->articleMark("jane.doe@example.com", ['read' => false,'hidden' => false], (new Context)->edition(20)); // no changes occur Arsse::$db->articleMark("jane.doe@example.com", ['read' => false,'hidden' => false], (new Context)->edition(20)); // no changes occur
$state = $this->primeExpectations($this->data, $this->checkTables); $state = $this->primeExpectations($this->data, $this->checkTables);
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::articleList
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testSelectScrapedContent(): void { public function testSelectScrapedContent(): void {
$exp = [ $exp = [
['id' => 101, 'content' => "<p>Article content 1</p>"], ['id' => 101, 'content' => "<p>Article content 1</p>"],
@ -1185,6 +1623,14 @@ trait SeriesArticle {
$this->assertResult($exp, Arsse::$db->articleList("jill.doe@example.com", (new Context)->subscription(15), ["id", "content"])); $this->assertResult($exp, Arsse::$db->articleList("jill.doe@example.com", (new Context)->subscription(15), ["id", "content"]));
} }
/**
* @covers \JKingWeb\Arsse\Database::articleList
* @covers \JKingWeb\Arsse\Database::articleQuery
* @covers \JKingWeb\Arsse\Database::articleValidateId
* @covers \JKingWeb\Arsse\Database::articleValidateEdition
* @covers \JKingWeb\Arsse\Database::articleColumns
* @covers \JKingWeb\Arsse\Database::articleFilter
*/
public function testSearchScrapedContent(): void { public function testSearchScrapedContent(): void {
$exp = [ $exp = [
['id' => 101, 'content' => "<p>Scraped content 1</p>"], ['id' => 101, 'content' => "<p>Scraped content 1</p>"],

View file

@ -170,6 +170,7 @@ trait SeriesCleanup {
unset($this->data); unset($this->data);
} }
/** @covers \JKingWeb\Arsse\Database::feedCleanup */
public function testCleanUpOrphanedFeeds(): void { public function testCleanUpOrphanedFeeds(): void {
Arsse::$db->feedCleanup(); Arsse::$db->feedCleanup();
$now = gmdate("Y-m-d H:i:s"); $now = gmdate("Y-m-d H:i:s");
@ -182,6 +183,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::feedCleanup */
public function testCleanUpOrphanedFeedsWithUnlimitedRetention(): void { public function testCleanUpOrphanedFeedsWithUnlimitedRetention(): void {
Arsse::$conf->import([ Arsse::$conf->import([
'purgeFeeds' => null, 'purgeFeeds' => null,
@ -196,6 +198,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::iconCleanup */
public function testCleanUpOrphanedIcons(): void { public function testCleanUpOrphanedIcons(): void {
Arsse::$db->iconCleanup(); Arsse::$db->iconCleanup();
$now = gmdate("Y-m-d H:i:s"); $now = gmdate("Y-m-d H:i:s");
@ -208,6 +211,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::iconCleanup */
public function testCleanUpOrphanedIconsWithUnlimitedRetention(): void { public function testCleanUpOrphanedIconsWithUnlimitedRetention(): void {
Arsse::$conf->import([ Arsse::$conf->import([
'purgeFeeds' => null, 'purgeFeeds' => null,
@ -222,6 +226,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::articleCleanup */
public function testCleanUpOldArticlesWithStandardRetention(): void { public function testCleanUpOldArticlesWithStandardRetention(): void {
Arsse::$db->articleCleanup(); Arsse::$db->articleCleanup();
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
@ -233,6 +238,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::articleCleanup */
public function testCleanUpOldArticlesWithUnlimitedReadRetention(): void { public function testCleanUpOldArticlesWithUnlimitedReadRetention(): void {
Arsse::$conf->import([ Arsse::$conf->import([
'purgeArticlesRead' => null, 'purgeArticlesRead' => null,
@ -247,6 +253,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::articleCleanup */
public function testCleanUpOldArticlesWithUnlimitedUnreadRetention(): void { public function testCleanUpOldArticlesWithUnlimitedUnreadRetention(): void {
Arsse::$conf->import([ Arsse::$conf->import([
'purgeArticlesUnread' => null, 'purgeArticlesUnread' => null,
@ -261,6 +268,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::articleCleanup */
public function testCleanUpOldArticlesWithUnlimitedRetention(): void { public function testCleanUpOldArticlesWithUnlimitedRetention(): void {
Arsse::$conf->import([ Arsse::$conf->import([
'purgeArticlesRead' => null, 'purgeArticlesRead' => null,
@ -273,6 +281,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::sessionCleanup */
public function testCleanUpExpiredSessions(): void { public function testCleanUpExpiredSessions(): void {
Arsse::$db->sessionCleanup(); Arsse::$db->sessionCleanup();
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
@ -284,6 +293,7 @@ trait SeriesCleanup {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::tokenCleanup */
public function testCleanUpExpiredTokens(): void { public function testCleanUpExpiredTokens(): void {
Arsse::$db->tokenCleanup(); Arsse::$db->tokenCleanup();
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [

View file

@ -192,10 +192,12 @@ trait SeriesFeed {
unset($this->data, $this->matches); unset($this->data, $this->matches);
} }
/** @covers \JKingWeb\Arsse\Database::feedMatchLatest */
public function testListLatestItems(): void { public function testListLatestItems(): void {
$this->assertResult($this->matches, Arsse::$db->feedMatchLatest(1, 2)); $this->assertResult($this->matches, Arsse::$db->feedMatchLatest(1, 2));
} }
/** @covers \JKingWeb\Arsse\Database::feedMatchIds */
public function testMatchItemsById(): void { public function testMatchItemsById(): void {
$this->assertResult($this->matches, Arsse::$db->feedMatchIds(1, ['804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41'])); $this->assertResult($this->matches, Arsse::$db->feedMatchIds(1, ['804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41']));
foreach ($this->matches as $m) { foreach ($this->matches as $m) {
@ -207,7 +209,10 @@ 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 $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
} }
/** @dataProvider provideFilterRules */ /**
* @dataProvider provideFilterRules
* @covers \JKingWeb\Arsse\Database::feedRulesGet
*/
public function testGetRules(int $in, array $exp): void { public function testGetRules(int $in, array $exp): void {
$this->assertSame($exp, Arsse::$db->feedRulesGet($in)); $this->assertSame($exp, Arsse::$db->feedRulesGet($in));
} }
@ -222,6 +227,7 @@ trait SeriesFeed {
]; ];
} }
/** @covers \JKingWeb\Arsse\Database::feedUpdate */
public function testUpdateAFeed(): void { public function testUpdateAFeed(): void {
// update a valid feed with both new and changed items // update a valid feed with both new and changed items
Arsse::$db->feedUpdate(1); Arsse::$db->feedUpdate(1);
@ -263,21 +269,25 @@ trait SeriesFeed {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::feedUpdate */
public function testUpdateAMissingFeed(): void { public function testUpdateAMissingFeed(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->feedUpdate(2112); Arsse::$db->feedUpdate(2112);
} }
/** @covers \JKingWeb\Arsse\Database::feedUpdate */
public function testUpdateAnInvalidFeed(): void { public function testUpdateAnInvalidFeed(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->feedUpdate(-1); Arsse::$db->feedUpdate(-1);
} }
/** @covers \JKingWeb\Arsse\Database::feedUpdate */
public function testUpdateAFeedThrowingExceptions(): void { public function testUpdateAFeedThrowingExceptions(): void {
$this->assertException("invalidUrl", "Feed"); $this->assertException("invalidUrl", "Feed");
Arsse::$db->feedUpdate(3, true); Arsse::$db->feedUpdate(3, true);
} }
/** @covers \JKingWeb\Arsse\Database::feedUpdate */
public function testUpdateAFeedWithEnclosuresAndCategories(): void { public function testUpdateAFeedWithEnclosuresAndCategories(): void {
Arsse::$db->feedUpdate(5); Arsse::$db->feedUpdate(5);
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
@ -298,6 +308,7 @@ trait SeriesFeed {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::feedListStale */
public function testListStaleFeeds(): void { public function testListStaleFeeds(): void {
$this->assertEquals([1,3,4], Arsse::$db->feedListStale()); $this->assertEquals([1,3,4], Arsse::$db->feedListStale());
Arsse::$db->feedUpdate(3); Arsse::$db->feedUpdate(3);
@ -305,6 +316,7 @@ trait SeriesFeed {
$this->assertEquals([1], Arsse::$db->feedListStale()); $this->assertEquals([1], Arsse::$db->feedListStale());
} }
/** @covers \JKingWeb\Arsse\Database::feedUpdate */
public function testCheckIconDuringFeedUpdate(): void { public function testCheckIconDuringFeedUpdate(): void {
Arsse::$db->feedUpdate(6); Arsse::$db->feedUpdate(6);
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
@ -314,6 +326,7 @@ trait SeriesFeed {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::feedUpdate */
public function testAssignIconDuringFeedUpdate(): void { public function testAssignIconDuringFeedUpdate(): void {
Arsse::$db->feedUpdate(7); Arsse::$db->feedUpdate(7);
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
@ -324,6 +337,7 @@ trait SeriesFeed {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::feedUpdate */
public function testChangeIconDuringFeedUpdate(): void { public function testChangeIconDuringFeedUpdate(): void {
Arsse::$db->feedUpdate(8); Arsse::$db->feedUpdate(8);
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
@ -334,6 +348,7 @@ trait SeriesFeed {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::feedUpdate */
public function testAddIconDuringFeedUpdate(): void { public function testAddIconDuringFeedUpdate(): void {
Arsse::$db->feedUpdate(9); Arsse::$db->feedUpdate(9);
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
@ -344,4 +359,21 @@ trait SeriesFeed {
$state['arsse_icons']['rows'][] = [4,'http://localhost:8000/Icon/SVG2','image/svg+xml','<svg xmlns="http://www.w3.org/2000/svg" width="900" height="600"><rect width="900" height="600" fill="#ED2939"/><rect width="600" height="600" fill="#fff"/><rect width="300" height="600" fill="#002395"/></svg>']; $state['arsse_icons']['rows'][] = [4,'http://localhost:8000/Icon/SVG2','image/svg+xml','<svg xmlns="http://www.w3.org/2000/svg" width="900" height="600"><rect width="900" height="600" fill="#ED2939"/><rect width="600" height="600" fill="#fff"/><rect width="300" height="600" fill="#002395"/></svg>'];
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::feedUpdate */
public function testUpdateUnmodifiedFeed(): void {
$this->markTestIncomplete("FIXME: there is a bug here around calculation of nextFetch date");
$state = $this->primeExpectations($this->data, [
'arsse_icons' => ["id", "url", "type", "data"],
'arsse_feeds' => ["id", "url", "title", "err_count", "err_msg", "modified", "next_fetch", "size", "icon"],
'arsse_subscriptions' => ["id", "owner", "feed", "keep_rule", "block_rule"],
'arsse_articles' => ["id", "feed", "url", "title", "author", "published", "edited", "content", "guid", "url_title_hash", "url_content_hash", "title_content_hash", "modified"],
'arsse_editions' => ["id", "article", "modified"],
'arsse_marks' => ["article", "subscription", "read", "starred", "hidden", "modified"],
'arsse_enclosures' => ["article", "url", "type"],
'arsse_categories' => ["article", "name"],
]);
Arsse::$db->feedUpdate(4);
$this->compareExpectations(static::$drv, $state);
}
} }

View file

@ -99,6 +99,11 @@ trait SeriesFolder {
unset($this->data); unset($this->data);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderAdd
* @covers \JKingWeb\Arsse\Database::folderValidateId
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testAddARootFolder(): void { public function testAddARootFolder(): void {
$user = "john.doe@example.com"; $user = "john.doe@example.com";
$folderID = $this->nextID("arsse_folders"); $folderID = $this->nextID("arsse_folders");
@ -108,11 +113,21 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderAdd
* @covers \JKingWeb\Arsse\Database::folderValidateId
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testAddADuplicateRootFolder(): void { public function testAddADuplicateRootFolder(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Politics"]); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Politics"]);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderAdd
* @covers \JKingWeb\Arsse\Database::folderValidateId
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testAddANestedFolder(): void { public function testAddANestedFolder(): void {
$user = "john.doe@example.com"; $user = "john.doe@example.com";
$folderID = $this->nextID("arsse_folders"); $folderID = $this->nextID("arsse_folders");
@ -122,36 +137,70 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderAdd
* @covers \JKingWeb\Arsse\Database::folderValidateId
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testAddANestedFolderToAMissingParent(): void { public function testAddANestedFolderToAMissingParent(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => 2112]); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => 2112]);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderAdd
* @covers \JKingWeb\Arsse\Database::folderValidateId
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testAddANestedFolderToAnInvalidParent(): void { public function testAddANestedFolderToAnInvalidParent(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => "stringFolderId"]); Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => "stringFolderId"]);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderAdd
* @covers \JKingWeb\Arsse\Database::folderValidateId
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testAddANestedFolderForTheWrongOwner(): void { public function testAddANestedFolderForTheWrongOwner(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => 4]); // folder ID 4 belongs to Jane Arsse::$db->folderAdd("john.doe@example.com", ['name' => "Sociology", 'parent' => 4]); // folder ID 4 belongs to Jane
} }
/**
* @covers \JKingWeb\Arsse\Database::folderAdd
* @covers \JKingWeb\Arsse\Database::folderValidateId
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testAddAFolderWithAMissingName(): void { public function testAddAFolderWithAMissingName(): void {
$this->assertException("missing", "Db", "ExceptionInput"); $this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", []); Arsse::$db->folderAdd("john.doe@example.com", []);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderAdd
* @covers \JKingWeb\Arsse\Database::folderValidateId
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testAddAFolderWithABlankName(): void { public function testAddAFolderWithABlankName(): void {
$this->assertException("missing", "Db", "ExceptionInput"); $this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => ""]); Arsse::$db->folderAdd("john.doe@example.com", ['name' => ""]);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderAdd
* @covers \JKingWeb\Arsse\Database::folderValidateId
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testAddAFolderWithAWhitespaceName(): void { public function testAddAFolderWithAWhitespaceName(): void {
$this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertException("whitespace", "Db", "ExceptionInput");
Arsse::$db->folderAdd("john.doe@example.com", ['name' => " "]); Arsse::$db->folderAdd("john.doe@example.com", ['name' => " "]);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderList
* @covers \JKingWeb\Arsse\Database::folderValidateId
*/
public function testListRootFolders(): void { public function testListRootFolders(): void {
$exp = [ $exp = [
['id' => 5, 'name' => "Politics", 'parent' => null, 'children' => 0, 'feeds' => 2], ['id' => 5, 'name' => "Politics", 'parent' => null, 'children' => 0, 'feeds' => 2],
@ -166,6 +215,10 @@ trait SeriesFolder {
$this->assertResult($exp, Arsse::$db->folderList("admin@example.net", null, false)); $this->assertResult($exp, Arsse::$db->folderList("admin@example.net", null, false));
} }
/**
* @covers \JKingWeb\Arsse\Database::folderList
* @covers \JKingWeb\Arsse\Database::folderValidateId
*/
public function testListFoldersRecursively(): void { public function testListFoldersRecursively(): void {
$exp = [ $exp = [
['id' => 5, 'name' => "Politics", 'parent' => null, 'children' => 0, 'feeds' => 2], ['id' => 5, 'name' => "Politics", 'parent' => null, 'children' => 0, 'feeds' => 2],
@ -185,16 +238,25 @@ trait SeriesFolder {
$this->assertResult($exp, Arsse::$db->folderList("jane.doe@example.com", 4, true)); $this->assertResult($exp, Arsse::$db->folderList("jane.doe@example.com", 4, true));
} }
/**
* @covers \JKingWeb\Arsse\Database::folderList
* @covers \JKingWeb\Arsse\Database::folderValidateId
*/
public function testListFoldersOfAMissingParent(): void { public function testListFoldersOfAMissingParent(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderList("john.doe@example.com", 2112); Arsse::$db->folderList("john.doe@example.com", 2112);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderList
* @covers \JKingWeb\Arsse\Database::folderValidateId
*/
public function testListFoldersOfTheWrongOwner(): void { public function testListFoldersOfTheWrongOwner(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderList("john.doe@example.com", 4); // folder ID 4 belongs to Jane Arsse::$db->folderList("john.doe@example.com", 4); // folder ID 4 belongs to Jane
} }
/** @covers \JKingWeb\Arsse\Database::folderRemove */
public function testRemoveAFolder(): void { public function testRemoveAFolder(): void {
$this->assertTrue(Arsse::$db->folderRemove("john.doe@example.com", 6)); $this->assertTrue(Arsse::$db->folderRemove("john.doe@example.com", 6));
$state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]);
@ -202,6 +264,7 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::folderRemove */
public function testRemoveAFolderTree(): void { public function testRemoveAFolderTree(): void {
$this->assertTrue(Arsse::$db->folderRemove("john.doe@example.com", 1)); $this->assertTrue(Arsse::$db->folderRemove("john.doe@example.com", 1));
$state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]);
@ -211,21 +274,25 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::folderRemove */
public function testRemoveAMissingFolder(): void { public function testRemoveAMissingFolder(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderRemove("john.doe@example.com", 2112); Arsse::$db->folderRemove("john.doe@example.com", 2112);
} }
/** @covers \JKingWeb\Arsse\Database::folderRemove */
public function testRemoveAnInvalidFolder(): void { public function testRemoveAnInvalidFolder(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->folderRemove("john.doe@example.com", -1); Arsse::$db->folderRemove("john.doe@example.com", -1);
} }
/** @covers \JKingWeb\Arsse\Database::folderRemove */
public function testRemoveAFolderOfTheWrongOwner(): void { public function testRemoveAFolderOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderRemove("john.doe@example.com", 4); // folder ID 4 belongs to Jane Arsse::$db->folderRemove("john.doe@example.com", 4); // folder ID 4 belongs to Jane
} }
/** @covers \JKingWeb\Arsse\Database::folderPropertiesGet */
public function testGetThePropertiesOfAFolder(): void { public function testGetThePropertiesOfAFolder(): void {
$exp = [ $exp = [
'id' => 6, 'id' => 6,
@ -235,25 +302,33 @@ trait SeriesFolder {
$this->assertArraySubset($exp, Arsse::$db->folderPropertiesGet("john.doe@example.com", 6)); $this->assertArraySubset($exp, Arsse::$db->folderPropertiesGet("john.doe@example.com", 6));
} }
/** @covers \JKingWeb\Arsse\Database::folderPropertiesGet */
public function testGetThePropertiesOfAMissingFolder(): void { public function testGetThePropertiesOfAMissingFolder(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesGet("john.doe@example.com", 2112); Arsse::$db->folderPropertiesGet("john.doe@example.com", 2112);
} }
/** @covers \JKingWeb\Arsse\Database::folderPropertiesGet */
public function testGetThePropertiesOfAnInvalidFolder(): void { public function testGetThePropertiesOfAnInvalidFolder(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesGet("john.doe@example.com", -1); Arsse::$db->folderPropertiesGet("john.doe@example.com", -1);
} }
/** @covers \JKingWeb\Arsse\Database::folderPropertiesGet */
public function testGetThePropertiesOfAFolderOfTheWrongOwner(): void { public function testGetThePropertiesOfAFolderOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesGet("john.doe@example.com", 4); // folder ID 4 belongs to Jane Arsse::$db->folderPropertiesGet("john.doe@example.com", 4); // folder ID 4 belongs to Jane
} }
/** @covers \JKingWeb\Arsse\Database::folderPropertiesSet */
public function testMakeNoChangesToAFolder(): void { public function testMakeNoChangesToAFolder(): void {
$this->assertFalse(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, [])); $this->assertFalse(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, []));
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testRenameAFolder(): void { public function testRenameAFolder(): void {
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => "Opinion"])); $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => "Opinion"]));
$state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]);
@ -261,25 +336,45 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testRenameTheRootFolder(): void { public function testRenameTheRootFolder(): void {
$this->assertFalse(Arsse::$db->folderPropertiesSet("john.doe@example.com", null, ['name' => "Opinion"])); $this->assertFalse(Arsse::$db->folderPropertiesSet("john.doe@example.com", null, ['name' => "Opinion"]));
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testRenameAFolderToTheEmptyString(): void { public function testRenameAFolderToTheEmptyString(): void {
$this->assertException("missing", "Db", "ExceptionInput"); $this->assertException("missing", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => ""])); $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => ""]));
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testRenameAFolderToWhitespaceOnly(): void { public function testRenameAFolderToWhitespaceOnly(): void {
$this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertException("whitespace", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => " "])); $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => " "]));
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateName
*/
public function testRenameAFolderToAnInvalidValue(): void { public function testRenameAFolderToAnInvalidValue(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => []])); $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['name' => []]));
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateMove
*/
public function testMoveAFolder(): void { public function testMoveAFolder(): void {
$this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => 5])); $this->assertTrue(Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => 5]));
$state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]); $state = $this->primeExpectations($this->data, ['arsse_folders' => ['id','owner', 'parent', 'name']]);
@ -287,51 +382,83 @@ trait SeriesFolder {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateMove
*/
public function testMoveTheRootFolder(): void { public function testMoveTheRootFolder(): void {
$this->assertException("circularDependence", "Db", "ExceptionInput"); $this->assertException("circularDependence", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 0, ['parent' => 1]); Arsse::$db->folderPropertiesSet("john.doe@example.com", 0, ['parent' => 1]);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateMove
*/
public function testMoveAFolderToItsDescendant(): void { public function testMoveAFolderToItsDescendant(): void {
$this->assertException("circularDependence", "Db", "ExceptionInput"); $this->assertException("circularDependence", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 3]); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 3]);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateMove
*/
public function testMoveAFolderToItself(): void { public function testMoveAFolderToItself(): void {
$this->assertException("circularDependence", "Db", "ExceptionInput"); $this->assertException("circularDependence", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 1]); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 1]);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateMove
*/
public function testMoveAFolderToAMissingParent(): void { public function testMoveAFolderToAMissingParent(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 2112]); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => 2112]);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateMove
*/
public function testMoveAFolderToAnInvalidParent(): void { public function testMoveAFolderToAnInvalidParent(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => "ThisFolderDoesNotExist"]); Arsse::$db->folderPropertiesSet("john.doe@example.com", 1, ['parent' => "ThisFolderDoesNotExist"]);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateMove
*/
public function testCauseAFolderCollision(): void { public function testCauseAFolderCollision(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => null]); Arsse::$db->folderPropertiesSet("john.doe@example.com", 6, ['parent' => null]);
} }
/**
* @covers \JKingWeb\Arsse\Database::folderPropertiesSet
* @covers \JKingWeb\Arsse\Database::folderValidateName
* @covers \JKingWeb\Arsse\Database::folderValidateMove
*/
public function testCauseACompoundFolderCollision(): void { public function testCauseACompoundFolderCollision(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 3, ['parent' => null, 'name' => "Technology"]); Arsse::$db->folderPropertiesSet("john.doe@example.com", 3, ['parent' => null, 'name' => "Technology"]);
} }
/** @covers \JKingWeb\Arsse\Database::folderPropertiesSet */
public function testSetThePropertiesOfAMissingFolder(): void { public function testSetThePropertiesOfAMissingFolder(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 2112, ['parent' => null]); Arsse::$db->folderPropertiesSet("john.doe@example.com", 2112, ['parent' => null]);
} }
/** @covers \JKingWeb\Arsse\Database::folderPropertiesSet */
public function testSetThePropertiesOfAnInvalidFolder(): void { public function testSetThePropertiesOfAnInvalidFolder(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", -1, ['parent' => null]); Arsse::$db->folderPropertiesSet("john.doe@example.com", -1, ['parent' => null]);
} }
/** @covers \JKingWeb\Arsse\Database::folderPropertiesSet */
public function testSetThePropertiesOfAFolderForTheWrongOwner(): void { public function testSetThePropertiesOfAFolderForTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->folderPropertiesSet("john.doe@example.com", 4, ['parent' => null]); // folder ID 4 belongs to Jane Arsse::$db->folderPropertiesSet("john.doe@example.com", 4, ['parent' => null]); // folder ID 4 belongs to Jane

View file

@ -83,6 +83,7 @@ trait SeriesIcon {
unset($this->data); unset($this->data);
} }
/** @covers \JKingWeb\Arsse\Database::iconList */
public function testListTheIconsOfAUser() { public function testListTheIconsOfAUser() {
$exp = [ $exp = [
['id' => 1,'url' => 'http://localhost:8000/Icon/PNG', 'type' => 'image/png', 'data' => base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAADUlEQVQYV2NgYGBgAAAABQABijPjAAAAAABJRU5ErkJggg==")], ['id' => 1,'url' => 'http://localhost:8000/Icon/PNG', 'type' => 'image/png', 'data' => base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAADUlEQVQYV2NgYGBgAAAABQABijPjAAAAAABJRU5ErkJggg==")],

View file

@ -255,6 +255,10 @@ trait SeriesLabel {
unset($this->data, $this->checkLabels, $this->checkMembers, $this->user); unset($this->data, $this->checkLabels, $this->checkMembers, $this->user);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelAdd
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testAddALabel(): void { public function testAddALabel(): void {
$user = "john.doe@example.com"; $user = "john.doe@example.com";
$labelID = $this->nextID("arsse_labels"); $labelID = $this->nextID("arsse_labels");
@ -264,26 +268,43 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelAdd
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testAddADuplicateLabel(): void { public function testAddADuplicateLabel(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->labelAdd("john.doe@example.com", ['name' => "Interesting"]); Arsse::$db->labelAdd("john.doe@example.com", ['name' => "Interesting"]);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelAdd
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testAddALabelWithAMissingName(): void { public function testAddALabelWithAMissingName(): void {
$this->assertException("missing", "Db", "ExceptionInput"); $this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->labelAdd("john.doe@example.com", []); Arsse::$db->labelAdd("john.doe@example.com", []);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelAdd
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testAddALabelWithABlankName(): void { public function testAddALabelWithABlankName(): void {
$this->assertException("missing", "Db", "ExceptionInput"); $this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->labelAdd("john.doe@example.com", ['name' => ""]); Arsse::$db->labelAdd("john.doe@example.com", ['name' => ""]);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelAdd
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testAddALabelWithAWhitespaceName(): void { public function testAddALabelWithAWhitespaceName(): void {
$this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertException("whitespace", "Db", "ExceptionInput");
Arsse::$db->labelAdd("john.doe@example.com", ['name' => " "]); Arsse::$db->labelAdd("john.doe@example.com", ['name' => " "]);
} }
/** @covers \JKingWeb\Arsse\Database::labelList */
public function testListLabels(): void { public function testListLabels(): void {
$exp = [ $exp = [
['id' => 2, 'name' => "Fascinating", 'articles' => 3, 'read' => 1], ['id' => 2, 'name' => "Fascinating", 'articles' => 3, 'read' => 1],
@ -299,6 +320,10 @@ trait SeriesLabel {
$this->assertResult($exp, Arsse::$db->labelList("jane.doe@example.com", false)); $this->assertResult($exp, Arsse::$db->labelList("jane.doe@example.com", false));
} }
/**
* @covers \JKingWeb\Arsse\Database::labelRemove
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testRemoveALabel(): void { public function testRemoveALabel(): void {
$this->assertTrue(Arsse::$db->labelRemove("john.doe@example.com", 1)); $this->assertTrue(Arsse::$db->labelRemove("john.doe@example.com", 1));
$state = $this->primeExpectations($this->data, $this->checkLabels); $state = $this->primeExpectations($this->data, $this->checkLabels);
@ -306,6 +331,10 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelRemove
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testRemoveALabelByName(): void { public function testRemoveALabelByName(): void {
$this->assertTrue(Arsse::$db->labelRemove("john.doe@example.com", "Interesting", true)); $this->assertTrue(Arsse::$db->labelRemove("john.doe@example.com", "Interesting", true));
$state = $this->primeExpectations($this->data, $this->checkLabels); $state = $this->primeExpectations($this->data, $this->checkLabels);
@ -313,26 +342,46 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelRemove
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testRemoveAMissingLabel(): void { public function testRemoveAMissingLabel(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelRemove("john.doe@example.com", 2112); Arsse::$db->labelRemove("john.doe@example.com", 2112);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelRemove
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testRemoveAnInvalidLabel(): void { public function testRemoveAnInvalidLabel(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelRemove("john.doe@example.com", -1); Arsse::$db->labelRemove("john.doe@example.com", -1);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelRemove
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testRemoveAnInvalidLabelByName(): void { public function testRemoveAnInvalidLabelByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelRemove("john.doe@example.com", [], true); Arsse::$db->labelRemove("john.doe@example.com", [], true);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelRemove
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testRemoveALabelOfTheWrongOwner(): void { public function testRemoveALabelOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelRemove("john.doe@example.com", 3); // label ID 3 belongs to Jane Arsse::$db->labelRemove("john.doe@example.com", 3); // label ID 3 belongs to Jane
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesGet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testGetThePropertiesOfALabel(): void { public function testGetThePropertiesOfALabel(): void {
$exp = [ $exp = [
'id' => 2, 'id' => 2,
@ -344,30 +393,56 @@ trait SeriesLabel {
$this->assertArraySubset($exp, Arsse::$db->labelPropertiesGet("john.doe@example.com", "Fascinating", true)); $this->assertArraySubset($exp, Arsse::$db->labelPropertiesGet("john.doe@example.com", "Fascinating", true));
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesGet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testGetThePropertiesOfAMissingLabel(): void { public function testGetThePropertiesOfAMissingLabel(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesGet("john.doe@example.com", 2112); Arsse::$db->labelPropertiesGet("john.doe@example.com", 2112);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesGet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testGetThePropertiesOfAnInvalidLabel(): void { public function testGetThePropertiesOfAnInvalidLabel(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesGet("john.doe@example.com", -1); Arsse::$db->labelPropertiesGet("john.doe@example.com", -1);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesGet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testGetThePropertiesOfAnInvalidLabelByName(): void { public function testGetThePropertiesOfAnInvalidLabelByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesGet("john.doe@example.com", [], true); Arsse::$db->labelPropertiesGet("john.doe@example.com", [], true);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesGet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testGetThePropertiesOfALabelOfTheWrongOwner(): void { public function testGetThePropertiesOfALabelOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesGet("john.doe@example.com", 3); // label ID 3 belongs to Jane Arsse::$db->labelPropertiesGet("john.doe@example.com", 3); // label ID 3 belongs to Jane
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testMakeNoChangesToALabel(): void { public function testMakeNoChangesToALabel(): void {
$this->assertFalse(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, [])); $this->assertFalse(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, []));
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testRenameALabel(): void { public function testRenameALabel(): void {
$this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Curious"])); $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Curious"]));
$state = $this->primeExpectations($this->data, $this->checkLabels); $state = $this->primeExpectations($this->data, $this->checkLabels);
@ -375,6 +450,11 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testRenameALabelByName(): void { public function testRenameALabelByName(): void {
$this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", "Interesting", ['name' => "Curious"], true)); $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", "Interesting", ['name' => "Curious"], true));
$state = $this->primeExpectations($this->data, $this->checkLabels); $state = $this->primeExpectations($this->data, $this->checkLabels);
@ -382,46 +462,90 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testRenameALabelToTheEmptyString(): void { public function testRenameALabelToTheEmptyString(): void {
$this->assertException("missing", "Db", "ExceptionInput"); $this->assertException("missing", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => ""])); $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => ""]));
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testRenameALabelToWhitespaceOnly(): void { public function testRenameALabelToWhitespaceOnly(): void {
$this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertException("whitespace", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => " "])); $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => " "]));
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testRenameALabelToAnInvalidValue(): void { public function testRenameALabelToAnInvalidValue(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => []])); $this->assertTrue(Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => []]));
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testCauseALabelCollision(): void { public function testCauseALabelCollision(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Fascinating"]); Arsse::$db->labelPropertiesSet("john.doe@example.com", 1, ['name' => "Fascinating"]);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testSetThePropertiesOfAMissingLabel(): void { public function testSetThePropertiesOfAMissingLabel(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesSet("john.doe@example.com", 2112, ['name' => "Exciting"]); Arsse::$db->labelPropertiesSet("john.doe@example.com", 2112, ['name' => "Exciting"]);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testSetThePropertiesOfAnInvalidLabel(): void { public function testSetThePropertiesOfAnInvalidLabel(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesSet("john.doe@example.com", -1, ['name' => "Exciting"]); Arsse::$db->labelPropertiesSet("john.doe@example.com", -1, ['name' => "Exciting"]);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testSetThePropertiesOfAnInvalidLabelByName(): void { public function testSetThePropertiesOfAnInvalidLabelByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesSet("john.doe@example.com", [], ['name' => "Exciting"], true); Arsse::$db->labelPropertiesSet("john.doe@example.com", [], ['name' => "Exciting"], true);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelPropertiesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
* @covers \JKingWeb\Arsse\Database::labelValidateName
*/
public function testSetThePropertiesOfALabelForTheWrongOwner(): void { public function testSetThePropertiesOfALabelForTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelPropertiesSet("john.doe@example.com", 3, ['name' => "Exciting"]); // label ID 3 belongs to Jane Arsse::$db->labelPropertiesSet("john.doe@example.com", 3, ['name' => "Exciting"]); // label ID 3 belongs to Jane
} }
/**
* @covers \JKingWeb\Arsse\Database::labelArticlesGet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testListLabelledArticles(): void { public function testListLabelledArticles(): void {
$exp = [1,19]; $exp = [1,19];
$this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", 1)); $this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", 1));
@ -434,16 +558,28 @@ trait SeriesLabel {
$this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", "Lonely", true)); $this->assertEquals($exp, Arsse::$db->labelArticlesGet("john.doe@example.com", "Lonely", true));
} }
/**
* @covers \JKingWeb\Arsse\Database::labelArticlesGet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testListLabelledArticlesForAMissingLabel(): void { public function testListLabelledArticlesForAMissingLabel(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->labelArticlesGet("john.doe@example.com", 3); Arsse::$db->labelArticlesGet("john.doe@example.com", 3);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelArticlesGet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testListLabelledArticlesForAnInvalidLabel(): void { public function testListLabelledArticlesForAnInvalidLabel(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->labelArticlesGet("john.doe@example.com", -1); Arsse::$db->labelArticlesGet("john.doe@example.com", -1);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelArticlesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testApplyALabelToArticles(): void { public function testApplyALabelToArticles(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5])); Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5]));
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
@ -452,6 +588,10 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelArticlesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testClearALabelFromArticles(): void { public function testClearALabelFromArticles(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([1,5]), Database::ASSOC_REMOVE); Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([1,5]), Database::ASSOC_REMOVE);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
@ -459,6 +599,10 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelArticlesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
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); 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 = $this->primeExpectations($this->data, $this->checkMembers);
@ -467,6 +611,10 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelArticlesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
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); 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 = $this->primeExpectations($this->data, $this->checkMembers);
@ -474,18 +622,30 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelArticlesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testApplyALabelToNoArticles(): void { public function testApplyALabelToNoArticles(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000])); Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]));
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelArticlesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testClearALabelFromNoArticles(): void { public function testClearALabelFromNoArticles(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]), Database::ASSOC_REMOVE); Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]), Database::ASSOC_REMOVE);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelArticlesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testReplaceArticlesOfALabel(): void { public function testReplaceArticlesOfALabel(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5]), Database::ASSOC_REPLACE); Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([2,5]), Database::ASSOC_REPLACE);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
@ -496,6 +656,10 @@ trait SeriesLabel {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::labelArticlesSet
* @covers \JKingWeb\Arsse\Database::labelValidateId
*/
public function testPurgeArticlesOfALabel(): void { public function testPurgeArticlesOfALabel(): void {
Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]), Database::ASSOC_REPLACE); Arsse::$db->labelArticlesSet("john.doe@example.com", 1, (new Context)->articles([10000]), Database::ASSOC_REPLACE);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);

View file

@ -36,6 +36,7 @@ trait SeriesMeta {
unset($this->data); unset($this->data);
} }
/** @covers \JKingWeb\Arsse\Database::metaSet */
public function testAddANewValue(): void { public function testAddANewValue(): void {
$this->assertTrue(Arsse::$db->metaSet("favourite", "Cygnus X-1")); $this->assertTrue(Arsse::$db->metaSet("favourite", "Cygnus X-1"));
$state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]); $state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]);
@ -43,6 +44,7 @@ trait SeriesMeta {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::metaSet */
public function testAddANewTypedValue(): void { public function testAddANewTypedValue(): void {
$this->assertTrue(Arsse::$db->metaSet("answer", 42, "int")); $this->assertTrue(Arsse::$db->metaSet("answer", 42, "int"));
$this->assertTrue(Arsse::$db->metaSet("true", true, "bool")); $this->assertTrue(Arsse::$db->metaSet("true", true, "bool"));
@ -56,6 +58,7 @@ trait SeriesMeta {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::metaSet */
public function testChangeAnExistingValue(): void { public function testChangeAnExistingValue(): void {
$this->assertTrue(Arsse::$db->metaSet("album", "Hemispheres")); $this->assertTrue(Arsse::$db->metaSet("album", "Hemispheres"));
$state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]); $state = $this->primeExpectations($this->data, ['arsse_meta' => ['key','value']]);
@ -63,6 +66,7 @@ trait SeriesMeta {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::metaRemove */
public function testRemoveAValue(): void { public function testRemoveAValue(): void {
$this->assertTrue(Arsse::$db->metaRemove("album")); $this->assertTrue(Arsse::$db->metaRemove("album"));
$this->assertFalse(Arsse::$db->metaRemove("album")); $this->assertFalse(Arsse::$db->metaRemove("album"));
@ -71,6 +75,7 @@ trait SeriesMeta {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::metaGet */
public function testRetrieveAValue(): void { public function testRetrieveAValue(): void {
$this->assertSame("".Database::SCHEMA_VERSION, Arsse::$db->metaGet("schema_version")); $this->assertSame("".Database::SCHEMA_VERSION, Arsse::$db->metaGet("schema_version"));
$this->assertSame("A Farewell to Kings", Arsse::$db->metaGet("album")); $this->assertSame("A Farewell to Kings", Arsse::$db->metaGet("album"));

View file

@ -20,12 +20,22 @@ trait SeriesMiscellany {
protected function tearDownSeriesMiscellany(): void { protected function tearDownSeriesMiscellany(): void {
} }
/**
* @covers \JKingWeb\Arsse\Database::__construct
* @covers \JKingWeb\Arsse\Database::driverSchemaVersion
* @covers \JKingWeb\Arsse\Database::driverSchemaUpdate
*/
public function testInitializeDatabase(): void { public function testInitializeDatabase(): void {
static::dbRaze(static::$drv); static::dbRaze(static::$drv);
$d = new Database(true); $d = new Database(true);
$this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion()); $this->assertSame(Database::SCHEMA_VERSION, $d->driverSchemaVersion());
} }
/**
* @covers \JKingWeb\Arsse\Database::__construct
* @covers \JKingWeb\Arsse\Database::driverSchemaVersion
* @covers \JKingWeb\Arsse\Database::driverSchemaUpdate
*/
public function testManuallyInitializeDatabase(): void { public function testManuallyInitializeDatabase(): void {
static::dbRaze(static::$drv); static::dbRaze(static::$drv);
$d = new Database(false); $d = new Database(false);
@ -35,10 +45,12 @@ trait SeriesMiscellany {
$this->assertFalse($d->driverSchemaUpdate()); $this->assertFalse($d->driverSchemaUpdate());
} }
/** @covers \JKingWeb\Arsse\Database::driverCharsetAcceptable */
public function testCheckCharacterSetAcceptability(): void { public function testCheckCharacterSetAcceptability(): void {
$this->assertIsBool(Arsse::$db->driverCharsetAcceptable()); $this->assertIsBool(Arsse::$db->driverCharsetAcceptable());
} }
/** @covers \JKingWeb\Arsse\Database::driverMaintenance */
public function testPerformMaintenance(): void { public function testPerformMaintenance(): void {
$this->assertTrue(Arsse::$db->driverMaintenance()); $this->assertTrue(Arsse::$db->driverMaintenance());
} }

View file

@ -55,6 +55,10 @@ trait SeriesSession {
unset($this->data); unset($this->data);
} }
/**
* @covers \JKingWeb\Arsse\Database::sessionResume
* @covers \JKingWeb\Arsse\Database::sessionExpiringSoon
*/
public function testResumeAValidSession(): void { public function testResumeAValidSession(): void {
$exp1 = [ $exp1 = [
'id' => "80fa94c1a11f11e78667001e673b2560", 'id' => "80fa94c1a11f11e78667001e673b2560",
@ -73,21 +77,34 @@ trait SeriesSession {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::sessionResume
* @covers \JKingWeb\Arsse\Database::sessionExpiringSoon
*/
public function testResumeAMissingSession(): void { public function testResumeAMissingSession(): void {
$this->assertException("invalid", "User", "ExceptionSession"); $this->assertException("invalid", "User", "ExceptionSession");
Arsse::$db->sessionResume("thisSessionDoesNotExist"); Arsse::$db->sessionResume("thisSessionDoesNotExist");
} }
/**
* @covers \JKingWeb\Arsse\Database::sessionResume
* @covers \JKingWeb\Arsse\Database::sessionExpiringSoon
*/
public function testResumeAnExpiredSession(): void { public function testResumeAnExpiredSession(): void {
$this->assertException("invalid", "User", "ExceptionSession"); $this->assertException("invalid", "User", "ExceptionSession");
Arsse::$db->sessionResume("27c6de8da13311e78667001e673b2560"); Arsse::$db->sessionResume("27c6de8da13311e78667001e673b2560");
} }
/**
* @covers \JKingWeb\Arsse\Database::sessionResume
* @covers \JKingWeb\Arsse\Database::sessionExpiringSoon
*/
public function testResumeAStaleSession(): void { public function testResumeAStaleSession(): void {
$this->assertException("invalid", "User", "ExceptionSession"); $this->assertException("invalid", "User", "ExceptionSession");
Arsse::$db->sessionResume("ab3b3eb8a13311e78667001e673b2560"); Arsse::$db->sessionResume("ab3b3eb8a13311e78667001e673b2560");
} }
/** @covers \JKingWeb\Arsse\Database::sessionCreate */
public function testCreateASession(): void { public function testCreateASession(): void {
$user = "jane.doe@example.com"; $user = "jane.doe@example.com";
$id = Arsse::$db->sessionCreate($user); $id = Arsse::$db->sessionCreate($user);
@ -97,6 +114,7 @@ trait SeriesSession {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::sessionDestroy */
public function testDestroyASession(): void { public function testDestroyASession(): void {
$user = "jane.doe@example.com"; $user = "jane.doe@example.com";
$id = "80fa94c1a11f11e78667001e673b2560"; $id = "80fa94c1a11f11e78667001e673b2560";
@ -108,6 +126,7 @@ trait SeriesSession {
$this->assertFalse(Arsse::$db->sessionDestroy($user, $id)); $this->assertFalse(Arsse::$db->sessionDestroy($user, $id));
} }
/** @covers \JKingWeb\Arsse\Database::sessionDestroy */
public function testDestroyAllSessions(): void { public function testDestroyAllSessions(): void {
$user = "jane.doe@example.com"; $user = "jane.doe@example.com";
$this->assertTrue(Arsse::$db->sessionDestroy($user)); $this->assertTrue(Arsse::$db->sessionDestroy($user));
@ -118,6 +137,7 @@ trait SeriesSession {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::sessionDestroy */
public function testDestroyASessionForTheWrongUser(): void { public function testDestroyASessionForTheWrongUser(): void {
$user = "john.doe@example.com"; $user = "john.doe@example.com";
$id = "80fa94c1a11f11e78667001e673b2560"; $id = "80fa94c1a11f11e78667001e673b2560";

View file

@ -204,6 +204,10 @@ trait SeriesSubscription {
unset($this->data, $this->user); unset($this->data, $this->user);
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionAdd
* @covers \JKingWeb\Arsse\Database::feedAdd
*/
public function testAddASubscriptionToAnExistingFeed(): void { public function testAddASubscriptionToAnExistingFeed(): void {
$url = "http://example.com/feed1"; $url = "http://example.com/feed1";
$subID = $this->nextID("arsse_subscriptions"); $subID = $this->nextID("arsse_subscriptions");
@ -220,6 +224,10 @@ trait SeriesSubscription {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionAdd
* @covers \JKingWeb\Arsse\Database::feedAdd
*/
public function testAddASubscriptionToANewFeed(): void { public function testAddASubscriptionToANewFeed(): void {
$url = "http://example.org/feed1"; $url = "http://example.org/feed1";
$feedID = $this->nextID("arsse_feeds"); $feedID = $this->nextID("arsse_feeds");
@ -238,6 +246,10 @@ trait SeriesSubscription {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionAdd
* @covers \JKingWeb\Arsse\Database::feedAdd
*/
public function testAddASubscriptionToANewFeedViaDiscovery(): void { public function testAddASubscriptionToANewFeedViaDiscovery(): void {
$url = "http://localhost:8000/Feed/Discovery/Valid"; $url = "http://localhost:8000/Feed/Discovery/Valid";
$discovered = "http://localhost:8000/Feed/Discovery/Feed"; $discovered = "http://localhost:8000/Feed/Discovery/Feed";
@ -257,6 +269,10 @@ trait SeriesSubscription {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionAdd
* @covers \JKingWeb\Arsse\Database::feedAdd
*/
public function testAddASubscriptionToAnInvalidFeed(): void { public function testAddASubscriptionToAnInvalidFeed(): void {
$url = "http://example.org/feed1"; $url = "http://example.org/feed1";
$feedID = $this->nextID("arsse_feeds"); $feedID = $this->nextID("arsse_feeds");
@ -276,18 +292,30 @@ trait SeriesSubscription {
} }
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionAdd
* @covers \JKingWeb\Arsse\Database::feedAdd
*/
public function testAddADuplicateSubscription(): void { public function testAddADuplicateSubscription(): void {
$url = "http://example.com/feed2"; $url = "http://example.com/feed2";
$this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->subscriptionAdd($this->user, $url); Arsse::$db->subscriptionAdd($this->user, $url);
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionAdd
* @covers \JKingWeb\Arsse\Database::feedAdd
*/
public function testAddADuplicateSubscriptionWithEquivalentUrl(): void { public function testAddADuplicateSubscriptionWithEquivalentUrl(): void {
$url = "http://EXAMPLE.COM/feed2"; $url = "http://EXAMPLE.COM/feed2";
$this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->subscriptionAdd($this->user, $url); Arsse::$db->subscriptionAdd($this->user, $url);
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionAdd
* @covers \JKingWeb\Arsse\Database::feedAdd
*/
public function testAddADuplicateSubscriptionViaRedirection(): void { public function testAddADuplicateSubscriptionViaRedirection(): void {
$url = "http://localhost:8000/Feed/Parsing/Valid"; $url = "http://localhost:8000/Feed/Parsing/Valid";
Arsse::$db->subscriptionAdd($this->user, $url); Arsse::$db->subscriptionAdd($this->user, $url);
@ -296,6 +324,7 @@ trait SeriesSubscription {
$this->assertSame($subID, Arsse::$db->subscriptionAdd($this->user, $url)); $this->assertSame($subID, Arsse::$db->subscriptionAdd($this->user, $url));
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionRemove */
public function testRemoveASubscription(): void { public function testRemoveASubscription(): void {
$this->assertTrue(Arsse::$db->subscriptionRemove($this->user, 1)); $this->assertTrue(Arsse::$db->subscriptionRemove($this->user, 1));
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
@ -306,22 +335,29 @@ trait SeriesSubscription {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionRemove */
public function testRemoveAMissingSubscription(): void { public function testRemoveAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionRemove($this->user, 2112); Arsse::$db->subscriptionRemove($this->user, 2112);
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionRemove */
public function testRemoveAnInvalidSubscription(): void { public function testRemoveAnInvalidSubscription(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->subscriptionRemove($this->user, -1); Arsse::$db->subscriptionRemove($this->user, -1);
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionRemove */
public function testRemoveASubscriptionForTheWrongOwner(): void { public function testRemoveASubscriptionForTheWrongOwner(): void {
$this->user = "jane.doe@example.com"; $this->user = "jane.doe@example.com";
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionRemove($this->user, 1); Arsse::$db->subscriptionRemove($this->user, 1);
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionList
* @covers \JKingWeb\Arsse\Database::subscriptionPropertiesGet
*/
public function testListSubscriptions(): void { public function testListSubscriptions(): void {
$exp = [ $exp = [
[ [
@ -382,6 +418,7 @@ trait SeriesSubscription {
$this->assertResult($exp, Arsse::$db->subscriptionList("jill.doe@example.com")); $this->assertResult($exp, Arsse::$db->subscriptionList("jill.doe@example.com"));
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionList */
public function testListSubscriptionsInAFolder(): void { public function testListSubscriptionsInAFolder(): void {
$exp = [ $exp = [
[ [
@ -397,6 +434,7 @@ trait SeriesSubscription {
$this->assertResult($exp, Arsse::$db->subscriptionList($this->user, null, false)); $this->assertResult($exp, Arsse::$db->subscriptionList($this->user, null, false));
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionList */
public function testListSubscriptionsWithRecursion(): void { public function testListSubscriptionsWithRecursion(): void {
$exp = [ $exp = [
[ [
@ -412,31 +450,41 @@ trait SeriesSubscription {
$this->assertResult($exp, Arsse::$db->subscriptionList($this->user, 2)); $this->assertResult($exp, Arsse::$db->subscriptionList($this->user, 2));
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionList */
public function testListSubscriptionsInAMissingFolder(): void { public function testListSubscriptionsInAMissingFolder(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionList($this->user, 4); Arsse::$db->subscriptionList($this->user, 4);
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionCount */
public function testCountSubscriptions(): void { public function testCountSubscriptions(): void {
$this->assertSame(3, Arsse::$db->subscriptionCount($this->user)); $this->assertSame(3, Arsse::$db->subscriptionCount($this->user));
$this->assertSame(1, Arsse::$db->subscriptionCount($this->user, 2)); $this->assertSame(1, Arsse::$db->subscriptionCount($this->user, 2));
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionCount */
public function testCountSubscriptionsInAMissingFolder(): void { public function testCountSubscriptionsInAMissingFolder(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionCount($this->user, 4); Arsse::$db->subscriptionCount($this->user, 4);
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionPropertiesGet */
public function testGetThePropertiesOfAMissingSubscription(): void { public function testGetThePropertiesOfAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesGet($this->user, 2112); Arsse::$db->subscriptionPropertiesGet($this->user, 2112);
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionPropertiesGet */
public function testGetThePropertiesOfAnInvalidSubscription(): void { public function testGetThePropertiesOfAnInvalidSubscription(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesGet($this->user, -1); Arsse::$db->subscriptionPropertiesGet($this->user, -1);
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionPropertiesSet
* @covers \JKingWeb\Arsse\Database::subscriptionValidateId
* @covers \JKingWeb\Arsse\Database::subscriptionRulesApply
*/
public function testSetThePropertiesOfASubscription(): void { public function testSetThePropertiesOfASubscription(): void {
Arsse::$db->subscriptionPropertiesSet($this->user, 1, [ Arsse::$db->subscriptionPropertiesSet($this->user, 1, [
'title' => "Ook Ook", 'title' => "Ook Ook",
@ -465,16 +513,31 @@ trait SeriesSubscription {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionPropertiesSet
* @covers \JKingWeb\Arsse\Database::subscriptionValidateId
* @covers \JKingWeb\Arsse\Database::subscriptionRulesApply
*/
public function testMoveASubscriptionToAMissingFolder(): void { public function testMoveASubscriptionToAMissingFolder(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['folder' => 4]); Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['folder' => 4]);
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionPropertiesSet
* @covers \JKingWeb\Arsse\Database::subscriptionValidateId
* @covers \JKingWeb\Arsse\Database::subscriptionRulesApply
*/
public function testMoveASubscriptionToTheRootFolder(): void { public function testMoveASubscriptionToTheRootFolder(): void {
$this->assertTrue(Arsse::$db->subscriptionPropertiesSet($this->user, 3, ['folder' => null])); $this->assertTrue(Arsse::$db->subscriptionPropertiesSet($this->user, 3, ['folder' => null]));
} }
/** @dataProvider provideInvalidSubscriptionProperties */ /**
* @dataProvider provideInvalidSubscriptionProperties
* @covers \JKingWeb\Arsse\Database::subscriptionPropertiesSet
* @covers \JKingWeb\Arsse\Database::subscriptionValidateId
* @covers \JKingWeb\Arsse\Database::subscriptionRulesApply
*/
public function testSetThePropertiesOfASubscriptionToInvalidValues(array $data, string $exp): void { public function testSetThePropertiesOfASubscriptionToInvalidValues(array $data, string $exp): void {
$this->assertException($exp, "Db", "ExceptionInput"); $this->assertException($exp, "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesSet($this->user, 1, $data); Arsse::$db->subscriptionPropertiesSet($this->user, 1, $data);
@ -492,20 +555,36 @@ trait SeriesSubscription {
]; ];
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionPropertiesSet
* @covers \JKingWeb\Arsse\Database::subscriptionValidateId
* @covers \JKingWeb\Arsse\Database::subscriptionRulesApply
*/
public function testRenameASubscriptionToZero(): void { public function testRenameASubscriptionToZero(): void {
$this->assertTrue(Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => 0])); $this->assertTrue(Arsse::$db->subscriptionPropertiesSet($this->user, 1, ['title' => 0]));
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionPropertiesSet
* @covers \JKingWeb\Arsse\Database::subscriptionValidateId
* @covers \JKingWeb\Arsse\Database::subscriptionRulesApply
*/
public function testSetThePropertiesOfAMissingSubscription(): void { public function testSetThePropertiesOfAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesSet($this->user, 2112, ['folder' => null]); Arsse::$db->subscriptionPropertiesSet($this->user, 2112, ['folder' => null]);
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionPropertiesSet
* @covers \JKingWeb\Arsse\Database::subscriptionValidateId
* @covers \JKingWeb\Arsse\Database::subscriptionRulesApply
*/
public function testSetThePropertiesOfAnInvalidSubscription(): void { public function testSetThePropertiesOfAnInvalidSubscription(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->subscriptionPropertiesSet($this->user, -1, ['folder' => null]); Arsse::$db->subscriptionPropertiesSet($this->user, -1, ['folder' => null]);
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionIcon */
public function testRetrieveTheFaviconOfASubscription(): void { public function testRetrieveTheFaviconOfASubscription(): void {
$exp = "http://example.com/favicon.ico"; $exp = "http://example.com/favicon.ico";
$this->assertSame($exp, Arsse::$db->subscriptionIcon(null, 1)['url']); $this->assertSame($exp, Arsse::$db->subscriptionIcon(null, 1)['url']);
@ -513,11 +592,13 @@ trait SeriesSubscription {
$this->assertSame(null, Arsse::$db->subscriptionIcon(null, 6)); $this->assertSame(null, Arsse::$db->subscriptionIcon(null, 6));
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionIcon */
public function testRetrieveTheFaviconOfAMissingSubscription(): void { public function testRetrieveTheFaviconOfAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionIcon(null, -2112); Arsse::$db->subscriptionIcon(null, -2112);
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionIcon */
public function testRetrieveTheFaviconOfASubscriptionWithUser(): void { public function testRetrieveTheFaviconOfASubscriptionWithUser(): void {
$exp = "http://example.com/favicon.ico"; $exp = "http://example.com/favicon.ico";
$user = "john.doe@example.com"; $user = "john.doe@example.com";
@ -527,12 +608,14 @@ trait SeriesSubscription {
$this->assertSame($exp, Arsse::$db->subscriptionIcon($user, 2)['url']); $this->assertSame($exp, Arsse::$db->subscriptionIcon($user, 2)['url']);
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionIcon */
public function testRetrieveTheFaviconOfASubscriptionOfTheWrongUser(): void { public function testRetrieveTheFaviconOfASubscriptionOfTheWrongUser(): void {
$user = "john.doe@example.com"; $user = "john.doe@example.com";
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionIcon($user, 2); Arsse::$db->subscriptionIcon($user, 2);
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionTagsGet */
public function testListTheTagsOfASubscription(): void { public function testListTheTagsOfASubscription(): void {
$this->assertEquals([1,2], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 1)); $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([2], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 3));
@ -540,22 +623,30 @@ trait SeriesSubscription {
$this->assertEquals(["Fascinating"], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 3, true)); $this->assertEquals(["Fascinating"], Arsse::$db->subscriptionTagsGet("john.doe@example.com", 3, true));
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionTagsGet */
public function testListTheTagsOfAMissingSubscription(): void { public function testListTheTagsOfAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->subscriptionTagsGet($this->user, 101); Arsse::$db->subscriptionTagsGet($this->user, 101);
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionRefreshed */
public function testGetRefreshTimeOfASubscription(): void { public function testGetRefreshTimeOfASubscription(): void {
$user = "john.doe@example.com"; $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));
$this->assertTime(strtotime("now - 1 hour"), Arsse::$db->subscriptionRefreshed($user, 1)); $this->assertTime(strtotime("now - 1 hour"), Arsse::$db->subscriptionRefreshed($user, 1));
} }
/** @covers \JKingWeb\Arsse\Database::subscriptionRefreshed */
public function testGetRefreshTimeOfAMissingSubscription(): void { public function testGetRefreshTimeOfAMissingSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
$this->assertTime(strtotime("now - 1 hour"), Arsse::$db->subscriptionRefreshed("john.doe@example.com", 2)); $this->assertTime(strtotime("now - 1 hour"), Arsse::$db->subscriptionRefreshed("john.doe@example.com", 2));
} }
/**
* @covers \JKingWeb\Arsse\Database::subscriptionPropertiesSet
* @covers \JKingWeb\Arsse\Database::subscriptionValidateId
* @covers \JKingWeb\Arsse\Database::subscriptionRulesApply
*/
public function testSetTheFilterRulesOfASubscriptionCheckingMarks(): void { public function testSetTheFilterRulesOfASubscriptionCheckingMarks(): void {
Arsse::$db->subscriptionPropertiesSet("jack.doe@example.com", 5, ['keep_rule' => "1|B|3|D", 'block_rule' => "4"]); Arsse::$db->subscriptionPropertiesSet("jack.doe@example.com", 5, ['keep_rule' => "1|B|3|D", 'block_rule' => "4"]);
$state = $this->primeExpectations($this->data, ['arsse_marks' => ['article', 'subscription', 'hidden']]); $state = $this->primeExpectations($this->data, ['arsse_marks' => ['article', 'subscription', 'hidden']]);

View file

@ -113,6 +113,10 @@ trait SeriesTag {
unset($this->data, $this->checkTags, $this->checkMembers, $this->user); unset($this->data, $this->checkTags, $this->checkMembers, $this->user);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagAdd
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testAddATag(): void { public function testAddATag(): void {
$user = "john.doe@example.com"; $user = "john.doe@example.com";
$tagID = $this->nextID("arsse_tags"); $tagID = $this->nextID("arsse_tags");
@ -122,26 +126,43 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagAdd
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testAddADuplicateTag(): void { public function testAddADuplicateTag(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->tagAdd("john.doe@example.com", ['name' => "Interesting"]); Arsse::$db->tagAdd("john.doe@example.com", ['name' => "Interesting"]);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagAdd
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testAddATagWithAMissingName(): void { public function testAddATagWithAMissingName(): void {
$this->assertException("missing", "Db", "ExceptionInput"); $this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->tagAdd("john.doe@example.com", []); Arsse::$db->tagAdd("john.doe@example.com", []);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagAdd
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testAddATagWithABlankName(): void { public function testAddATagWithABlankName(): void {
$this->assertException("missing", "Db", "ExceptionInput"); $this->assertException("missing", "Db", "ExceptionInput");
Arsse::$db->tagAdd("john.doe@example.com", ['name' => ""]); Arsse::$db->tagAdd("john.doe@example.com", ['name' => ""]);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagAdd
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testAddATagWithAWhitespaceName(): void { public function testAddATagWithAWhitespaceName(): void {
$this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertException("whitespace", "Db", "ExceptionInput");
Arsse::$db->tagAdd("john.doe@example.com", ['name' => " "]); Arsse::$db->tagAdd("john.doe@example.com", ['name' => " "]);
} }
/** @covers \JKingWeb\Arsse\Database::tagList */
public function testListTags(): void { public function testListTags(): void {
$exp = [ $exp = [
['id' => 2, 'name' => "Fascinating"], ['id' => 2, 'name' => "Fascinating"],
@ -157,6 +178,10 @@ trait SeriesTag {
$this->assertResult($exp, Arsse::$db->tagList("jane.doe@example.com", false)); $this->assertResult($exp, Arsse::$db->tagList("jane.doe@example.com", false));
} }
/**
* @covers \JKingWeb\Arsse\Database::tagRemove
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testRemoveATag(): void { public function testRemoveATag(): void {
$this->assertTrue(Arsse::$db->tagRemove("john.doe@example.com", 1)); $this->assertTrue(Arsse::$db->tagRemove("john.doe@example.com", 1));
$state = $this->primeExpectations($this->data, $this->checkTags); $state = $this->primeExpectations($this->data, $this->checkTags);
@ -164,6 +189,10 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagRemove
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testRemoveATagByName(): void { public function testRemoveATagByName(): void {
$this->assertTrue(Arsse::$db->tagRemove("john.doe@example.com", "Interesting", true)); $this->assertTrue(Arsse::$db->tagRemove("john.doe@example.com", "Interesting", true));
$state = $this->primeExpectations($this->data, $this->checkTags); $state = $this->primeExpectations($this->data, $this->checkTags);
@ -171,26 +200,46 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagRemove
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testRemoveAMissingTag(): void { public function testRemoveAMissingTag(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagRemove("john.doe@example.com", 2112); Arsse::$db->tagRemove("john.doe@example.com", 2112);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagRemove
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testRemoveAnInvalidTag(): void { public function testRemoveAnInvalidTag(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagRemove("john.doe@example.com", -1); Arsse::$db->tagRemove("john.doe@example.com", -1);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagRemove
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testRemoveAnInvalidTagByName(): void { public function testRemoveAnInvalidTagByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagRemove("john.doe@example.com", [], true); Arsse::$db->tagRemove("john.doe@example.com", [], true);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagRemove
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testRemoveATagOfTheWrongOwner(): void { public function testRemoveATagOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagRemove("john.doe@example.com", 3); // tag ID 3 belongs to Jane Arsse::$db->tagRemove("john.doe@example.com", 3); // tag ID 3 belongs to Jane
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesGet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testGetThePropertiesOfATag(): void { public function testGetThePropertiesOfATag(): void {
$exp = [ $exp = [
'id' => 2, 'id' => 2,
@ -200,30 +249,56 @@ trait SeriesTag {
$this->assertArraySubset($exp, Arsse::$db->tagPropertiesGet("john.doe@example.com", "Fascinating", true)); $this->assertArraySubset($exp, Arsse::$db->tagPropertiesGet("john.doe@example.com", "Fascinating", true));
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesGet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testGetThePropertiesOfAMissingTag(): void { public function testGetThePropertiesOfAMissingTag(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesGet("john.doe@example.com", 2112); Arsse::$db->tagPropertiesGet("john.doe@example.com", 2112);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesGet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testGetThePropertiesOfAnInvalidTag(): void { public function testGetThePropertiesOfAnInvalidTag(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesGet("john.doe@example.com", -1); Arsse::$db->tagPropertiesGet("john.doe@example.com", -1);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesGet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testGetThePropertiesOfAnInvalidTagByName(): void { public function testGetThePropertiesOfAnInvalidTagByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesGet("john.doe@example.com", [], true); Arsse::$db->tagPropertiesGet("john.doe@example.com", [], true);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesGet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testGetThePropertiesOfATagOfTheWrongOwner(): void { public function testGetThePropertiesOfATagOfTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesGet("john.doe@example.com", 3); // tag ID 3 belongs to Jane Arsse::$db->tagPropertiesGet("john.doe@example.com", 3); // tag ID 3 belongs to Jane
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testMakeNoChangesToATag(): void { public function testMakeNoChangesToATag(): void {
$this->assertFalse(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, [])); $this->assertFalse(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, []));
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testRenameATag(): void { public function testRenameATag(): void {
$this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Curious"])); $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Curious"]));
$state = $this->primeExpectations($this->data, $this->checkTags); $state = $this->primeExpectations($this->data, $this->checkTags);
@ -231,6 +306,11 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testRenameATagByName(): void { public function testRenameATagByName(): void {
$this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", "Interesting", ['name' => "Curious"], true)); $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", "Interesting", ['name' => "Curious"], true));
$state = $this->primeExpectations($this->data, $this->checkTags); $state = $this->primeExpectations($this->data, $this->checkTags);
@ -238,46 +318,90 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testRenameATagToTheEmptyString(): void { public function testRenameATagToTheEmptyString(): void {
$this->assertException("missing", "Db", "ExceptionInput"); $this->assertException("missing", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => ""])); $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => ""]));
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testRenameATagToWhitespaceOnly(): void { public function testRenameATagToWhitespaceOnly(): void {
$this->assertException("whitespace", "Db", "ExceptionInput"); $this->assertException("whitespace", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => " "])); $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => " "]));
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testRenameATagToAnInvalidValue(): void { public function testRenameATagToAnInvalidValue(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
$this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => []])); $this->assertTrue(Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => []]));
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testCauseATagCollision(): void { public function testCauseATagCollision(): void {
$this->assertException("constraintViolation", "Db", "ExceptionInput"); $this->assertException("constraintViolation", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Fascinating"]); Arsse::$db->tagPropertiesSet("john.doe@example.com", 1, ['name' => "Fascinating"]);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testSetThePropertiesOfAMissingTag(): void { public function testSetThePropertiesOfAMissingTag(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesSet("john.doe@example.com", 2112, ['name' => "Exciting"]); Arsse::$db->tagPropertiesSet("john.doe@example.com", 2112, ['name' => "Exciting"]);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testSetThePropertiesOfAnInvalidTag(): void { public function testSetThePropertiesOfAnInvalidTag(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesSet("john.doe@example.com", -1, ['name' => "Exciting"]); Arsse::$db->tagPropertiesSet("john.doe@example.com", -1, ['name' => "Exciting"]);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testSetThePropertiesOfAnInvalidTagByName(): void { public function testSetThePropertiesOfAnInvalidTagByName(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesSet("john.doe@example.com", [], ['name' => "Exciting"], true); Arsse::$db->tagPropertiesSet("john.doe@example.com", [], ['name' => "Exciting"], true);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagPropertiesSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
* @covers \JKingWeb\Arsse\Database::tagValidateName
*/
public function testSetThePropertiesOfATagForTheWrongOwner(): void { public function testSetThePropertiesOfATagForTheWrongOwner(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagPropertiesSet("john.doe@example.com", 3, ['name' => "Exciting"]); // tag ID 3 belongs to Jane Arsse::$db->tagPropertiesSet("john.doe@example.com", 3, ['name' => "Exciting"]); // tag ID 3 belongs to Jane
} }
/**
* @covers \JKingWeb\Arsse\Database::tagSubscriptionsGet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testListTaggedSubscriptions(): void { public function testListTaggedSubscriptions(): void {
$exp = [1,5]; $exp = [1,5];
$this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 1)); $this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 1));
@ -290,16 +414,28 @@ trait SeriesTag {
$this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", "Lonely", true)); $this->assertEquals($exp, Arsse::$db->tagSubscriptionsGet("john.doe@example.com", "Lonely", true));
} }
/**
* @covers \JKingWeb\Arsse\Database::tagSubscriptionsGet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testListTaggedSubscriptionsForAMissingTag(): void { public function testListTaggedSubscriptionsForAMissingTag(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 3); Arsse::$db->tagSubscriptionsGet("john.doe@example.com", 3);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagSubscriptionsGet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testListTaggedSubscriptionsForAnInvalidTag(): void { public function testListTaggedSubscriptionsForAnInvalidTag(): void {
$this->assertException("typeViolation", "Db", "ExceptionInput"); $this->assertException("typeViolation", "Db", "ExceptionInput");
Arsse::$db->tagSubscriptionsGet("john.doe@example.com", -1); Arsse::$db->tagSubscriptionsGet("john.doe@example.com", -1);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagSubscriptionsSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testApplyATagToSubscriptions(): void { public function testApplyATagToSubscriptions(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4]); Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4]);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
@ -308,6 +444,10 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagSubscriptionsSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testClearATagFromSubscriptions(): void { public function testClearATagFromSubscriptions(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [1,3], Database::ASSOC_REMOVE); Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [1,3], Database::ASSOC_REMOVE);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
@ -315,6 +455,10 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagSubscriptionsSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testApplyATagToSubscriptionsByName(): void { public function testApplyATagToSubscriptionsByName(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [3,4], Database::ASSOC_ADD, true); Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [3,4], Database::ASSOC_ADD, true);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
@ -323,6 +467,10 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagSubscriptionsSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testClearATagFromSubscriptionsByName(): void { public function testClearATagFromSubscriptionsByName(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [1,3], Database::ASSOC_REMOVE, true); Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [1,3], Database::ASSOC_REMOVE, true);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
@ -330,18 +478,30 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagSubscriptionsSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testApplyATagToNoSubscriptionsByName(): void { public function testApplyATagToNoSubscriptionsByName(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [], Database::ASSOC_ADD, true); Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [], Database::ASSOC_ADD, true);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagSubscriptionsSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testClearATagFromNoSubscriptionsByName(): void { public function testClearATagFromNoSubscriptionsByName(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [], Database::ASSOC_REMOVE, true); Arsse::$db->tagSubscriptionsSet("john.doe@example.com", "Interesting", [], Database::ASSOC_REMOVE, true);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagSubscriptionsSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testReplaceSubscriptionsOfATag(): void { public function testReplaceSubscriptionsOfATag(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4], Database::ASSOC_REPLACE); Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [3,4], Database::ASSOC_REPLACE);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
@ -352,6 +512,10 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/**
* @covers \JKingWeb\Arsse\Database::tagSubscriptionsSet
* @covers \JKingWeb\Arsse\Database::tagValidateId
*/
public function testPurgeSubscriptionsOfATag(): void { public function testPurgeSubscriptionsOfATag(): void {
Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [], Database::ASSOC_REPLACE); Arsse::$db->tagSubscriptionsSet("john.doe@example.com", 1, [], Database::ASSOC_REPLACE);
$state = $this->primeExpectations($this->data, $this->checkMembers); $state = $this->primeExpectations($this->data, $this->checkMembers);
@ -360,6 +524,7 @@ trait SeriesTag {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::tagSummarize */
public function testSummarizeTags(): void { public function testSummarizeTags(): void {
$exp = [ $exp = [
['id' => 1, 'name' => "Interesting", 'subscription' => 1], ['id' => 1, 'name' => "Interesting", 'subscription' => 1],

View file

@ -53,6 +53,7 @@ trait SeriesToken {
unset($this->data); unset($this->data);
} }
/** @covers \JKingWeb\Arsse\Database::tokenLookup */
public function testLookUpAValidToken(): void { public function testLookUpAValidToken(): void {
$exp1 = [ $exp1 = [
'id' => "80fa94c1a11f11e78667001e673b2560", 'id' => "80fa94c1a11f11e78667001e673b2560",
@ -74,21 +75,25 @@ trait SeriesToken {
$this->assertArraySubset($exp3, Arsse::$db->tokenLookup("class.class", "ab3b3eb8a13311e78667001e673b2560")); $this->assertArraySubset($exp3, Arsse::$db->tokenLookup("class.class", "ab3b3eb8a13311e78667001e673b2560"));
} }
/** @covers \JKingWeb\Arsse\Database::tokenLookup */
public function testLookUpAMissingToken(): void { public function testLookUpAMissingToken(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tokenLookup("class", "thisTokenDoesNotExist"); Arsse::$db->tokenLookup("class", "thisTokenDoesNotExist");
} }
/** @covers \JKingWeb\Arsse\Database::tokenLookup */
public function testLookUpAnExpiredToken(): void { public function testLookUpAnExpiredToken(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tokenLookup("fever.login", "27c6de8da13311e78667001e673b2560"); Arsse::$db->tokenLookup("fever.login", "27c6de8da13311e78667001e673b2560");
} }
/** @covers \JKingWeb\Arsse\Database::tokenLookup */
public function testLookUpATokenOfTheWrongClass(): void { public function testLookUpATokenOfTheWrongClass(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput"); $this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->tokenLookup("some.class", "80fa94c1a11f11e78667001e673b2560"); Arsse::$db->tokenLookup("some.class", "80fa94c1a11f11e78667001e673b2560");
} }
/** @covers \JKingWeb\Arsse\Database::tokenCreate */
public function testCreateAToken(): void { public function testCreateAToken(): void {
$user = "jane.doe@example.com"; $user = "jane.doe@example.com";
$state = $this->primeExpectations($this->data, ['arsse_tokens' => ["id", "class", "expires", "user"]]); $state = $this->primeExpectations($this->data, ['arsse_tokens' => ["id", "class", "expires", "user"]]);
@ -103,11 +108,13 @@ trait SeriesToken {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::tokenCreate */
public function testCreateATokenForAMissingUser(): void { public function testCreateATokenForAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict"); $this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->tokenCreate("fever.login", "jane.doe@example.biz"); Arsse::$db->tokenCreate("fever.login", "jane.doe@example.biz");
} }
/** @covers \JKingWeb\Arsse\Database::tokenRevoke */
public function testRevokeAToken(): void { public function testRevokeAToken(): void {
$user = "jane.doe@example.com"; $user = "jane.doe@example.com";
$id = "80fa94c1a11f11e78667001e673b2560"; $id = "80fa94c1a11f11e78667001e673b2560";
@ -119,6 +126,7 @@ trait SeriesToken {
$this->assertFalse(Arsse::$db->tokenRevoke($user, "fever.login", $id)); $this->assertFalse(Arsse::$db->tokenRevoke($user, "fever.login", $id));
} }
/** @covers \JKingWeb\Arsse\Database::tokenRevoke */
public function testRevokeAllTokens(): void { public function testRevokeAllTokens(): void {
$user = "jane.doe@example.com"; $user = "jane.doe@example.com";
$state = $this->primeExpectations($this->data, ['arsse_tokens' => ["id", "expires", "user"]]); $state = $this->primeExpectations($this->data, ['arsse_tokens' => ["id", "expires", "user"]]);
@ -133,6 +141,7 @@ trait SeriesToken {
$this->assertFalse(Arsse::$db->tokenRevoke($user, "unknown.class")); $this->assertFalse(Arsse::$db->tokenRevoke($user, "unknown.class"));
} }
/** @covers \JKingWeb\Arsse\Database::tokenList */
public function testListTokens(): void { public function testListTokens(): void {
$user = "jane.doe@example.com"; $user = "jane.doe@example.com";
$exp = [ $exp = [

View file

@ -48,23 +48,27 @@ trait SeriesUser {
unset($this->data); unset($this->data);
} }
/** @covers \JKingWeb\Arsse\Database::userExists */
public function testCheckThatAUserExists(): void { public function testCheckThatAUserExists(): void {
$this->assertTrue(Arsse::$db->userExists("jane.doe@example.com")); $this->assertTrue(Arsse::$db->userExists("jane.doe@example.com"));
$this->assertFalse(Arsse::$db->userExists("jane.doe@example.org")); $this->assertFalse(Arsse::$db->userExists("jane.doe@example.org"));
$this->compareExpectations(static::$drv, $this->data); $this->compareExpectations(static::$drv, $this->data);
} }
/** @covers \JKingWeb\Arsse\Database::userPasswordGet */
public function testGetAPassword(): void { public function testGetAPassword(): void {
$hash = Arsse::$db->userPasswordGet("admin@example.net"); $hash = Arsse::$db->userPasswordGet("admin@example.net");
$this->assertSame('$2y$10$PbcG2ZR3Z8TuPzM7aHTF8.v61dtCjzjK78gdZJcp4UePE8T9jEgBW', $hash); $this->assertSame('$2y$10$PbcG2ZR3Z8TuPzM7aHTF8.v61dtCjzjK78gdZJcp4UePE8T9jEgBW', $hash);
$this->assertTrue(password_verify("secret", $hash)); $this->assertTrue(password_verify("secret", $hash));
} }
/** @covers \JKingWeb\Arsse\Database::userPasswordGet */
public function testGetThePasswordOfAMissingUser(): void { public function testGetThePasswordOfAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict"); $this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userPasswordGet("john.doe@example.org"); Arsse::$db->userPasswordGet("john.doe@example.org");
} }
/** @covers \JKingWeb\Arsse\Database::userAdd */
public function testAddANewUser(): void { public function testAddANewUser(): void {
$this->assertTrue(Arsse::$db->userAdd("john.doe@example.org", "")); $this->assertTrue(Arsse::$db->userAdd("john.doe@example.org", ""));
$state = $this->primeExpectations($this->data, ['arsse_users' => ['id']]); $state = $this->primeExpectations($this->data, ['arsse_users' => ['id']]);
@ -72,11 +76,13 @@ trait SeriesUser {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::userAdd */
public function testAddAnExistingUser(): void { public function testAddAnExistingUser(): void {
$this->assertException("alreadyExists", "User", "ExceptionConflict"); $this->assertException("alreadyExists", "User", "ExceptionConflict");
Arsse::$db->userAdd("john.doe@example.com", ""); Arsse::$db->userAdd("john.doe@example.com", "");
} }
/** @covers \JKingWeb\Arsse\Database::userRemove */
public function testRemoveAUser(): void { public function testRemoveAUser(): void {
$this->assertTrue(Arsse::$db->userRemove("admin@example.net")); $this->assertTrue(Arsse::$db->userRemove("admin@example.net"));
$state = $this->primeExpectations($this->data, ['arsse_users' => ['id']]); $state = $this->primeExpectations($this->data, ['arsse_users' => ['id']]);
@ -84,19 +90,19 @@ trait SeriesUser {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::userRemove */
public function testRemoveAMissingUser(): void { public function testRemoveAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict"); $this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userRemove("john.doe@example.org"); Arsse::$db->userRemove("john.doe@example.org");
} }
/** @covers \JKingWeb\Arsse\Database::userList */
public function testListAllUsers(): void { public function testListAllUsers(): void {
$users = ["admin@example.net", "jane.doe@example.com", "john.doe@example.com"]; $users = ["admin@example.net", "jane.doe@example.com", "john.doe@example.com"];
$this->assertSame($users, Arsse::$db->userList()); $this->assertSame($users, Arsse::$db->userList());
} }
/** /** @covers \JKingWeb\Arsse\Database::userPasswordSet */
* @depends testGetAPassword
*/
public function testSetAPassword(): void { public function testSetAPassword(): void {
$user = "john.doe@example.com"; $user = "john.doe@example.com";
$pass = "secret"; $pass = "secret";
@ -107,6 +113,7 @@ trait SeriesUser {
$this->assertTrue(password_verify($pass, $hash), "Failed verifying password of $user '$pass' against hash '$hash'."); $this->assertTrue(password_verify($pass, $hash), "Failed verifying password of $user '$pass' against hash '$hash'.");
} }
/** @covers \JKingWeb\Arsse\Database::userPasswordSet */
public function testUnsetAPassword(): void { public function testUnsetAPassword(): void {
$user = "john.doe@example.com"; $user = "john.doe@example.com";
$this->assertEquals("", Arsse::$db->userPasswordGet($user)); $this->assertEquals("", Arsse::$db->userPasswordGet($user));
@ -114,12 +121,16 @@ trait SeriesUser {
$this->assertNull(Arsse::$db->userPasswordGet($user)); $this->assertNull(Arsse::$db->userPasswordGet($user));
} }
/** @covers \JKingWeb\Arsse\Database::userPasswordSet */
public function testSetThePasswordOfAMissingUser(): void { public function testSetThePasswordOfAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict"); $this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userPasswordSet("john.doe@example.org", "secret"); Arsse::$db->userPasswordSet("john.doe@example.org", "secret");
} }
/** @dataProvider provideMetaData */ /**
* @dataProvider provideMetaData
* @covers \JKingWeb\Arsse\Database::userPropertiesGet
*/
public function testGetMetadata(string $user, bool $includeLarge, array $exp): void { public function testGetMetadata(string $user, bool $includeLarge, array $exp): void {
$this->assertSame($exp, Arsse::$db->userPropertiesGet($user, $includeLarge)); $this->assertSame($exp, Arsse::$db->userPropertiesGet($user, $includeLarge));
} }
@ -135,11 +146,13 @@ trait SeriesUser {
]; ];
} }
/** @covers \JKingWeb\Arsse\Database::userPropertiesGet */
public function testGetTheMetadataOfAMissingUser(): void { public function testGetTheMetadataOfAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict"); $this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userPropertiesGet("john.doe@example.org"); Arsse::$db->userPropertiesGet("john.doe@example.org");
} }
/** @covers \JKingWeb\Arsse\Database::userPropertiesSet */
public function testSetMetadata(): void { public function testSetMetadata(): void {
$in = [ $in = [
'admin' => true, 'admin' => true,
@ -156,6 +169,7 @@ trait SeriesUser {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::userPropertiesSet */
public function testSetNoMetadata(): void { public function testSetNoMetadata(): void {
$in = [ $in = [
'num' => 2112, 'num' => 2112,
@ -166,22 +180,26 @@ trait SeriesUser {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::userPropertiesSet */
public function testSetTheMetadataOfAMissingUser(): void { public function testSetTheMetadataOfAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict"); $this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userPropertiesSet("john.doe@example.org", ['admin' => true]); Arsse::$db->userPropertiesSet("john.doe@example.org", ['admin' => true]);
} }
/** @covers \JKingWeb\Arsse\Database::userLookup */
public function testLookUpAUserByNumber(): void { public function testLookUpAUserByNumber(): void {
$this->assertSame("admin@example.net", Arsse::$db->userLookup(1)); $this->assertSame("admin@example.net", Arsse::$db->userLookup(1));
$this->assertSame("jane.doe@example.com", Arsse::$db->userLookup(2)); $this->assertSame("jane.doe@example.com", Arsse::$db->userLookup(2));
$this->assertSame("john.doe@example.com", Arsse::$db->userLookup(3)); $this->assertSame("john.doe@example.com", Arsse::$db->userLookup(3));
} }
/** @covers \JKingWeb\Arsse\Database::userLookup */
public function testLookUpAMissingUserByNumber(): void { public function testLookUpAMissingUserByNumber(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict"); $this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userLookup(2112); Arsse::$db->userLookup(2112);
} }
/** @covers \JKingWeb\Arsse\Database::userRename */
public function testRenameAUser(): void { public function testRenameAUser(): void {
$this->assertTrue(Arsse::$db->userRename("john.doe@example.com", "juan.doe@example.com")); $this->assertTrue(Arsse::$db->userRename("john.doe@example.com", "juan.doe@example.com"));
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
@ -193,20 +211,24 @@ trait SeriesUser {
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
/** @covers \JKingWeb\Arsse\Database::userRename */
public function testRenameAUserToTheSameName(): void { public function testRenameAUserToTheSameName(): void {
$this->assertFalse(Arsse::$db->userRename("john.doe@example.com", "john.doe@example.com")); $this->assertFalse(Arsse::$db->userRename("john.doe@example.com", "john.doe@example.com"));
} }
/** @covers \JKingWeb\Arsse\Database::userRename */
public function testRenameAMissingUser(): void { public function testRenameAMissingUser(): void {
$this->assertException("doesNotExist", "User", "ExceptionConflict"); $this->assertException("doesNotExist", "User", "ExceptionConflict");
Arsse::$db->userRename("juan.doe@example.com", "john.doe@example.com"); Arsse::$db->userRename("juan.doe@example.com", "john.doe@example.com");
} }
/** @covers \JKingWeb\Arsse\Database::userRename */
public function testRenameAUserToADuplicateName(): void { public function testRenameAUserToADuplicateName(): void {
$this->assertException("alreadyExists", "User", "ExceptionConflict"); $this->assertException("alreadyExists", "User", "ExceptionConflict");
Arsse::$db->userRename("john.doe@example.com", "jane.doe@example.com"); Arsse::$db->userRename("john.doe@example.com", "jane.doe@example.com");
} }
/** @covers \JKingWeb\Arsse\Database::userAdd */
public function testAddFirstUser(): void { public function testAddFirstUser(): void {
// first truncate the users table // first truncate the users table
static::$drv->exec("DELETE FROM arsse_users"); static::$drv->exec("DELETE FROM arsse_users");

View file

@ -8,8 +8,9 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Database; namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Database; use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Db\Transaction;
/** @covers \JKingWeb\Arsse\Database */ /** @coversNothing */
class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest { class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
protected $db = null; protected $db = null;
@ -34,7 +35,10 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
return $m->invoke($this->db, ...$arg); return $m->invoke($this->db, ...$arg);
} }
/** @dataProvider provideInClauses */ /**
* @dataProvider provideInClauses
* @covers \JKingWeb\Arsse\Database::generateIn
*/
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); $types = array_fill(0, sizeof($values), $inT);
$exp = [$clause, $types, $values]; $exp = [$clause, $types, $values];
@ -68,7 +72,10 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
]; ];
} }
/** @dataProvider provideSearchClauses */ /**
* @dataProvider provideSearchClauses
* @covers \JKingWeb\Arsse\Database::generateSearch
*/
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 // this is not an exhaustive test; integration tests already cover the ins and outs of the functionality
$types = array_fill(0, sizeof($values), "str"); $types = array_fill(0, sizeof($values), "str");
@ -91,4 +98,36 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
["(".implode(" or ", $clause)." or test like ? escape '^')", ["%?%"], array_merge($terms, ["?"]), ["test"], true], ["(".implode(" or ", $clause)." or test like ? escape '^')", ["%?%"], array_merge($terms, ["?"]), ["test"], true],
]; ];
} }
/** @covers \JKingWeb\Arsse\Database::generateSet */
public function testGenerateSetClause(): void {
$in = [
'ook' => true,
'ack' => false,
'bar' => "Nimoy",
'foo' => "Shatner",
];
$valid = [
'ook' => "bool",
'eek' => "int",
'foo' => "str",
'bar' => "str",
];
$exp = [
'"ook" = ?, "foo" = ?, "bar" = ?',
["bool", "str", "str"],
[true, "Shatner", "Nimoy"],
];
$this->assertSame($exp, $this->invoke("generateSet", $in, $valid));
}
/** @covers \JKingWeb\Arsse\Database::begin */
public function testBeginATransaction(): void {
$this->assertInstanceOf(Transaction::class, $this->invoke("begin"));
}
/** @covers \JKingWeb\Arsse\Database::caller */
public function testReportCallingMethod(): void {
$this->assertSame("caller", $this->invoke("caller"));
}
} }

View file

@ -10,7 +10,7 @@ namespace JKingWeb\Arsse\TestCase\Db\MySQL;
/** /**
* @group slow * @group slow
* @group coverageOptional * @group coverageOptional
* @covers \JKingWeb\Arsse\Database<extended> * @coversNothing
*/ */
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest { class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQL; use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQL;

View file

@ -11,7 +11,7 @@ namespace JKingWeb\Arsse\TestCase\Db\MySQLPDO;
* @group slow * @group slow
* @group optional * @group optional
* @group coverageOptional * @group coverageOptional
* @covers \JKingWeb\Arsse\Database<extended> * @coversNothing
*/ */
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest { class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQLPDO; use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQLPDO;

View file

@ -10,7 +10,7 @@ namespace JKingWeb\Arsse\TestCase\Db\PostgreSQL;
/** /**
* @group slow * @group slow
* @group coverageOptional * @group coverageOptional
* @covers \JKingWeb\Arsse\Database<extended> * @coversNothing
*/ */
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest { class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQL; use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQL;

View file

@ -11,7 +11,7 @@ namespace JKingWeb\Arsse\TestCase\Db\PostgreSQLPDO;
* @group slow * @group slow
* @group optional * @group optional
* @group coverageOptional * @group coverageOptional
* @covers \JKingWeb\Arsse\Database<extended> * @coversNothing
*/ */
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest { class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQLPDO; use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQLPDO;

View file

@ -9,7 +9,7 @@ namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
/** /**
* @group optional * @group optional
* @covers \JKingWeb\Arsse\Database<extended> * @coversNothing
*/ */
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest { class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3; use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3;

View file

@ -8,7 +8,7 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO; namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO;
/** /**
* @covers \JKingWeb\Arsse\Database<extended> * @coversNothing
*/ */
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest { class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3PDO; use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3PDO;

View file

@ -12,7 +12,7 @@ use JKingWeb\Arsse\Misc\URL;
/** @covers \JKingWeb\Arsse\Misc\URL */ /** @covers \JKingWeb\Arsse\Misc\URL */
class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { class TestURL extends \JKingWeb\Arsse\Test\AbstractTest {
/** @dataProvider provideNormalizations */ /** @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)); $this->assertSame($exp, URL::normalize($url, $user, $pass));
} }

View file

@ -315,6 +315,9 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertNan($act, $msg); $this->assertNan($act, $msg);
} elseif (is_scalar($exp)) { } elseif (is_scalar($exp)) {
$this->assertSame($exp, $act, $msg); $this->assertSame($exp, $act, $msg);
} elseif ($exp instanceof \DateInterval && $act instanceof \DateInterval) {
$format = "\Py\Ym\Md\D\Th\HiMs\S";
$this->assertSame($exp->format($format), $act->format($format), $msg);
} else { } else {
$this->assertEquals($exp, $act, $msg); $this->assertEquals($exp, $act, $msg);
} }
@ -532,6 +535,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
[$this->i("P2DT1H"), [null,true], [true, false], [(48 + 1) * 60 * 60, false], [1.0 * (48 + 1) * 60 * 60, false], ["P2DT1H", true], [[$this->i("P2DT1H")], false], [$this->i("P2DT1H"), true]], [$this->i("P2DT1H"), [null,true], [true, false], [(48 + 1) * 60 * 60, false], [1.0 * (48 + 1) * 60 * 60, false], ["P2DT1H", true], [[$this->i("P2DT1H")], false], [$this->i("P2DT1H"), true]],
[$this->i("PT0H"), [null,true], [true, false], [0, false], [0.0, false], ["PT0S", true], [[$this->i("PT0H")], false], [$this->i("PT0H"), true]], [$this->i("PT0H"), [null,true], [true, false], [0, false], [0.0, false], ["PT0S", true], [[$this->i("PT0H")], false], [$this->i("PT0H"), true]],
[$dateDiff, [null,true], [true, false], [366 * 24 * 60 * 60, false], [1.0 * 366 * 24 * 60 * 60, false], ["P366D", true], [[$dateDiff], false], [$dateNorm, true]], [$dateDiff, [null,true], [true, false], [366 * 24 * 60 * 60, false], [1.0 * 366 * 24 * 60 * 60, false], ["P366D", true], [[$dateDiff], false], [$dateNorm, true]],
["1 year, 2 days", [null,true], [true, false], [0, false], [0.0, false], ["1 year, 2 days", true], [["1 year, 2 days"], false], [$this->i("P1Y2D"), false]],
["P1Y2D", [null,true], [true, false], [0, false], [0.0, false], ["P1Y2D", true], [["P1Y2D"], false], [$this->i("P1Y2D"), true]], ["P1Y2D", [null,true], [true, false], [0, false], [0.0, false], ["P1Y2D", true], [["P1Y2D"], false], [$this->i("P1Y2D"), true]],
] as $set) { ] as $set) {
// shift the input value off the set // shift the input value off the set

View file

@ -172,7 +172,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
} }
/** @dataProvider provideTokenAuthenticationRequests */ /** @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, array $dataPost, array $dataGet, ResponseInterface $exp): void {
self::setConf([ self::setConf([
'userHTTPAuthRequired' => $httpRequired, 'userHTTPAuthRequired' => $httpRequired,
'userSessionEnforced' => $tokenEnforced, 'userSessionEnforced' => $tokenEnforced,

View file

@ -38,7 +38,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
} }
/** @dataProvider providePasswordCreations */ /** @dataProvider providePasswordCreations */
public function testRegisterAUserPassword(string $user, string $password = null, $exp): void { public function testRegisterAUserPassword(string $user, ?string $password, $exp): void {
$this->userMock->generatePassword->returns("RANDOM_PASSWORD"); $this->userMock->generatePassword->returns("RANDOM_PASSWORD");
$this->dbMock->tokenCreate->does(function($user, $class, $id = null) { $this->dbMock->tokenCreate->does(function($user, $class, $id = null) {
return $id ?? "RANDOM_TOKEN"; return $id ?? "RANDOM_TOKEN";

View file

@ -169,6 +169,11 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
]; ];
} }
public function testRejectMalformedData(): void {
$exp = V1::respError(["InvalidBodyJSON", "Syntax error"], 400);
$this->assertMessage($exp, $this->req("POST", "/discover", "{"));
}
public function testRejectBadlyTypedData(): void { public function testRejectBadlyTypedData(): void {
$exp = V1::respError(["InvalidInputType", 'field' => "url", 'expected' => "string", 'actual' => "integer"], 422); $exp = V1::respError(["InvalidInputType", 'field' => "url", 'expected' => "string", 'actual' => "integer"], 422);
$this->assertMessage($exp, $this->req("POST", "/discover", ['url' => 2112])); $this->assertMessage($exp, $this->req("POST", "/discover", ['url' => 2112]));

View file

@ -105,7 +105,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest {
} }
/** @dataProvider provideUnnormalizedOrigins */ /** @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(); $r = new REST();
$act = $r->corsNormalizeOrigin($origin, $ports); $act = $r->corsNormalizeOrigin($origin, $ports);
$this->assertSame($exp, $act); $this->assertSame($exp, $act);
@ -148,7 +148,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest {
} }
/** @dataProvider provideCorsNegotiations */ /** @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(); self::setConf();
$rMock = $this->partialMock(REST::class); $rMock = $this->partialMock(REST::class);
$rMock->corsNormalizeOrigin->does(function($origin) { $rMock->corsNormalizeOrigin->does(function($origin) {
@ -250,7 +250,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest {
} }
/** @dataProvider provideUnnormalizedResponses */ /** @dataProvider provideUnnormalizedResponses */
public function testNormalizeHttpResponses(ResponseInterface $res, ResponseInterface $exp, RequestInterface $req = null): void { public function testNormalizeHttpResponses(ResponseInterface $res, ResponseInterface $exp, ?RequestInterface $req = null): void {
$rMock = $this->partialMock(REST::class); $rMock = $this->partialMock(REST::class);
$rMock->corsNegotiate->returns(true); $rMock->corsNegotiate->returns(true);
$rMock->challenge->does(function($res) { $rMock->challenge->does(function($res) {

View file

@ -150,7 +150,7 @@ LONG_STRING;
$this->h = new API(); $this->h = new API();
} }
protected function req($data, string $method = "POST", string $target = "", string $strData = null, string $user = null): ResponseInterface { protected function req($data, string $method = "POST", string $target = "", ?string $strData = null, ?string $user = null): ResponseInterface {
Arsse::$obj = $this->objMock->get(); Arsse::$obj = $this->objMock->get();
Arsse::$db = $this->dbMock->get(); Arsse::$db = $this->dbMock->get();
Arsse::$user = $this->userMock->get(); Arsse::$user = $this->userMock->get();
@ -1223,19 +1223,19 @@ LONG_STRING;
$this->assertMessage($exp, $this->req($in)); $this->assertMessage($exp, $this->req($in));
} }
protected function filterFolders(int $id = null): array { protected function filterFolders(?int $id = null): array {
return array_filter($this->folders, function($value) use ($id) { return array_filter($this->folders, function($value) use ($id) {
return $value['parent'] == $id; return $value['parent'] == $id;
}); });
} }
protected function filterSubs(int $folder = null): array { protected function filterSubs(?int $folder = null): array {
return array_filter($this->subscriptions, function($value) use ($folder) { return array_filter($this->subscriptions, function($value) use ($folder) {
return $value['folder'] == $folder; return $value['folder'] == $folder;
}); });
} }
protected function reduceFolders(int $id = null): int { protected function reduceFolders(?int $id = null): int {
$out = 0; $out = 0;
foreach ($this->filterFolders($id) as $f) { foreach ($this->filterFolders($id) as $f) {
$out += $this->reduceFolders($f['id']); $out += $this->reduceFolders($f['id']);

View file

@ -29,7 +29,7 @@ class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest {
$this->h = new Icon(); $this->h = new Icon();
} }
protected function req(string $target, string $method = "GET", string $user = null): ResponseInterface { protected function req(string $target, string $method = "GET", ?string $user = null): ResponseInterface {
Arsse::$db = $this->dbMock->get(); Arsse::$db = $this->dbMock->get();
$prefix = "/tt-rss/feed-icons/"; $prefix = "/tt-rss/feed-icons/";
$url = $prefix.$target; $url = $prefix.$target;

View file

@ -62,7 +62,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
Arsse::$conf = (($force ? null : Arsse::$conf) ?? (new Conf))->import($defaults)->import($conf); Arsse::$conf = (($force ? null : Arsse::$conf) ?? (new Conf))->import($defaults)->import($conf);
} }
protected function serverRequest(string $method, string $url, string $urlPrefix, array $headers = [], array $vars = [], $body = null, string $type = "", $params = [], string $user = null): ServerRequestInterface { protected function serverRequest(string $method, string $url, string $urlPrefix, array $headers = [], array $vars = [], $body = null, string $type = "", $params = [], ?string $user = null): ServerRequestInterface {
$server = [ $server = [
'REQUEST_METHOD' => $method, 'REQUEST_METHOD' => $method,
'REQUEST_URI' => $url, 'REQUEST_URI' => $url,

View file

@ -43,11 +43,8 @@ trait Setup {
return Glob::glob($this->path."*.php"); return Glob::glob($this->path."*.php");
}); });
$this->l = $this->l->get(); $this->l = $this->l->get();
// create a mock Lang object so as not to create a dependency loop
self::clearData(false); self::clearData(false);
Arsse::$lang = $this->mock(Lang::class); Arsse::$lang = $this->l;
Arsse::$lang->msg->returns("");
Arsse::$lang = Arsse::$lang->get();
// call the additional setup method if it exists // call the additional setup method if it exists
if (method_exists($this, "setUpSeries")) { if (method_exists($this, "setUpSeries")) {
$this->setUpSeries(); $this->setUpSeries();

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -9,10 +9,10 @@
"packages-dev": [], "packages-dev": [],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": {},
"platform-dev": [], "platform-dev": {},
"plugin-api-version": "2.6.0" "plugin-api-version": "2.6.0"
} }

View file

@ -340,23 +340,24 @@
}, },
{ {
"name": "mikey179/vfsstream", "name": "mikey179/vfsstream",
"version": "v1.6.11", "version": "v1.6.12",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/bovigo/vfsStream.git", "url": "https://github.com/bovigo/vfsStream.git",
"reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f" "reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/bovigo/vfsStream/zipball/17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/fe695ec993e0a55c3abdda10a9364eb31c6f1bf0",
"reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", "reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=7.1.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.5|^5.0" "phpunit/phpunit": "^7.5||^8.5||^9.6",
"yoast/phpunit-polyfills": "^2.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -387,20 +388,20 @@
"source": "https://github.com/bovigo/vfsStream/tree/master", "source": "https://github.com/bovigo/vfsStream/tree/master",
"wiki": "https://github.com/bovigo/vfsStream/wiki" "wiki": "https://github.com/bovigo/vfsStream/wiki"
}, },
"time": "2022-02-23T02:02:42+00:00" "time": "2024-08-29T18:43:31+00:00"
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
"version": "1.11.1", "version": "1.12.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/myclabs/DeepCopy.git", "url": "https://github.com/myclabs/DeepCopy.git",
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845",
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -408,11 +409,12 @@
}, },
"conflict": { "conflict": {
"doctrine/collections": "<1.6.8", "doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3,<3.2.2" "doctrine/common": "<2.13.3 || >=3 <3.2.2"
}, },
"require-dev": { "require-dev": {
"doctrine/collections": "^1.6.8", "doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2", "doctrine/common": "^2.13.3 || ^3.2.2",
"phpspec/prophecy": "^1.10",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
}, },
"type": "library", "type": "library",
@ -438,7 +440,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/myclabs/DeepCopy/issues", "issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1"
}, },
"funding": [ "funding": [
{ {
@ -446,29 +448,31 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-03-08T13:26:56+00:00" "time": "2024-11-08T17:47:46+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v4.17.1", "version": "v5.3.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/PHP-Parser.git", "url": "https://github.com/nikic/PHP-Parser.git",
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b",
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-ctype": "*",
"ext-json": "*",
"ext-tokenizer": "*", "ext-tokenizer": "*",
"php": ">=7.0" "php": ">=7.4"
}, },
"require-dev": { "require-dev": {
"ircmaxell/php-yacc": "^0.0.7", "ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" "phpunit/phpunit": "^9.0"
}, },
"bin": [ "bin": [
"bin/php-parse" "bin/php-parse"
@ -476,7 +480,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.9-dev" "dev-master": "5.0-dev"
} }
}, },
"autoload": { "autoload": {
@ -500,33 +504,33 @@
], ],
"support": { "support": {
"issues": "https://github.com/nikic/PHP-Parser/issues", "issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1"
}, },
"time": "2023-08-13T19:53:39+00:00" "time": "2024-10-08T18:51:32+00:00"
}, },
{ {
"name": "phake/phake", "name": "phake/phake",
"version": "v4.4.0", "version": "v4.5.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phake/phake.git", "url": "https://github.com/phake/phake.git",
"reference": "5c8954791645d9b7fc027bf76822a221a5a4de8a" "reference": "695a4feda9ff25608e5065bfd48a7d3c6add57ce"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phake/phake/zipball/5c8954791645d9b7fc027bf76822a221a5a4de8a", "url": "https://api.github.com/repos/phake/phake/zipball/695a4feda9ff25608e5065bfd48a7d3c6add57ce",
"reference": "5c8954791645d9b7fc027bf76822a221a5a4de8a", "reference": "695a4feda9ff25608e5065bfd48a7d3c6add57ce",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.4", "doctrine/instantiator": "^1.4",
"php": "^7.1|^8.0", "php": "^7.1|^8.0",
"sebastian/comparator": "^1.1|^2.0|^3.0|^4.0|^5.0" "sebastian/comparator": "^1.1|^2.0|^3.0|^4.0|^5.0|^6.0"
}, },
"require-dev": { "require-dev": {
"doctrine/annotations": "^1.13", "doctrine/annotations": "^1.13",
"hamcrest/hamcrest-php": "1.1.*", "hamcrest/hamcrest-php": "^1.1|^2.0",
"phpunit/phpunit": "^6.5|^7.0|^8.0|^9.0|^10.0", "phpunit/phpunit": "^6.5|^7.0|^8.0|^9.0|^10.0|^11.0",
"psalm/phar": "^4.18" "psalm/phar": "^4.18"
}, },
"suggest": { "suggest": {
@ -536,7 +540,8 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.4-dev" "dev-4.4": "4.4.x-dev",
"dev-master": "5.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -570,26 +575,27 @@
"support": { "support": {
"docs": "https://phake.github.io/doc/", "docs": "https://phake.github.io/doc/",
"issues": "https://github.com/phake/phake/issues", "issues": "https://github.com/phake/phake/issues",
"source": "https://github.com/phake/phake/tree/v4.4.0" "source": "https://github.com/phake/phake/tree/v4.5.3"
}, },
"time": "2023-02-10T20:32:41+00:00" "time": "2024-12-09T14:46:24+00:00"
}, },
{ {
"name": "phar-io/manifest", "name": "phar-io/manifest",
"version": "2.0.3", "version": "2.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phar-io/manifest.git", "url": "https://github.com/phar-io/manifest.git",
"reference": "97803eca37d319dfa7826cc2437fc020857acb53" "reference": "54750ef60c58e43759730615a392c31c80e23176"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176",
"reference": "97803eca37d319dfa7826cc2437fc020857acb53", "reference": "54750ef60c58e43759730615a392c31c80e23176",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",
"ext-libxml": "*",
"ext-phar": "*", "ext-phar": "*",
"ext-xmlwriter": "*", "ext-xmlwriter": "*",
"phar-io/version": "^3.0.1", "phar-io/version": "^3.0.1",
@ -630,9 +636,15 @@
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"support": { "support": {
"issues": "https://github.com/phar-io/manifest/issues", "issues": "https://github.com/phar-io/manifest/issues",
"source": "https://github.com/phar-io/manifest/tree/2.0.3" "source": "https://github.com/phar-io/manifest/tree/2.0.4"
}, },
"time": "2021-07-20T11:28:43+00:00" "funding": [
{
"url": "https://github.com/theseer",
"type": "github"
}
],
"time": "2024-03-03T12:33:53+00:00"
}, },
{ {
"name": "phar-io/version", "name": "phar-io/version",
@ -687,35 +699,35 @@
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "9.2.29", "version": "9.2.32",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5",
"reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",
"ext-libxml": "*", "ext-libxml": "*",
"ext-xmlwriter": "*", "ext-xmlwriter": "*",
"nikic/php-parser": "^4.15", "nikic/php-parser": "^4.19.1 || ^5.1.0",
"php": ">=7.3", "php": ">=7.3",
"phpunit/php-file-iterator": "^3.0.3", "phpunit/php-file-iterator": "^3.0.6",
"phpunit/php-text-template": "^2.0.2", "phpunit/php-text-template": "^2.0.4",
"sebastian/code-unit-reverse-lookup": "^2.0.2", "sebastian/code-unit-reverse-lookup": "^2.0.3",
"sebastian/complexity": "^2.0", "sebastian/complexity": "^2.0.3",
"sebastian/environment": "^5.1.2", "sebastian/environment": "^5.1.5",
"sebastian/lines-of-code": "^1.0.3", "sebastian/lines-of-code": "^1.0.4",
"sebastian/version": "^3.0.1", "sebastian/version": "^3.0.2",
"theseer/tokenizer": "^1.2.0" "theseer/tokenizer": "^1.2.3"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.3" "phpunit/phpunit": "^9.6"
}, },
"suggest": { "suggest": {
"ext-pcov": "PHP extension that provides line coverage", "ext-pcov": "PHP extension that provides line coverage",
@ -724,7 +736,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "9.2-dev" "dev-main": "9.2.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -753,7 +765,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32"
}, },
"funding": [ "funding": [
{ {
@ -761,7 +773,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-09-19T04:57:46+00:00" "time": "2024-08-22T04:23:01+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
@ -1006,45 +1018,45 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "9.6.13", "version": "9.6.22",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f80235cb4d3caa59ae09be3adf1ded27521d1a9c",
"reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.3.1 || ^2", "doctrine/instantiator": "^1.5.0 || ^2",
"ext-dom": "*", "ext-dom": "*",
"ext-json": "*", "ext-json": "*",
"ext-libxml": "*", "ext-libxml": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-xml": "*", "ext-xml": "*",
"ext-xmlwriter": "*", "ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.10.1", "myclabs/deep-copy": "^1.12.1",
"phar-io/manifest": "^2.0.3", "phar-io/manifest": "^2.0.4",
"phar-io/version": "^3.0.2", "phar-io/version": "^3.2.1",
"php": ">=7.3", "php": ">=7.3",
"phpunit/php-code-coverage": "^9.2.28", "phpunit/php-code-coverage": "^9.2.32",
"phpunit/php-file-iterator": "^3.0.5", "phpunit/php-file-iterator": "^3.0.6",
"phpunit/php-invoker": "^3.1.1", "phpunit/php-invoker": "^3.1.1",
"phpunit/php-text-template": "^2.0.3", "phpunit/php-text-template": "^2.0.4",
"phpunit/php-timer": "^5.0.2", "phpunit/php-timer": "^5.0.3",
"sebastian/cli-parser": "^1.0.1", "sebastian/cli-parser": "^1.0.2",
"sebastian/code-unit": "^1.0.6", "sebastian/code-unit": "^1.0.8",
"sebastian/comparator": "^4.0.8", "sebastian/comparator": "^4.0.8",
"sebastian/diff": "^4.0.3", "sebastian/diff": "^4.0.6",
"sebastian/environment": "^5.1.3", "sebastian/environment": "^5.1.5",
"sebastian/exporter": "^4.0.5", "sebastian/exporter": "^4.0.6",
"sebastian/global-state": "^5.0.1", "sebastian/global-state": "^5.0.7",
"sebastian/object-enumerator": "^4.0.3", "sebastian/object-enumerator": "^4.0.4",
"sebastian/resource-operations": "^3.0.3", "sebastian/resource-operations": "^3.0.4",
"sebastian/type": "^3.2", "sebastian/type": "^3.2.1",
"sebastian/version": "^3.0.2" "sebastian/version": "^3.0.2"
}, },
"suggest": { "suggest": {
@ -1089,7 +1101,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy", "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.22"
}, },
"funding": [ "funding": [
{ {
@ -1105,20 +1117,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-09-19T05:39:22+00:00" "time": "2024-12-05T13:48:26+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",
"version": "1.0.1", "version": "1.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/cli-parser.git", "url": "https://github.com/sebastianbergmann/cli-parser.git",
"reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b",
"reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1153,7 +1165,7 @@
"homepage": "https://github.com/sebastianbergmann/cli-parser", "homepage": "https://github.com/sebastianbergmann/cli-parser",
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/cli-parser/issues", "issues": "https://github.com/sebastianbergmann/cli-parser/issues",
"source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2"
}, },
"funding": [ "funding": [
{ {
@ -1161,7 +1173,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2020-09-28T06:08:49+00:00" "time": "2024-03-02T06:27:43+00:00"
}, },
{ {
"name": "sebastian/code-unit", "name": "sebastian/code-unit",
@ -1350,20 +1362,20 @@
}, },
{ {
"name": "sebastian/complexity", "name": "sebastian/complexity",
"version": "2.0.2", "version": "2.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/complexity.git", "url": "https://github.com/sebastianbergmann/complexity.git",
"reference": "739b35e53379900cc9ac327b2147867b8b6efd88" "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a",
"reference": "739b35e53379900cc9ac327b2147867b8b6efd88", "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"nikic/php-parser": "^4.7", "nikic/php-parser": "^4.18 || ^5.0",
"php": ">=7.3" "php": ">=7.3"
}, },
"require-dev": { "require-dev": {
@ -1395,7 +1407,7 @@
"homepage": "https://github.com/sebastianbergmann/complexity", "homepage": "https://github.com/sebastianbergmann/complexity",
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/complexity/issues", "issues": "https://github.com/sebastianbergmann/complexity/issues",
"source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3"
}, },
"funding": [ "funding": [
{ {
@ -1403,20 +1415,20 @@
"type": "github" "type": "github"
} }
], ],
"time": "2020-10-26T15:52:27+00:00" "time": "2023-12-22T06:19:30+00:00"
}, },
{ {
"name": "sebastian/diff", "name": "sebastian/diff",
"version": "4.0.5", "version": "4.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/diff.git", "url": "https://github.com/sebastianbergmann/diff.git",
"reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc",
"reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1461,7 +1473,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/diff/issues", "issues": "https://github.com/sebastianbergmann/diff/issues",
"source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6"
}, },
"funding": [ "funding": [
{ {
@ -1469,7 +1481,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-05-07T05:35:17+00:00" "time": "2024-03-02T06:30:58+00:00"
}, },
{ {
"name": "sebastian/environment", "name": "sebastian/environment",
@ -1536,16 +1548,16 @@
}, },
{ {
"name": "sebastian/exporter", "name": "sebastian/exporter",
"version": "4.0.5", "version": "4.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git", "url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72",
"reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1601,7 +1613,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues", "issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6"
}, },
"funding": [ "funding": [
{ {
@ -1609,20 +1621,20 @@
"type": "github" "type": "github"
} }
], ],
"time": "2022-09-14T06:03:37+00:00" "time": "2024-03-02T06:33:00+00:00"
}, },
{ {
"name": "sebastian/global-state", "name": "sebastian/global-state",
"version": "5.0.6", "version": "5.0.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git", "url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "bde739e7565280bda77be70044ac1047bc007e34" "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9",
"reference": "bde739e7565280bda77be70044ac1047bc007e34", "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1665,7 +1677,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues", "issues": "https://github.com/sebastianbergmann/global-state/issues",
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7"
}, },
"funding": [ "funding": [
{ {
@ -1673,24 +1685,24 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-08-02T09:26:13+00:00" "time": "2024-03-02T06:35:11+00:00"
}, },
{ {
"name": "sebastian/lines-of-code", "name": "sebastian/lines-of-code",
"version": "1.0.3", "version": "1.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/lines-of-code.git", "url": "https://github.com/sebastianbergmann/lines-of-code.git",
"reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5",
"reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"nikic/php-parser": "^4.6", "nikic/php-parser": "^4.18 || ^5.0",
"php": ">=7.3" "php": ">=7.3"
}, },
"require-dev": { "require-dev": {
@ -1722,7 +1734,7 @@
"homepage": "https://github.com/sebastianbergmann/lines-of-code", "homepage": "https://github.com/sebastianbergmann/lines-of-code",
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/lines-of-code/issues", "issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
"source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4"
}, },
"funding": [ "funding": [
{ {
@ -1730,7 +1742,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2020-11-28T06:42:11+00:00" "time": "2023-12-22T06:20:34+00:00"
}, },
{ {
"name": "sebastian/object-enumerator", "name": "sebastian/object-enumerator",
@ -1909,16 +1921,16 @@
}, },
{ {
"name": "sebastian/resource-operations", "name": "sebastian/resource-operations",
"version": "3.0.3", "version": "3.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/resource-operations.git", "url": "https://github.com/sebastianbergmann/resource-operations.git",
"reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e",
"reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1930,7 +1942,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.0-dev" "dev-main": "3.0-dev"
} }
}, },
"autoload": { "autoload": {
@ -1951,8 +1963,7 @@
"description": "Provides a list of PHP built-in functions that operate on resources", "description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations", "homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/resource-operations/issues", "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4"
"source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3"
}, },
"funding": [ "funding": [
{ {
@ -1960,7 +1971,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2020-09-28T06:45:17+00:00" "time": "2024-03-14T16:00:52+00:00"
}, },
{ {
"name": "sebastian/type", "name": "sebastian/type",
@ -2073,16 +2084,16 @@
}, },
{ {
"name": "theseer/tokenizer", "name": "theseer/tokenizer",
"version": "1.2.1", "version": "1.2.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/theseer/tokenizer.git", "url": "https://github.com/theseer/tokenizer.git",
"reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2",
"reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2111,7 +2122,7 @@
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"support": { "support": {
"issues": "https://github.com/theseer/tokenizer/issues", "issues": "https://github.com/theseer/tokenizer/issues",
"source": "https://github.com/theseer/tokenizer/tree/1.2.1" "source": "https://github.com/theseer/tokenizer/tree/1.2.3"
}, },
"funding": [ "funding": [
{ {
@ -2119,20 +2130,20 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-07-28T10:34:58+00:00" "time": "2024-03-03T12:36:25+00:00"
}, },
{ {
"name": "webmozart/glob", "name": "webmozart/glob",
"version": "4.6.0", "version": "4.7.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/webmozarts/glob.git", "url": "https://github.com/webmozarts/glob.git",
"reference": "3c17f7dec3d9d0e87b575026011f2e75a56ed655" "reference": "8a2842112d6916e61e0e15e316465b611f3abc17"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/webmozarts/glob/zipball/3c17f7dec3d9d0e87b575026011f2e75a56ed655", "url": "https://api.github.com/repos/webmozarts/glob/zipball/8a2842112d6916e61e0e15e316465b611f3abc17",
"reference": "3c17f7dec3d9d0e87b575026011f2e75a56ed655", "reference": "8a2842112d6916e61e0e15e316465b611f3abc17",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2166,17 +2177,17 @@
"description": "A PHP implementation of Ant's glob.", "description": "A PHP implementation of Ant's glob.",
"support": { "support": {
"issues": "https://github.com/webmozarts/glob/issues", "issues": "https://github.com/webmozarts/glob/issues",
"source": "https://github.com/webmozarts/glob/tree/4.6.0" "source": "https://github.com/webmozarts/glob/tree/4.7.0"
}, },
"time": "2022-05-24T19:45:58+00:00" "time": "2024-03-07T20:33:40+00:00"
} }
], ],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": {},
"platform-dev": [], "platform-dev": {},
"plugin-api-version": "2.6.0" "plugin-api-version": "2.6.0"
} }

View file

@ -1,6 +1,6 @@
{ {
"require-dev": { "require-dev": {
"consolidation/robo": "^3.0", "consolidation/robo": "^5.0",
"pear/archive_tar": "^1.4" "pear/archive_tar": "^1.4"
} }
} }

File diff suppressed because it is too large Load diff