From ba42b7b0c1cb69b29bb14f220b8202500ad9e6df Mon Sep 17 00:00:00 2001 From: "J. King" Date: Fri, 27 Dec 2024 19:58:07 -0500 Subject: [PATCH] Upgrade to PHPUnit 11 Deprecated annotations still need to be addressed --- RoboFile.php | 15 +- tests/cases/CLI/TestCLI.php | 24 +- tests/cases/Database/AbstractTest.php | 4 +- tests/cases/Database/SeriesArticle.php | 6 +- tests/cases/Database/SeriesFeed.php | 2 +- tests/cases/Database/SeriesSubscription.php | 2 +- tests/cases/Database/SeriesUser.php | 2 +- tests/cases/Database/TestDatabase.php | 4 +- tests/cases/Db/BaseStatement.php | 10 +- tests/cases/Db/MySQL/TestStatement.php | 2 +- tests/cases/Db/MySQLPDO/TestStatement.php | 2 +- tests/cases/Db/PostgreSQL/TestCreation.php | 2 +- tests/cases/Db/PostgreSQL/TestStatement.php | 2 +- tests/cases/Db/PostgreSQLPDO/TestCreation.php | 2 +- .../cases/Db/PostgreSQLPDO/TestStatement.php | 2 +- tests/cases/Db/SQLite3/TestStatement.php | 2 +- tests/cases/Db/SQLite3PDO/TestStatement.php | 2 +- tests/cases/Feed/TestException.php | 6 +- tests/cases/Feed/TestFeed.php | 4 +- tests/cases/ImportExport/TestFile.php | 4 +- tests/cases/ImportExport/TestOPML.php | 2 +- tests/cases/Misc/TestContext.php | 2 +- tests/cases/Misc/TestHTTP.php | 4 +- tests/cases/Misc/TestRule.php | 2 +- tests/cases/Misc/TestURL.php | 6 +- tests/cases/Misc/TestValueInfo.php | 104 +-- tests/cases/REST/Fever/TestAPI.php | 12 +- tests/cases/REST/Fever/TestUser.php | 4 +- tests/cases/REST/Miniflux/TestStatus.php | 2 +- tests/cases/REST/Miniflux/TestToken.php | 4 +- tests/cases/REST/Miniflux/TestV1.php | 60 +- tests/cases/REST/NextcloudNews/TestV1_2.php | 50 +- tests/cases/REST/TestREST.php | 14 +- tests/cases/REST/TinyTinyRSS/TestAPI.php | 690 +++++++++--------- tests/cases/REST/TinyTinyRSS/TestSearch.php | 2 +- tests/cases/Service/TestDaemon.php | 8 +- tests/cases/TestArsse.php | 2 +- tests/cases/User/TestInternal.php | 2 +- tests/cases/User/TestUser.php | 8 +- tests/lib/AbstractTest.php | 35 +- tests/lib/PDOTest.php | 4 +- vendor-bin/phpunit/composer.json | 5 +- vendor-bin/phpunit/composer.lock | 627 ++++++++-------- 43 files changed, 862 insertions(+), 886 deletions(-) diff --git a/RoboFile.php b/RoboFile.php index 16a1741a..7300fce5 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -129,24 +129,29 @@ class RoboFile extends \Robo\Tasks { protected function runTests(string $executor, string $set, array $args): Result { switch ($set) { case "typical": - $set = ["--exclude-group", "optional"]; + $exc = ["optional"]; break; case "quick": - $set = ["--exclude-group", "optional,slow"]; + $exc = ["optional", "slow"]; break; case "coverage": - $set = ["--exclude-group", "optional,coverageOptional"]; + $exc = ["optional", "coverageOptional"]; break; case "full": - $set = []; + $exc = []; break; default: throw new \Exception; } + $extra = ["--display-phpunit-deprecations"]; + foreach ($exc as $group) { + $extra[] = "--exclude-group"; + $extra[] = $group; + } $execpath = norm(BASE."vendor-bin/phpunit/vendor/phpunit/phpunit/phpunit"); $confpath = realpath(BASE_TEST."phpunit.dist.xml") ?: norm(BASE_TEST."phpunit.xml"); $this->taskServer(8000)->host("localhost")->dir(BASE_TEST."docroot")->rawArg("-n")->arg(BASE_TEST."server.php")->rawArg($this->blackhole())->background()->run(); - return $this->taskExec($executor)->option("-d", "zend.assertions=1")->arg($execpath)->option("-c", $confpath)->args(array_merge($set, $args))->run(); + return $this->taskExec($executor)->option("-d", "zend.assertions=1")->arg($execpath)->option("-c", $confpath)->args(array_merge($extra, $args))->run(); } /** Returns a Git version string for a given Git tree-ish ID diff --git a/tests/cases/CLI/TestCLI.php b/tests/cases/CLI/TestCLI.php index 163815c3..fd2ad6fb 100644 --- a/tests/cases/CLI/TestCLI.php +++ b/tests/cases/CLI/TestCLI.php @@ -53,7 +53,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($this->cli, \Phake::never())->loadConf(); } - public function provideHelpText(): iterable { + public static function provideHelpText(): iterable { return [ ["arsse.php --help", "arsse.php"], ["arsse --help", "arsse"], @@ -125,7 +125,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->feedUpdate(\Phake::anyParameters()); } - public function provideFeedUpdates(): iterable { + public static function provideFeedUpdates(): iterable { return [ ["arsse.php feed refresh 1", 0, ""], ["arsse.php feed refresh 2", 10502, ""], @@ -144,7 +144,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($conf)->exportFile($file, true); } - public function provideDefaultConfigurationSaves(): iterable { + public static function provideDefaultConfigurationSaves(): iterable { return [ ["arsse.php conf save-defaults", 0, "php://output"], ["arsse.php conf save-defaults -", 0, "php://output"], @@ -160,7 +160,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($cmd, $exitStatus, $output); } - public function provideUserList(): iterable { + public static function provideUserList(): iterable { $list = ["john.doe@example.com", "jane.doe@example.com"]; $str = implode(PHP_EOL, $list); return [ @@ -182,7 +182,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($cmd, $exitStatus, $output); } - public function provideUserAdditions(): iterable { + public static function provideUserAdditions(): iterable { return [ ["arsse.php user add john.doe@example.com", 10403, ""], ["arsse.php user add jane.doe@example.com", 0, "random password"], @@ -213,7 +213,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($cmd, $exitStatus, $output); } - public function provideUserAuthentication(): iterable { + public static function provideUserAuthentication(): iterable { $l = new \JKingWeb\Arsse\Lang; $success = $l("CLI.Auth.Success"); $failure = $l("CLI.Auth.Failure"); @@ -237,7 +237,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($cmd, $exitStatus, $output); } - public function provideUserRemovals(): iterable { + public static function provideUserRemovals(): iterable { return [ ["arsse.php user remove john.doe@example.com", 0, ""], ["arsse.php user remove jane.doe@example.com", 10402, ""], @@ -262,7 +262,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($cmd, $exitStatus, $output); } - public function provideUserPasswordChanges(): iterable { + public static function provideUserPasswordChanges(): iterable { return [ ["arsse.php user set-pass john.doe@example.com", 0, "random password"], ["arsse.php user set-pass john.doe@example.com superman", 0, ""], @@ -291,7 +291,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($cmd, $exitStatus, $output); } - public function provideUserPasswordClearings(): iterable { + public static function provideUserPasswordClearings(): iterable { return [ ["arsse.php user unset-pass john.doe@example.com", 0, ""], ["arsse.php user unset-pass jane.doe@example.com", 10402, ""], @@ -312,7 +312,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($opml)->exportFile($file, $user, $flat); } - public function provideOpmlExports(): iterable { + public static function provideOpmlExports(): iterable { return [ ["arsse.php export john.doe@example.com", 0, "php://output", "john.doe@example.com", false], ["arsse.php export john.doe@example.com -", 0, "php://output", "john.doe@example.com", false], @@ -353,7 +353,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($opml)->importFile($file, $user, $flat, $replace); } - public function provideOpmlImports(): iterable { + public static function provideOpmlImports(): iterable { return [ ["arsse.php import john.doe@example.com", 0, "php://input", "john.doe@example.com", false, false], ["arsse.php import john.doe@example.com -", 0, "php://input", "john.doe@example.com", false, false], @@ -433,7 +433,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$user)->propertiesSet($user, $in); } - public function provideMetadataChanges(): iterable { + public static function provideMetadataChanges(): iterable { return [ ["arsse.php user set john admin true", "john", ['admin' => "true"], ['admin' => "true"], 0], ["arsse.php user set john bogus 1", "john", ['bogus' => "1"], [], 1], diff --git a/tests/cases/Database/AbstractTest.php b/tests/cases/Database/AbstractTest.php index dc133740..309843ee 100644 --- a/tests/cases/Database/AbstractTest.php +++ b/tests/cases/Database/AbstractTest.php @@ -69,7 +69,7 @@ abstract class AbstractTest extends \JKingWeb\Arsse\Test\AbstractTest { public function setUp(): void { // get the name of the test's test series - $this->series = $this->findTraitofTest($this->getName(false)); + $this->series = $this->findTraitofTest($this->name()); static::clearData(); static::setConf(); if (strlen(static::$failureReason)) { @@ -90,7 +90,7 @@ abstract class AbstractTest extends \JKingWeb\Arsse\Test\AbstractTest { public function tearDown(): void { // call the series-specific teardown method - $this->series = $this->findTraitofTest($this->getName(false)); + $this->series = $this->findTraitofTest($this->name()); $tearDown = "tearDown".$this->series; $this->$tearDown(); // clean up diff --git a/tests/cases/Database/SeriesArticle.php b/tests/cases/Database/SeriesArticle.php index 9d383b1f..a918a868 100644 --- a/tests/cases/Database/SeriesArticle.php +++ b/tests/cases/Database/SeriesArticle.php @@ -443,7 +443,7 @@ trait SeriesArticle { $this->assertEquals($exp, $ids); } - public function provideContextMatches(): iterable { + public static function provideContextMatches(): iterable { $setSize = (new \ReflectionClassConstant(Database::class, "LIMIT_SET_SIZE"))->getValue(); return [ 'Blank context' => [new Context, [1,2,3,4,5,6,7,8,19,20]], @@ -661,7 +661,7 @@ trait SeriesArticle { $this->assertSame($exp, $act); } - public function provideOrderedLists(): iterable { + public static function provideOrderedLists(): iterable { return [ [["id"], [1,2,3,4,5,6,7,8,19,20]], [["id asc"], [1,2,3,4,5,6,7,8,19,20]], @@ -1400,7 +1400,7 @@ trait SeriesArticle { Arsse::$db->articleList($this->user, (new Context)->$option([])); } - public function provideArrayContextOptions(): iterable { + public static function provideArrayContextOptions(): iterable { foreach ([ "articles", "editions", "subscriptions", "foldersShallow", "folders", diff --git a/tests/cases/Database/SeriesFeed.php b/tests/cases/Database/SeriesFeed.php index 4e18c774..bdf2e7fe 100644 --- a/tests/cases/Database/SeriesFeed.php +++ b/tests/cases/Database/SeriesFeed.php @@ -217,7 +217,7 @@ trait SeriesFeed { $this->assertSame($exp, Arsse::$db->feedRulesGet($in)); } - public function provideFilterRules(): iterable { + public static function provideFilterRules(): iterable { return [ [1, ['jane.doe@example.com' => ['keep' => "`^(?i)[a-z]+`u", 'block' => "`3|6`u"], 'john.doe@example.com' => ['keep' => "", 'block' => "`^Sport$`u"]]], [2, []], diff --git a/tests/cases/Database/SeriesSubscription.php b/tests/cases/Database/SeriesSubscription.php index bea859ee..76d202d6 100644 --- a/tests/cases/Database/SeriesSubscription.php +++ b/tests/cases/Database/SeriesSubscription.php @@ -539,7 +539,7 @@ trait SeriesSubscription { Arsse::$db->subscriptionPropertiesSet($this->user, 1, $data); } - public function provideInvalidSubscriptionProperties(): iterable { + public static function provideInvalidSubscriptionProperties(): iterable { return [ 'Empty title' => [['title' => ""], "missing"], 'Whitespace title' => [['title' => " "], "whitespace"], diff --git a/tests/cases/Database/SeriesUser.php b/tests/cases/Database/SeriesUser.php index 47b4acb7..7f4b00b3 100644 --- a/tests/cases/Database/SeriesUser.php +++ b/tests/cases/Database/SeriesUser.php @@ -135,7 +135,7 @@ trait SeriesUser { $this->assertSame($exp, Arsse::$db->userPropertiesGet($user, $includeLarge)); } - public function provideMetadata(): iterable { + public static function provideMetadata(): iterable { return [ ["admin@example.net", true, ['num' => 1, 'admin' => 1, 'lang' => "en", 'sort_asc' => "0", 'tz' => "America/Toronto"]], ["jane.doe@example.com", true, ['num' => 2, 'admin' => 0, 'lang' => "fr", 'sort_asc' => "1", 'tz' => "Asia/Kuala_Lumpur"]], diff --git a/tests/cases/Database/TestDatabase.php b/tests/cases/Database/TestDatabase.php index e013d081..c0497bd0 100644 --- a/tests/cases/Database/TestDatabase.php +++ b/tests/cases/Database/TestDatabase.php @@ -45,7 +45,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $this->invoke("generateIn", $inV, $inT)); } - public function provideInClauses(): iterable { + public static function provideInClauses(): iterable { $l = (new \ReflectionClassConstant(Database::class, "LIMIT_SET_SIZE"))->getValue() + 1; $strings = array_fill(0, $l, ""); $ints = range(1, $l); @@ -83,7 +83,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $this->invoke("generateSearch", $inV, $inC, $inAny)); } - public function provideSearchClauses(): iterable { + public static function provideSearchClauses(): iterable { $setSize = (new \ReflectionClassConstant(Database::class, "LIMIT_SET_SIZE"))->getValue(); $terms = array_fill(0, $setSize + 1, "a"); $clause = array_fill(0, $setSize + 1, "test like '%a%' escape '^'"); diff --git a/tests/cases/Db/BaseStatement.php b/tests/cases/Db/BaseStatement.php index 278870b8..ab9a9dd5 100644 --- a/tests/cases/Db/BaseStatement.php +++ b/tests/cases/Db/BaseStatement.php @@ -14,7 +14,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { protected $statementClass; abstract protected function makeStatement(string $q, array $types = []): array; - abstract protected function decorateTypeSyntax(string $value, string $type): string; + abstract protected static function decorateTypeSyntax(string $value, string $type): string; public static function setUpBeforeClass(): void { // establish a clean baseline @@ -121,7 +121,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { $s->runArray(['ook', 'eek']); } - public function provideBindings(): iterable { + public static function provideBindings(): iterable { $dateMutable = new \DateTime("Noon Today", new \DateTimezone("America/Toronto")); $dateImmutable = new \DateTimeImmutable("Noon Today", new \DateTimezone("America/Toronto")); $dateUTC = new \DateTime("@".$dateMutable->getTimestamp(), new \DateTimezone("UTC")); @@ -259,12 +259,12 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { ]; foreach ($tests as $index => [$value, $type, $exp]) { $t = preg_replace("<^strict >", "", $type); - $exp = ($exp === "null") ? $exp : $this->decorateTypeSyntax($exp, $t); + $exp = ($exp === "null") ? $exp : static::decorateTypeSyntax($exp, $t); yield $index => [$value, $type, $exp]; } } - public function provideBinaryBindings(): iterable { + public static function provideBinaryBindings(): iterable { $dateMutable = new \DateTime("Noon Today", new \DateTimezone("America/Toronto")); $dateImmutable = new \DateTimeImmutable("Noon Today", new \DateTimezone("America/Toronto")); $dateUTC = new \DateTime("@".$dateMutable->getTimestamp(), new \DateTimezone("UTC")); @@ -308,7 +308,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { ]; foreach ($tests as $index => [$value, $type, $exp]) { $t = preg_replace("<^strict >", "", $type); - $exp = ($exp === "null") ? $exp : $this->decorateTypeSyntax($exp, $t); + $exp = ($exp === "null") ? $exp : static::decorateTypeSyntax($exp, $t); yield $index => [$value, $type, $exp]; } } diff --git a/tests/cases/Db/MySQL/TestStatement.php b/tests/cases/Db/MySQL/TestStatement.php index 926d9772..e59dcb3a 100644 --- a/tests/cases/Db/MySQL/TestStatement.php +++ b/tests/cases/Db/MySQL/TestStatement.php @@ -19,7 +19,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement { return [static::$interface, $q, $types]; } - protected function decorateTypeSyntax(string $value, string $type): string { + protected static function decorateTypeSyntax(string $value, string $type): string { switch ($type) { case "float": return (substr($value, -2) === ".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'"; diff --git a/tests/cases/Db/MySQLPDO/TestStatement.php b/tests/cases/Db/MySQLPDO/TestStatement.php index 4b233f07..6f5f8116 100644 --- a/tests/cases/Db/MySQLPDO/TestStatement.php +++ b/tests/cases/Db/MySQLPDO/TestStatement.php @@ -20,7 +20,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement { return [static::$interface, $q, $types]; } - protected function decorateTypeSyntax(string $value, string $type): string { + protected static function decorateTypeSyntax(string $value, string $type): string { switch ($type) { case "float": return (substr($value, -2) === ".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'"; diff --git a/tests/cases/Db/PostgreSQL/TestCreation.php b/tests/cases/Db/PostgreSQL/TestCreation.php index 7764f8aa..be40911e 100644 --- a/tests/cases/Db/PostgreSQL/TestCreation.php +++ b/tests/cases/Db/PostgreSQL/TestCreation.php @@ -36,7 +36,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideConnectionStrings(): iterable { + public static function provideConnectionStrings(): iterable { return [ [false, "arsse", "secret", "arsse", "", 5432, "", "dbname='arsse' password='secret' user='arsse'"], [false, "arsse", "p word", "arsse", "", 5432, "", "dbname='arsse' password='p word' user='arsse'"], diff --git a/tests/cases/Db/PostgreSQL/TestStatement.php b/tests/cases/Db/PostgreSQL/TestStatement.php index c54f2329..5230f8cd 100644 --- a/tests/cases/Db/PostgreSQL/TestStatement.php +++ b/tests/cases/Db/PostgreSQL/TestStatement.php @@ -19,7 +19,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement { return [static::$interface, $q, $types]; } - protected function decorateTypeSyntax(string $value, string $type): string { + protected static function decorateTypeSyntax(string $value, string $type): string { switch ($type) { case "float": return (substr($value, -2) === ".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'"; diff --git a/tests/cases/Db/PostgreSQLPDO/TestCreation.php b/tests/cases/Db/PostgreSQLPDO/TestCreation.php index 225f75fc..915850e4 100644 --- a/tests/cases/Db/PostgreSQLPDO/TestCreation.php +++ b/tests/cases/Db/PostgreSQLPDO/TestCreation.php @@ -36,7 +36,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideConnectionStrings(): iterable { + public static function provideConnectionStrings(): iterable { return [ [false, "arsse", "secret", "arsse", "", 5432, "", "dbname='arsse' password='secret' user='arsse'"], [false, "arsse", "p word", "arsse", "", 5432, "", "dbname='arsse' password='p word' user='arsse'"], diff --git a/tests/cases/Db/PostgreSQLPDO/TestStatement.php b/tests/cases/Db/PostgreSQLPDO/TestStatement.php index 4b56f6f4..0789eeb2 100644 --- a/tests/cases/Db/PostgreSQLPDO/TestStatement.php +++ b/tests/cases/Db/PostgreSQLPDO/TestStatement.php @@ -19,7 +19,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement { return [static::$interface, $q, $types]; } - protected function decorateTypeSyntax(string $value, string $type): string { + protected static function decorateTypeSyntax(string $value, string $type): string { switch ($type) { case "float": return (substr($value, -2) === ".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'"; diff --git a/tests/cases/Db/SQLite3/TestStatement.php b/tests/cases/Db/SQLite3/TestStatement.php index 99ff762a..b853e3ff 100644 --- a/tests/cases/Db/SQLite3/TestStatement.php +++ b/tests/cases/Db/SQLite3/TestStatement.php @@ -25,7 +25,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement { return [static::$interface, $q, $types]; } - protected function decorateTypeSyntax(string $value, string $type): string { + protected static function decorateTypeSyntax(string $value, string $type): string { return $value; } } diff --git a/tests/cases/Db/SQLite3PDO/TestStatement.php b/tests/cases/Db/SQLite3PDO/TestStatement.php index 930dc73c..4ec9ad81 100644 --- a/tests/cases/Db/SQLite3PDO/TestStatement.php +++ b/tests/cases/Db/SQLite3PDO/TestStatement.php @@ -18,7 +18,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement { return [static::$interface, $q, $types]; } - protected function decorateTypeSyntax(string $value, string $type): string { + protected static function decorateTypeSyntax(string $value, string $type): string { if ($type === "float") { return (substr($value, -2) === ".0") ? "'".substr($value, 0, strlen($value) - 2)."'" : "'$value'"; } else { diff --git a/tests/cases/Feed/TestException.php b/tests/cases/Feed/TestException.php index a4644f12..c96a9b3b 100644 --- a/tests/cases/Feed/TestException.php +++ b/tests/cases/Feed/TestException.php @@ -24,7 +24,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { throw new FeedException("", ['url' => "https://example.com/"], $e); } - public function provideCurlErrors() { + public static function provideCurlErrors() { return [ 'CURLE_UNSUPPORTED_PROTOCOL' => [1, "invalidUrl"], 'CURLE_FAILED_INIT' => [2, "internalError"], @@ -123,7 +123,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { throw new FeedException("", ['url' => "https://example.com/"], $e); } - public function provideHTTPErrors() { + public static function provideHTTPErrors() { $specials = [ 401 => "unauthorized", 403 => "forbidden", @@ -149,7 +149,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { throw new FeedException("", ['url' => "https://example.com/"], $e); } - public function providePicoFeedException() { + public static function providePicoFeedException() { return [ 'Failed feed discovery' => [new \PicoFeed\Reader\SubscriptionNotFoundException(), "subscriptionNotFound"], 'Unsupported format' => [new \PicoFeed\Reader\UnsupportedFeedFormatException(), "unsupportedFeedFormat"], diff --git a/tests/cases/Feed/TestFeed.php b/tests/cases/Feed/TestFeed.php index 3693f1f7..43f5c0e3 100644 --- a/tests/cases/Feed/TestFeed.php +++ b/tests/cases/Feed/TestFeed.php @@ -234,7 +234,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($e, $f->etag); } - public function provide304ResponseURLs() { + public static function provide304ResponseURLs() { return [ 'Control' => ["Caching/304Conditional"], 'Random last-mod and ETag' => ["Caching/304Random"], @@ -292,7 +292,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertTime($exp, $f->nextFetch); } - public function provide304Timestamps(): iterable { + public static function provide304Timestamps(): iterable { return [ 'less than half an hour 1' => ["now", "now + 15 minutes"], 'less than half an hour 2' => ["now - 29 minutes", "now + 15 minutes"], diff --git a/tests/cases/ImportExport/TestFile.php b/tests/cases/ImportExport/TestFile.php index cac30836..e77b1d6d 100644 --- a/tests/cases/ImportExport/TestFile.php +++ b/tests/cases/ImportExport/TestFile.php @@ -61,7 +61,7 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideFileExports(): iterable { + public static function provideFileExports(): iterable { $createException = new Exception("fileUncreatable"); $writeException = new Exception("fileUnwritable"); return [ @@ -99,7 +99,7 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideFileImports(): iterable { + public static function provideFileImports(): iterable { $missingException = new Exception("fileMissing"); $permissionException = new Exception("fileUnreadable"); return [ diff --git a/tests/cases/ImportExport/TestOPML.php b/tests/cases/ImportExport/TestOPML.php index 3beb2631..76559a99 100644 --- a/tests/cases/ImportExport/TestOPML.php +++ b/tests/cases/ImportExport/TestOPML.php @@ -119,7 +119,7 @@ OPML_EXPORT_SERIALIZATION; } } - public function provideParserData(): iterable { + public static function provideParserData(): iterable { return [ ["BrokenXML.opml", false, new Exception("invalidSyntax")], ["BrokenOPML.1.opml", false, new Exception("invalidSemantics")], diff --git a/tests/cases/Misc/TestContext.php b/tests/cases/Misc/TestContext.php index 8f5554da..6ac3763f 100644 --- a/tests/cases/Misc/TestContext.php +++ b/tests/cases/Misc/TestContext.php @@ -58,7 +58,7 @@ class TestContext extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertFalse($c->$method(), "Context method did not return false after clearing"); } - public function provideContextOptions(): iterable { + public static function provideContextOptions(): iterable { $tests = [ 'limit' => [[10], 10], 'offset' => [[5], 5], diff --git a/tests/cases/Misc/TestHTTP.php b/tests/cases/Misc/TestHTTP.php index 1929294e..b5a0c22f 100644 --- a/tests/cases/Misc/TestHTTP.php +++ b/tests/cases/Misc/TestHTTP.php @@ -22,7 +22,7 @@ class TestHTTP extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, HTTP::matchType($msg, ...$types)); } - public function provideMediaTypes(): array { + public static function provideMediaTypes(): array { return [ ["application/json", ["application/json"], true], ["APPLICATION/JSON", ["application/json"], true], @@ -42,7 +42,7 @@ class TestHTTP extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function provideTypedMessages(): iterable { + public static function provideTypedMessages(): iterable { return [ ["respEmpty", [422, ['Content-Length' => "0"]], new Response(422, ['Content-Length' => "0"])], ["respText", ["OOK"], new Response(200, ['Content-Type' => "text/plain; charset=UTF-8"], "OOK")], diff --git a/tests/cases/Misc/TestRule.php b/tests/cases/Misc/TestRule.php index 461ee26f..76e13b18 100644 --- a/tests/cases/Misc/TestRule.php +++ b/tests/cases/Misc/TestRule.php @@ -35,7 +35,7 @@ class TestRule extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, Rule::apply($keepRule, $blockRule, $title, $categories)); } - public function provideApplications(): iterable { + public static function provideApplications(): iterable { return [ ["", "", "Title", ["Dummy", "Category"], true], ["^Title$", "", "Title", ["Dummy", "Category"], true], diff --git a/tests/cases/Misc/TestURL.php b/tests/cases/Misc/TestURL.php index 087e8105..fcacf794 100644 --- a/tests/cases/Misc/TestURL.php +++ b/tests/cases/Misc/TestURL.php @@ -16,7 +16,7 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, URL::normalize($url, $user, $pass)); } - public function provideNormalizations(): iterable { + public static function provideNormalizations(): iterable { return [ ["http://example.com/", "http://example.com/"], ["HTTP://example.com/", "http://example.com/"], @@ -78,7 +78,7 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, URL::queryAppend($url, $query)); } - public function provideQueries(): iterable { + public static function provideQueries(): iterable { return [ ["/", "ook=eek", "/?ook=eek"], ["/?", "ook=eek", "/?ook=eek"], @@ -94,7 +94,7 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, URL::absolute($url)); } - public function provideAbsolutes(): array { + public static function provideAbsolutes(): array { return [ [true, "http://example.com/"], [true, "HTTP://example.com/"], diff --git a/tests/cases/Misc/TestValueInfo.php b/tests/cases/Misc/TestValueInfo.php index ed03d34c..0bcb4177 100644 --- a/tests/cases/Misc/TestValueInfo.php +++ b/tests/cases/Misc/TestValueInfo.php @@ -425,7 +425,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideSimpleNormalizationValues(): iterable { + public static function provideSimpleNormalizationValues(): iterable { $types = [ "Mixed", "Null", @@ -458,9 +458,9 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { /* Input value null bool int float string array interval */ [null, [null,true], [false,false], [0, false], [0.0, false], ["", false], [[], false], [null, false]], ["", [null,true], [false,true], [0, false], [0.0, false], ["", true], [[""], false], [null, false]], - [1, [null,true], [true, true], [1, true], [1.0, true], ["1", true], [[1], false], [$this->i("PT1S"), false]], - [PHP_INT_MAX, [null,true], [true, false], [PHP_INT_MAX, true], [(float) PHP_INT_MAX, true], [(string) PHP_INT_MAX, true], [[PHP_INT_MAX], false], [$this->i("P292471208677Y195DT15H30M7S"), false]], - [1.0, [null,true], [true, true], [1, true], [1.0, true], ["1", true], [[1.0], false], [$this->i("PT1S"), false]], + [1, [null,true], [true, true], [1, true], [1.0, true], ["1", true], [[1], false], [self::i("PT1S"), false]], + [PHP_INT_MAX, [null,true], [true, false], [PHP_INT_MAX, true], [(float) PHP_INT_MAX, true], [(string) PHP_INT_MAX, true], [[PHP_INT_MAX], false], [self::i("P292471208677Y195DT15H30M7S"), false]], + [1.0, [null,true], [true, true], [1, true], [1.0, true], ["1", true], [[1.0], false], [self::i("PT1S"), false]], ["1.0", [null,true], [true, true], [1, true], [1.0, true], ["1.0", true], [["1.0"], false], [null, false]], ["001.0", [null,true], [true, true], [1, true], [1.0, true], ["001.0", true], [["001.0"], false], [null, false]], ["1.0e2", [null,true], [true, false], [100, true], [100.0, true], ["1.0e2", true], [["1.0e2"], false], [null, false]], @@ -473,28 +473,28 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { ["+1", [null,true], [true, true], [1, true], [1.0, true], ["+1", true], [["+1"], false], [null, false]], ["+001", [null,true], [true, true], [1, true], [1.0, true], ["+001", true], [["+001"], false], [null, false]], ["+1e2", [null,true], [true, false], [100, true], [100.0, true], ["+1e2", true], [["+1e2"], false], [null, false]], - [0, [null,true], [false,true], [0, true], [0.0, true], ["0", true], [[0], false], [$this->i("PT0S"), false]], + [0, [null,true], [false,true], [0, true], [0.0, true], ["0", true], [[0], false], [self::i("PT0S"), false]], ["0", [null,true], [false,true], [0, true], [0.0, true], ["0", true], [["0"], false], [null, false]], ["000", [null,true], [false,true], [0, true], [0.0, true], ["000", true], [["000"], false], [null, false]], - [0.0, [null,true], [false,true], [0, true], [0.0, true], ["0", true], [[0.0], false], [$this->i("PT0S"), false]], + [0.0, [null,true], [false,true], [0, true], [0.0, true], ["0", true], [[0.0], false], [self::i("PT0S"), false]], ["0.0", [null,true], [false,true], [0, true], [0.0, true], ["0.0", true], [["0.0"], false], [null, false]], ["000.000", [null,true], [false,true], [0, true], [0.0, true], ["000.000", true], [["000.000"], false], [null, false]], ["+0", [null,true], [false,true], [0, true], [0.0, true], ["+0", true], [["+0"], false], [null, false]], ["+000", [null,true], [false,true], [0, true], [0.0, true], ["+000", true], [["+000"], false], [null, false]], ["+0.0", [null,true], [false,true], [0, true], [0.0, true], ["+0.0", true], [["+0.0"], false], [null, false]], ["+000.000", [null,true], [false,true], [0, true], [0.0, true], ["+000.000", true], [["+000.000"], false], [null, false]], - [-1, [null,true], [true, false], [-1, true], [-1.0, true], ["-1", true], [[-1], false], [$this->i("PT1S"), false]], - [-1.0, [null,true], [true, false], [-1, true], [-1.0, true], ["-1", true], [[-1.0], false], [$this->i("PT1S"), false]], + [-1, [null,true], [true, false], [-1, true], [-1.0, true], ["-1", true], [[-1], false], [self::i("PT1S"), false]], + [-1.0, [null,true], [true, false], [-1, true], [-1.0, true], ["-1", true], [[-1.0], false], [self::i("PT1S"), false]], ["-1.0", [null,true], [true, false], [-1, true], [-1.0, true], ["-1.0", true], [["-1.0"], false], [null, false]], ["-001.0", [null,true], [true, false], [-1, true], [-1.0, true], ["-001.0", true], [["-001.0"], false], [null, false]], ["-1.0e2", [null,true], [true, false], [-100, true], [-100.0, true], ["-1.0e2", true], [["-1.0e2"], false], [null, false]], ["-1", [null,true], [true, false], [-1, true], [-1.0, true], ["-1", true], [["-1"], false], [null, false]], ["-001", [null,true], [true, false], [-1, true], [-1.0, true], ["-001", true], [["-001"], false], [null, false]], ["-1e2", [null,true], [true, false], [-100, true], [-100.0, true], ["-1e2", true], [["-1e2"], false], [null, false]], - [-0, [null,true], [false,true], [0, true], [0.0, true], ["0", true], [[-0], false], [$this->i("PT0S"), false]], + [-0, [null,true], [false,true], [0, true], [0.0, true], ["0", true], [[-0], false], [self::i("PT0S"), false]], ["-0", [null,true], [false,true], [0, true], [-0.0, true], ["-0", true], [["-0"], false], [null, false]], ["-000", [null,true], [false,true], [0, true], [-0.0, true], ["-000", true], [["-000"], false], [null, false]], - [-0.0, [null,true], [false,true], [0, true], [-0.0, true], ["-0", true], [[-0.0], false], [$this->i("PT0S"), false]], + [-0.0, [null,true], [false,true], [0, true], [-0.0, true], ["-0", true], [[-0.0], false], [self::i("PT0S"), false]], ["-0.0", [null,true], [false,true], [0, true], [-0.0, true], ["-0.0", true], [["-0.0"], false], [null, false]], ["-000.000", [null,true], [false,true], [0, true], [-0.0, true], ["-000.000", true], [["-000.000"], false], [null, false]], [false, [null,true], [false,true], [0, false], [0.0, false], ["", false], [[false], false], [null, false]], @@ -518,25 +518,25 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { [new StrClass("-1"), [null,true], [true, false], [-1, true], [-1.0, true], ["-1", true], [[new StrClass("-1")], false], [null, false]], [new StrClass("Msg"), [null,true], [true, false], [0, false], [0.0, false], ["Msg", true], [[new StrClass("Msg")], false], [null, false]], [new StrClass(" "), [null,true], [true, false], [0, false], [0.0, false], [" ", true], [[new StrClass(" ")], false], [null, false]], - [2.5, [null,true], [true, false], [2, false], [2.5, true], ["2.5", true], [[2.5], false], [$this->i("PT2S", 0.5), false]], - [0.5, [null,true], [true, false], [0, false], [0.5, true], ["0.5", true], [[0.5], false], [$this->i("PT0S", 0.5), false]], + [2.5, [null,true], [true, false], [2, false], [2.5, true], ["2.5", true], [[2.5], false], [self::i("PT2S", 0.5), false]], + [0.5, [null,true], [true, false], [0, false], [0.5, true], ["0.5", true], [[0.5], false], [self::i("PT0S", 0.5), false]], ["2.5", [null,true], [true, false], [2, false], [2.5, true], ["2.5", true], [["2.5"], false], [null, false]], ["0.5", [null,true], [true, false], [0, false], [0.5, true], ["0.5", true], [["0.5"], false], [null, false]], - [$this->d("2010-01-01T00:00:00", 0, 0), [null,true], [true, false], [1262304000, false], [1262304000.0, false], ["2010-01-01T00:00:00Z",true], [[$this->d("2010-01-01T00:00:00", 0, 0)],false], [null, false]], - [$this->d("2010-01-01T00:00:00", 0, 1), [null,true], [true, false], [1262304000, false], [1262304000.0, false], ["2010-01-01T00:00:00Z",true], [[$this->d("2010-01-01T00:00:00", 0, 1)],false], [null, false]], - [$this->d("2010-01-01T00:00:00", 1, 0), [null,true], [true, false], [1262322000, false], [1262322000.0, false], ["2010-01-01T05:00:00Z",true], [[$this->d("2010-01-01T00:00:00", 1, 0)],false], [null, false]], - [$this->d("2010-01-01T00:00:00", 1, 1), [null,true], [true, false], [1262322000, false], [1262322000.0, false], ["2010-01-01T05:00:00Z",true], [[$this->d("2010-01-01T00:00:00", 1, 1)],false], [null, false]], - [1e14, [null,true], [true, false], [10 ** 14, true], [1e14, true], ["100000000000000", true], [[1e14], false], [$this->i("P1157407407DT9H46M40S"), false]], - [1e-6, [null,true], [true, false], [0, false], [1e-6, true], ["0.000001", true], [[1e-6], false], [$this->i("PT0S", 1e-6), false]], + [self::d("2010-01-01T00:00:00", 0, 0), [null,true], [true, false], [1262304000, false], [1262304000.0, false], ["2010-01-01T00:00:00Z",true], [[self::d("2010-01-01T00:00:00", 0, 0)],false], [null, false]], + [self::d("2010-01-01T00:00:00", 0, 1), [null,true], [true, false], [1262304000, false], [1262304000.0, false], ["2010-01-01T00:00:00Z",true], [[self::d("2010-01-01T00:00:00", 0, 1)],false], [null, false]], + [self::d("2010-01-01T00:00:00", 1, 0), [null,true], [true, false], [1262322000, false], [1262322000.0, false], ["2010-01-01T05:00:00Z",true], [[self::d("2010-01-01T00:00:00", 1, 0)],false], [null, false]], + [self::d("2010-01-01T00:00:00", 1, 1), [null,true], [true, false], [1262322000, false], [1262322000.0, false], ["2010-01-01T05:00:00Z",true], [[self::d("2010-01-01T00:00:00", 1, 1)],false], [null, false]], + [1e14, [null,true], [true, false], [10 ** 14, true], [1e14, true], ["100000000000000", true], [[1e14], false], [self::i("P1157407407DT9H46M40S"), false]], + [1e-6, [null,true], [true, false], [0, false], [1e-6, true], ["0.000001", true], [[1e-6], false], [self::i("PT0S", 1e-6), false]], [[1,2,3], [null,true], [true, false], [0, false], [0.0, false], ["", false], [[1,2,3], true], [null, false]], [['a' => 1,'b' => 2], [null,true], [true, false], [0, false], [0.0, false], ["", false], [['a' => 1,'b' => 2], true], [null, false]], [new Result([['a' => 1,'b' => 2]]), [null,true], [true, false], [0, false], [0.0, false], ["", false], [[['a' => 1,'b' => 2]], true], [null, false]], - [$this->i("PT1H"), [null,true], [true, false], [60 * 60, false], [60.0 * 60.0, false], ["PT1H", true], [[$this->i("PT1H")], false], [$this->i("PT1H"), 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]], + [self::i("PT1H"), [null,true], [true, false], [60 * 60, false], [60.0 * 60.0, false], ["PT1H", true], [[self::i("PT1H")], false], [self::i("PT1H"), true]], + [self::i("P2DT1H"), [null,true], [true, false], [(48 + 1) * 60 * 60, false], [1.0 * (48 + 1) * 60 * 60, false], ["P2DT1H", true], [[self::i("P2DT1H")], false], [self::i("P2DT1H"), true]], + [self::i("PT0H"), [null,true], [true, false], [0, false], [0.0, false], ["PT0S", true], [[self::i("PT0H")], false], [self::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]], - ["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]], + ["1 year, 2 days", [null,true], [true, false], [0, false], [0.0, false], ["1 year, 2 days", true], [["1 year, 2 days"], false], [self::i("P1Y2D"), false]], + ["P1Y2D", [null,true], [true, false], [0, false], [0.0, false], ["P1Y2D", true], [["P1Y2D"], false], [self::i("P1Y2D"), true]], ] as $set) { // shift the input value off the set $input = array_shift($set); @@ -557,7 +557,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideDateNormalizationValues(): iterable { + public static function provideDateNormalizationValues(): iterable { $formats = [ "microtime", "iso8601", @@ -576,33 +576,33 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { [null, null, null, null, null, null, null, null, null, null, null, null], [INF, null, null, null, null, null, null, null, null, null, null, null], [NAN, null, null, null, null, null, null, null, null, null, null, null], - [$this->d("2010-01-01T00:00:00", 0, 0), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000)], - [$this->d("2010-01-01T00:00:00", 0, 1), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000)], - [$this->d("2010-01-01T00:00:00", 1, 0), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000)], - [$this->d("2010-01-01T00:00:00", 1, 1), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000)], - [1262304000, $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000)], - [1262304000.123456, $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456)], - [1262304000.42, $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42)], - ["0.12345600 1262304000", $this->t(1262304000.123456), null, null, null, null, null, null, null, null, null, null], + [self::d("2010-01-01T00:00:00", 0, 0), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000)], + [self::d("2010-01-01T00:00:00", 0, 1), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000)], + [self::d("2010-01-01T00:00:00", 1, 0), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000)], + [self::d("2010-01-01T00:00:00", 1, 1), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000), self::t(1262322000)], + [1262304000, self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000), self::t(1262304000)], + [1262304000.123456, self::t(1262304000.123456), self::t(1262304000.123456), self::t(1262304000.123456), self::t(1262304000.123456), self::t(1262304000.123456), self::t(1262304000.123456), self::t(1262304000.123456), self::t(1262304000.123456), self::t(1262304000.123456), self::t(1262304000.123456), self::t(1262304000.123456)], + [1262304000.42, self::t(1262304000.42), self::t(1262304000.42), self::t(1262304000.42), self::t(1262304000.42), self::t(1262304000.42), self::t(1262304000.42), self::t(1262304000.42), self::t(1262304000.42), self::t(1262304000.42), self::t(1262304000.42), self::t(1262304000.42)], + ["0.12345600 1262304000", self::t(1262304000.123456), null, null, null, null, null, null, null, null, null, null], ["0.42 1262304000", null, null, null, null, null, null, null, null, null, null, null], - ["2010-01-01T00:00:00", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000)], - ["2010-01-01T00:00:00Z", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000)], - ["2010-01-01T00:00:00+0000", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000)], - ["2010-01-01T00:00:00-0000", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000)], - ["2010-01-01T00:00:00+00:00", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000)], - ["2010-01-01T00:00:00-05:00", null, $this->t(1262322000), $this->t(1262322000), null, null, null, null, null, null, null, $this->t(1262322000)], - ["2010-01-01T00:00:00.123456Z", null, null, $this->t(1262304000.123456), null, null, null, null, null, null, null, $this->t(1262304000.123456)], - ["Fri, 01 Jan 2010 00:00:00 GMT", null, null, null, $this->t(1262304000), null, null, null, null, null, null, $this->t(1262304000)], - ["2010-01-01 00:00:00", null, null, null, null, $this->t(1262304000), null, null, null, null, null, $this->t(1262304000)], - ["2010-01-01", null, null, null, null, null, $this->t(1262304000), null, null, null, null, $this->t(1262304000)], - ["12:34:56", null, null, null, null, null, null, $this->t(45296), null, null, null, $this->t(date_create("today", new \DateTimezone("UTC"))->getTimestamp() + 45296)], - ["1262304000", null, null, null, null, null, null, null, $this->t(1262304000), null, null, null], - ["1262304000.123456", null, null, null, null, null, null, null, null, $this->t(1262304000.123456), null, null], - ["1262304000.42", null, null, null, null, null, null, null, null, $this->t(1262304000.42), null, null], - ["Jan 1, 2010 (Fri)", null, null, null, null, null, null, null, null, null, $this->t(1262304000), null], - ["First day of Jan 2010 12AM", null, null, null, null, null, null, null, null, null, null, $this->t(1262304000)], + ["2010-01-01T00:00:00", null, self::t(1262304000), self::t(1262304000), null, null, null, null, null, null, null, self::t(1262304000)], + ["2010-01-01T00:00:00Z", null, self::t(1262304000), self::t(1262304000), null, null, null, null, null, null, null, self::t(1262304000)], + ["2010-01-01T00:00:00+0000", null, self::t(1262304000), self::t(1262304000), null, null, null, null, null, null, null, self::t(1262304000)], + ["2010-01-01T00:00:00-0000", null, self::t(1262304000), self::t(1262304000), null, null, null, null, null, null, null, self::t(1262304000)], + ["2010-01-01T00:00:00+00:00", null, self::t(1262304000), self::t(1262304000), null, null, null, null, null, null, null, self::t(1262304000)], + ["2010-01-01T00:00:00-05:00", null, self::t(1262322000), self::t(1262322000), null, null, null, null, null, null, null, self::t(1262322000)], + ["2010-01-01T00:00:00.123456Z", null, null, self::t(1262304000.123456), null, null, null, null, null, null, null, self::t(1262304000.123456)], + ["Fri, 01 Jan 2010 00:00:00 GMT", null, null, null, self::t(1262304000), null, null, null, null, null, null, self::t(1262304000)], + ["2010-01-01 00:00:00", null, null, null, null, self::t(1262304000), null, null, null, null, null, self::t(1262304000)], + ["2010-01-01", null, null, null, null, null, self::t(1262304000), null, null, null, null, self::t(1262304000)], + ["12:34:56", null, null, null, null, null, null, self::t(45296), null, null, null, self::t(date_create("today", new \DateTimezone("UTC"))->getTimestamp() + 45296)], + ["1262304000", null, null, null, null, null, null, null, self::t(1262304000), null, null, null], + ["1262304000.123456", null, null, null, null, null, null, null, null, self::t(1262304000.123456), null, null], + ["1262304000.42", null, null, null, null, null, null, null, null, self::t(1262304000.42), null, null], + ["Jan 1, 2010 (Fri)", null, null, null, null, null, null, null, null, null, self::t(1262304000), null], + ["First day of Jan 2010 12AM", null, null, null, null, null, null, null, null, null, null, self::t(1262304000)], [[], null, null, null, null, null, null, null, null, null, null, null], - [$this->i("P1Y2D"), null, null, null, null, null, null, null, null, null, null, null], + [self::i("P1Y2D"), null, null, null, null, null, null, null, null, null, null, null], ["P1Y2D", null, null, null, null, null, null, null, null, null, null, null], ] as $k => $set) { // shift the input value off the set @@ -622,7 +622,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - protected function d($spec, $local, $immutable): \DateTimeInterface { + protected static function d($spec, $local, $immutable): \DateTimeInterface { $tz = $local ? new \DateTimeZone("America/Toronto") : new \DateTimeZone("UTC"); if ($immutable) { return \DateTimeImmutable::createFromFormat("!Y-m-d\TH:i:s", $spec, $tz); @@ -631,11 +631,11 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - protected function t(float $spec): \DateTimeImmutable { + protected static function t(float $spec): \DateTimeImmutable { return \DateTimeImmutable::createFromFormat("U.u", sprintf("%F", $spec), new \DateTimeZone("UTC")); } - protected function i(string $spec, float $msec = 0.0): \DateInterval { + protected static function i(string $spec, float $msec = 0.0): \DateInterval { $out = new \DateInterval($spec); $out->f = $msec; return $out; diff --git a/tests/cases/REST/Fever/TestAPI.php b/tests/cases/REST/Fever/TestAPI.php index 4cea91cf..da71c1c5 100644 --- a/tests/cases/REST/Fever/TestAPI.php +++ b/tests/cases/REST/Fever/TestAPI.php @@ -141,7 +141,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { ], ]; - protected function v($value) { + protected static function v($value) { return $value; } @@ -187,7 +187,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req($dataGet, $dataPost, "POST", null, "", $httpUser)); } - public function provideTokenAuthenticationRequests(): iterable { + public static function provideTokenAuthenticationRequests(): iterable { $success = HTTP::respJson(['auth' => 1]); $failure = HTTP::respJson(['auth' => 0]); $denied = HTTP::respEmpty(401); @@ -305,7 +305,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->articleList($this->userId, $this->equalTo($c), $fields, $order); } - public function provideItemListContexts(): iterable { + public static function provideItemListContexts(): iterable { $c = (new Context)->limit(50); return [ ["items", (clone $c)->hidden(false), false], @@ -372,7 +372,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideMarkingContexts(): iterable { + public static function provideMarkingContexts(): iterable { $markRead = ['read' => true]; $markUnread = ['read' => false]; $markSaved = ['starred' => true]; @@ -415,7 +415,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req($get, $post, $method, $type)); } - public function provideInvalidRequests(): iterable { + public static function provideInvalidRequests(): iterable { return [ 'Not an API request' => ["", "", "POST", null, HTTP::respEmpty(404)], 'Wrong method' => ["api", "", "PUT", null, HTTP::respEmpty(405, ['Allow' => "OPTIONS,POST"])], @@ -476,7 +476,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { public function testListFeedIcons(): void { $iconType = (new \ReflectionClassConstant(API::class, "GENERIC_ICON_TYPE"))->getValue(); $iconData = (new \ReflectionClassConstant(API::class, "GENERIC_ICON_DATA"))->getValue(); - \Phake::when(Arsse::$db)->iconList->thenReturn(new Result($this->v([ + \Phake::when(Arsse::$db)->iconList->thenReturn(new Result(self::v([ ['id' => 42, 'type' => "image/svg+xml", 'data' => ""], ['id' => 44, 'type' => null, 'data' => "IMAGE DATA"], ['id' => 47, 'type' => null, 'data' => null], diff --git a/tests/cases/REST/Fever/TestUser.php b/tests/cases/REST/Fever/TestUser.php index e6198bc8..171b67f3 100644 --- a/tests/cases/REST/Fever/TestUser.php +++ b/tests/cases/REST/Fever/TestUser.php @@ -53,7 +53,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePasswordCreations(): iterable { + public static function providePasswordCreations(): iterable { return [ ["jane.doe@example.com", "secret", "secret"], ["jane.doe@example.com", "superman", "superman"], @@ -81,7 +81,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $this->h->authenticate($user, $password)); } - public function provideUserAuthenticationRequests(): iterable { + public static function provideUserAuthenticationRequests(): iterable { return [ ["jane.doe@example.com", "secret", true], ["jane.doe@example.com", "superman", false], diff --git a/tests/cases/REST/Miniflux/TestStatus.php b/tests/cases/REST/Miniflux/TestStatus.php index 60aa91a9..92da3188 100644 --- a/tests/cases/REST/Miniflux/TestStatus.php +++ b/tests/cases/REST/Miniflux/TestStatus.php @@ -20,7 +20,7 @@ class TestStatus extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function provideRequests(): iterable { + public static function provideRequests(): iterable { return [ ["/version", "GET", HTTP::respText(V1::VERSION)], ["/version", "POST", HTTP::respEmpty(405, ['Allow' => "HEAD, GET"])], diff --git a/tests/cases/REST/Miniflux/TestToken.php b/tests/cases/REST/Miniflux/TestToken.php index 477a35e6..6ddd3f48 100644 --- a/tests/cases/REST/Miniflux/TestToken.php +++ b/tests/cases/REST/Miniflux/TestToken.php @@ -32,7 +32,7 @@ class TestToken extends \JKingWeb\Arsse\Test\AbstractTest { $this->h = new Token; } - protected function v($value) { + protected static function v($value) { return $value; } @@ -54,7 +54,7 @@ class TestToken extends \JKingWeb\Arsse\Test\AbstractTest { ['label' => "Eek", 'id' => "TOKEN 2"], ['label' => "Ack", 'id' => "TOKEN 3"], ]; - \Phake::when(Arsse::$db)->tokenList->thenReturn(new Result($this->v($out))); + \Phake::when(Arsse::$db)->tokenList->thenReturn(new Result(self::v($out))); \Phake::when(Arsse::$db)->userExists->thenReturn(true); $this->assertSame($exp, $this->h->tokenList("john.doe@example.com")); \Phake::verify(Arsse::$db)->tokenList("john.doe@example.com", "miniflux.login"); diff --git a/tests/cases/REST/Miniflux/TestV1.php b/tests/cases/REST/Miniflux/TestV1.php index 02a9918b..609004fa 100644 --- a/tests/cases/REST/Miniflux/TestV1.php +++ b/tests/cases/REST/Miniflux/TestV1.php @@ -87,7 +87,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { $this->h = new V1(); } - protected function v($value) { + protected static function v($value) { return $value; } @@ -113,7 +113,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($success ? $user : null, Arsse::$user->id); } - public function provideAuthResponses(): iterable { + public static function provideAuthResponses(): iterable { return [ [null, false, false], [null, true, true], @@ -134,7 +134,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req($method, $path)); } - public function provideInvalidPaths(): array { + public static function provideInvalidPaths(): array { return [ ["/", "GET", 404], ["/", "OPTIONS", 404], @@ -152,7 +152,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("OPTIONS", $url)); } - public function provideOptionsRequests(): array { + public static function provideOptionsRequests(): array { return [ ["/feeds", "HEAD, GET, POST", "application/json"], ["/feeds/2112", "HEAD, GET, PUT, DELETE", "application/json"], @@ -177,7 +177,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("POST", "/discover", ['url' => $in])); } - public function provideDiscoveries(): iterable { + public static function provideDiscoveries(): iterable { self::clearData(); $discovered = [ ['title' => "Feed", 'type' => "rss", 'url' => "http://localhost:8000/Feed/Discovery/Feed"], @@ -212,7 +212,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("GET", $route, "", [], $user)); } - public function provideUserQueries(): iterable { + public static function provideUserQueries(): iterable { self::clearData(); return [ [true, "/users", HTTP::respJson(self::USERS)], @@ -279,7 +279,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideUserModifications(): iterable { + public static function provideUserModifications(): iterable { $out1 = ['num' => 2, 'admin' => false]; $out2 = ['num' => 1, 'admin' => false]; $resp1 = array_merge(self::USERS[1], ['username' => "john.doe@example.com"]); @@ -332,7 +332,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideUserAdditions(): iterable { + public static function provideUserAdditions(): iterable { $resp1 = array_merge(self::USERS[1], ['username' => "ook", 'password' => "eek"]); return [ [[], null, null, null, null, V1::respError(["MissingInputValue", 'field' => "username"], 422)], @@ -376,7 +376,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } public function testListCategories(): void { - \Phake::when(Arsse::$db)->folderList->thenReturn(new Result($this->v([ + \Phake::when(Arsse::$db)->folderList->thenReturn(new Result(self::v([ ['id' => 1, 'name' => "Science"], ['id' => 20, 'name' => "Technology"], ]))); @@ -412,7 +412,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("POST", "/categories", ['title' => $title])); } - public function provideCategoryAdditions(): iterable { + public static function provideCategoryAdditions(): iterable { return [ ["New", HTTP::respJson(['id' => 2112, 'title' => "New", 'user_id' => 42], 201)], ["Duplicate", V1::respError(["DuplicateCategory", 'title' => "Duplicate"], 409)], @@ -438,7 +438,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db, \Phake::times($times))->folderPropertiesSet("john.doe@example.com", $id - 1, ['name' => $title]); } - public function provideCategoryUpdates(): iterable { + public static function provideCategoryUpdates(): iterable { return [ [3, "New", "subjectMissing", V1::respError("404", 404)], [2, "New", true, HTTP::respJson(['id' => 2, 'title' => "New", 'user_id' => 42], 201)], @@ -465,7 +465,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } public function testDeleteTheSpecialCategory(): void { - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v([ + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v([ ['id' => 1], ['id' => 47], ['id' => 2112], @@ -483,20 +483,20 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } public function testListFeeds(): void { - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v(self::FEEDS))); + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v(self::FEEDS))); $exp = HTTP::respJson(self::FEEDS_OUT); $this->assertMessage($exp, $this->req("GET", "/feeds")); } public function testListFeedsOfACategory(): void { - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v(self::FEEDS))); + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v(self::FEEDS))); $exp = HTTP::respJson(self::FEEDS_OUT); $this->assertMessage($exp, $this->req("GET", "/categories/2112/feeds")); \Phake::verify(Arsse::$db)->subscriptionList(Arsse::$user->id, 2111, true); } public function testListFeedsOfTheRootCategory(): void { - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v(self::FEEDS))); + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v(self::FEEDS))); $exp = HTTP::respJson(self::FEEDS_OUT); $this->assertMessage($exp, $this->req("GET", "/categories/1/feeds")); \Phake::verify(Arsse::$db)->subscriptionList(Arsse::$user->id, 0, false); @@ -510,7 +510,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } public function testGetAFeed(): void { - \Phake::when(Arsse::$db)->subscriptionPropertiesGet->thenReturn($this->v(self::FEEDS[0]))->thenReturn($this->v(self::FEEDS[1])); + \Phake::when(Arsse::$db)->subscriptionPropertiesGet->thenReturn(self::v(self::FEEDS[0]))->thenReturn(self::v(self::FEEDS[1])); $this->assertMessage(HTTP::respJson(self::FEEDS_OUT[0]), $this->req("GET", "/feeds/1")); $this->assertMessage(HTTP::respJson(self::FEEDS_OUT[1]), $this->req("GET", "/feeds/55")); \Phake::when(Arsse::$db)->subscriptionPropertiesGet(Arsse::$user->id, 1); @@ -582,7 +582,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideFeedCreations(): iterable { + public static function provideFeedCreations(): iterable { self::clearData(); return [ [['category_id' => 1], null, null, null, null, V1::respError(["MissingInputValue", 'field' => "feed_url"], 422)], @@ -627,7 +627,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->subscriptionPropertiesSet(Arsse::$user->id, 2112, $data); } - public function provideFeedModifications(): iterable { + public static function provideFeedModifications(): iterable { self::clearData(); $success = HTTP::respJson(self::FEEDS_OUT[0], 201); return [ @@ -669,13 +669,13 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { if ($out instanceof \Exception) { \Phake::when(Arsse::$db)->subscriptionIcon->thenThrow($out); } else { - \Phake::when(Arsse::$db)->subscriptionIcon->thenReturn($this->v($out)); + \Phake::when(Arsse::$db)->subscriptionIcon->thenReturn(self::v($out)); } $this->assertMessage($exp, $this->req("GET", "/feeds/2112/icon")); \Phake::verify(Arsse::$db)->subscriptionIcon(Arsse::$user->id, 2112); } - public function provideIcons(): iterable { + public static function provideIcons(): iterable { return [ [['id' => 44, 'type' => "image/svg+xml", 'data' => ""], HTTP::respJson(['id' => 44, 'data' => "image/svg+xml;base64,PHN2Zy8+", 'mime_type' => "image/svg+xml"])], [['id' => 47, 'type' => "", 'data' => ""], V1::respError("404", 404)], @@ -688,12 +688,12 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { /** @dataProvider provideEntryQueries */ public function testGetEntries(string $url, ?RootContext $c, ?array $order, $out, bool $count, ResponseInterface $exp): void { - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v(self::FEEDS))); + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v(self::FEEDS))); \Phake::when(Arsse::$db)->articleCount->thenReturn(2112); if ($out instanceof \Exception) { \Phake::when(Arsse::$db)->articleList->thenThrow($out); } else { - \Phake::when(Arsse::$db)->articleList->thenReturn(new Result($this->v($out))); + \Phake::when(Arsse::$db)->articleList->thenReturn(new Result(self::v($out))); } $this->assertMessage($exp, $this->req("GET", $url)); if ($c) { @@ -713,7 +713,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideEntryQueries(): iterable { + public static function provideEntryQueries(): iterable { self::clearData(); $c = (new Context)->limit(100); $o = ["modified_date"]; // the default sort order @@ -779,11 +779,11 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { /** @dataProvider provideSingleEntryQueries */ public function testGetASingleEntry(string $url, Context $c, $out, ResponseInterface $exp): void { - \Phake::when(Arsse::$db)->subscriptionPropertiesGet->thenReturn($this->v(self::FEEDS[1])); + \Phake::when(Arsse::$db)->subscriptionPropertiesGet->thenReturn(self::v(self::FEEDS[1])); if ($out instanceof \Exception) { \Phake::when(Arsse::$db)->articleList->thenThrow($out); } else { - \Phake::when(Arsse::$db)->articleList->thenReturn(new Result($this->v($out))); + \Phake::when(Arsse::$db)->articleList->thenReturn(new Result(self::v($out))); } $this->assertMessage($exp, $this->req("GET", $url)); if ($c) { @@ -798,7 +798,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideSingleEntryQueries(): iterable { + public static function provideSingleEntryQueries(): iterable { self::clearData(); $c = new Context; return [ @@ -827,7 +827,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideEntryMarkings(): iterable { + public static function provideEntryMarkings(): iterable { self::clearData(); return [ [['status' => "read"], null, V1::respError(["MissingInputValue", 'field' => "entry_ids"], 422)], @@ -859,7 +859,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideMassMarkings(): iterable { + public static function provideMassMarkings(): iterable { self::clearData(); $c = (new Context)->hidden(false); return [ @@ -900,7 +900,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideBookmarkTogglings(): iterable { + public static function provideBookmarkTogglings(): iterable { self::clearData(); return [ [1, true, HTTP::respEmpty(204)], @@ -935,7 +935,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($opml)->import(Arsse::$user->id, "IMPORT DATA"); } - public function provideImports(): iterable { + public static function provideImports(): iterable { self::clearData(); return [ [new ImportException("invalidSyntax"), V1::respError("InvalidBodyXML", 400)], diff --git a/tests/cases/REST/NextcloudNews/TestV1_2.php b/tests/cases/REST/NextcloudNews/TestV1_2.php index 5cb4b05a..8fe1dc62 100644 --- a/tests/cases/REST/NextcloudNews/TestV1_2.php +++ b/tests/cases/REST/NextcloudNews/TestV1_2.php @@ -24,7 +24,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { protected $h; protected $transaction; protected $userId; - protected $feeds = [ // expected sample output of a feed list from the database, and the resultant expected transformation by the REST handler + protected static $feeds = [ // expected sample output of a feed list from the database, and the resultant expected transformation by the REST handler 'db' => [ [ 'id' => 2112, @@ -117,7 +117,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ], ], ]; - protected $articles = [ + protected static $articles = [ 'db' => [ [ 'id' => 101, @@ -328,7 +328,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->h = new V1_2(); } - protected function v($value) { + protected static function v($value) { return $value; } @@ -343,7 +343,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req($method, $path)); } - public function provideInvalidPaths(): array { + public static function provideInvalidPaths(): array { return [ ["/", "GET", 404], ["/", "POST", 404], @@ -387,7 +387,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->req("OPTIONS", $url)); } - public function provideOptionsRequests(): array { + public static function provideOptionsRequests(): array { return [ ["/feeds", "HEAD,GET,POST", "application/json"], ["/feeds/2112", "DELETE", "application/json"], @@ -404,7 +404,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { ['id' => 1, 'name' => "Software"], ['id' => 12, 'name' => "Hardware"], ]; - \Phake::when(Arsse::$db)->folderList($this->userId, null, false)->thenReturn(new Result($this->v($list))); + \Phake::when(Arsse::$db)->folderList($this->userId, null, false)->thenReturn(new Result(self::v($list))); $exp = HTTP::respJson(['folders' => $out]); $this->assertMessage($exp, $this->req("GET", "/folders")); } @@ -415,7 +415,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::when(Arsse::$db)->folderAdd->thenThrow($output); } else { \Phake::when(Arsse::$db)->folderAdd->thenReturn($output); - \Phake::when(Arsse::$db)->folderPropertiesGet->thenReturn($this->v(['id' => $output, 'name' => $input['name'], 'parent' => null])); + \Phake::when(Arsse::$db)->folderPropertiesGet->thenReturn(self::v(['id' => $output, 'name' => $input['name'], 'parent' => null])); } $act = $this->req("POST", "/folders", $input, [], true, $body); $this->assertMessage($exp, $act); @@ -427,7 +427,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideFolderCreations(): array { + public static function provideFolderCreations(): array { return [ [['name' => "Software"], true, 1, HTTP::respJson(['folders' => [['id' => 1, 'name' => "Software"]]])], [['name' => "Software"], false, 1, HTTP::respJson(['folders' => [['id' => 1, 'name' => "Software"]]])], @@ -462,7 +462,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->folderPropertiesSet($this->userId, $id, $input); } - public function provideFolderRenamings(): array { + public static function provideFolderRenamings(): array { return [ [['name' => "Software"], 1, true, HTTP::respEmpty(204)], [['name' => "Software"], 2, new ExceptionInput("constraintViolation"), HTTP::respEmpty(409)], @@ -487,12 +487,12 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { 'starredCount' => 0, ]; $exp2 = [ - 'feeds' => $this->feeds['rest'], + 'feeds' => self::$feeds['rest'], 'starredCount' => 5, 'newestItemId' => 4758915, ]; - \Phake::when(Arsse::$db)->subscriptionList($this->userId)->thenReturn(new Result([]))->thenReturn(new Result($this->v($this->feeds['db']))); - \Phake::when(Arsse::$db)->articleStarred($this->userId)->thenReturn($this->v(['total' => 0]))->thenReturn($this->v(['total' => 5])); + \Phake::when(Arsse::$db)->subscriptionList($this->userId)->thenReturn(new Result([]))->thenReturn(new Result(self::v(self::$feeds['db']))); + \Phake::when(Arsse::$db)->articleStarred($this->userId)->thenReturn(self::v(['total' => 0]))->thenReturn(self::v(['total' => 5])); \Phake::when(Arsse::$db)->editionLatest($this->userId)->thenReturn(0)->thenReturn(4758915); $exp = HTTP::respJson($exp1); $this->assertMessage($exp, $this->req("GET", "/feeds")); @@ -512,7 +512,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } else { \Phake::when(Arsse::$db)->subscriptionPropertiesSet->thenReturn($moveOutcome); } - \Phake::when(Arsse::$db)->subscriptionPropertiesGet->thenReturn($this->v($output)); + \Phake::when(Arsse::$db)->subscriptionPropertiesGet->thenReturn(self::v($output)); \Phake::when(Arsse::$db)->editionLatest->thenReturn($latestEdition); $act = $this->req("POST", "/feeds", $input); $this->assertMessage($exp, $act); @@ -532,15 +532,15 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideNewSubscriptions(): array { + public static function provideNewSubscriptions(): array { $feedException = new \JKingWeb\Arsse\Feed\Exception("", [], new \PicoFeed\Reader\SubscriptionNotFoundException); return [ - [['url' => "http://example.com/news.atom", 'folderId' => 3], 2112, 0, $this->feeds['db'][0], new ExceptionInput("idMissing"), HTTP::respJson(['feeds' => [$this->feeds['rest'][0]]])], - [['url' => "http://example.org/news.atom", 'folderId' => 8], 42, 4758915, $this->feeds['db'][1], true, HTTP::respJson(['feeds' => [$this->feeds['rest'][1]], 'newestItemId' => 4758915])], - [['url' => "http://example.com/news.atom", 'folderId' => 3], new ExceptionInput("constraintViolation"), 0, $this->feeds['db'][0], new ExceptionInput("idMissing"), HTTP::respEmpty(409)], - [['url' => "http://example.org/news.atom", 'folderId' => 8], new ExceptionInput("constraintViolation"), 4758915, $this->feeds['db'][1], true, HTTP::respEmpty(409)], + [['url' => "http://example.com/news.atom", 'folderId' => 3], 2112, 0, self::$feeds['db'][0], new ExceptionInput("idMissing"), HTTP::respJson(['feeds' => [self::$feeds['rest'][0]]])], + [['url' => "http://example.org/news.atom", 'folderId' => 8], 42, 4758915, self::$feeds['db'][1], true, HTTP::respJson(['feeds' => [self::$feeds['rest'][1]], 'newestItemId' => 4758915])], + [['url' => "http://example.com/news.atom", 'folderId' => 3], new ExceptionInput("constraintViolation"), 0, self::$feeds['db'][0], new ExceptionInput("idMissing"), HTTP::respEmpty(409)], + [['url' => "http://example.org/news.atom", 'folderId' => 8], new ExceptionInput("constraintViolation"), 4758915, self::$feeds['db'][1], true, HTTP::respEmpty(409)], [[], $feedException, 0, [], false, HTTP::respEmpty(422)], - [['url' => "http://example.net/news.atom", 'folderId' => -1], 47, 2112, $this->feeds['db'][2], new ExceptionInput("typeViolation"), HTTP::respJson(['feeds' => [$this->feeds['rest'][2]], 'newestItemId' => 2112])], + [['url' => "http://example.net/news.atom", 'folderId' => -1], 47, 2112, self::$feeds['db'][2], new ExceptionInput("typeViolation"), HTTP::respJson(['feeds' => [self::$feeds['rest'][2]], 'newestItemId' => 2112])], ]; } @@ -623,7 +623,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { 'userId' => "", ], ]; - \Phake::when(Arsse::$db)->feedListStale->thenReturn($this->v(array_column($out, "id"))); + \Phake::when(Arsse::$db)->feedListStale->thenReturn(self::v(array_column($out, "id"))); $exp = HTTP::respJson(['feeds' => $out]); $this->assertMessage($exp, $this->req("GET", "/feeds/all")); } @@ -676,11 +676,11 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->articleList($this->userId, $this->equalTo($c), $columns, [$order]); } - public function provideArticleQueries(): iterable { + public static function provideArticleQueries(): iterable { $c = (new Context)->hidden(false); $t = Date::normalize(time()); - $out = new Result($this->v($this->articles['db'])); - $r200 = HTTP::respJson(['items' => $this->articles['rest']]); + $out = new Result(self::v(self::$articles['db'])); + $r200 = HTTP::respJson(['items' => self::$articles['rest']]); $r422 = HTTP::respEmpty(422); return [ ["/items", [], clone $c, $out, $r200], @@ -901,8 +901,8 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $out2 = ['id' => 2, 'name' => "Hardware"]; \Phake::when(Arsse::$db)->folderAdd($this->anything(), $this->anything())->thenReturn(2); \Phake::when(Arsse::$db)->folderAdd($this->anything(), $in)->thenReturn(1); - \Phake::when(Arsse::$db)->folderPropertiesGet($this->userId, 1)->thenReturn($this->v($out1)); - \Phake::when(Arsse::$db)->folderPropertiesGet($this->userId, 2)->thenReturn($this->v($out2)); + \Phake::when(Arsse::$db)->folderPropertiesGet($this->userId, 1)->thenReturn(self::v($out1)); + \Phake::when(Arsse::$db)->folderPropertiesGet($this->userId, 2)->thenReturn(self::v($out2)); $exp = HTTP::respJson(['folders' => [$out1]]); $this->assertMessage($exp, $this->req("POST", $url, json_encode($in))); } diff --git a/tests/cases/REST/TestREST.php b/tests/cases/REST/TestREST.php index a1ffb918..4c14908b 100644 --- a/tests/cases/REST/TestREST.php +++ b/tests/cases/REST/TestREST.php @@ -33,7 +33,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals($exp, $out); } - public function provideApiMatchData(): iterable { + public static function provideApiMatchData(): iterable { $real = null; $fake = [ 'unstripped' => ['match' => "/full/url", 'strip' => "", 'class' => "UnstrippedProtocol"], @@ -78,7 +78,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function provideAuthenticableRequests(): iterable { + public static function provideAuthenticableRequests(): iterable { return [ [['PHP_AUTH_USER' => "john.doe@example.com", 'PHP_AUTH_PW' => "secret"], ['authenticated' => true, 'authenticatedUser' => "john.doe@example.com"]], [['PHP_AUTH_USER' => "john.doe@example.com", 'PHP_AUTH_PW' => "secret", 'REMOTE_USER' => "jane.doe@example.com"], ['authenticated' => true, 'authenticatedUser' => "john.doe@example.com"]], @@ -110,7 +110,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $act); } - public function provideUnnormalizedOrigins(): iterable { + public static function provideUnnormalizedOrigins(): iterable { return [ ["null", "null"], ["http://example.com", "http://example.com"], @@ -159,7 +159,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $act); } - public function provideCorsNegotiations(): iterable { + public static function provideCorsNegotiations(): iterable { return [ ["http://example", true ], ["http://example", true, "http://example", "*" ], @@ -194,7 +194,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function provideCorsHeaders(): iterable { + public static function provideCorsHeaders(): iterable { return [ ["GET", ['Origin' => "null"], [], [ 'Access-Control-Allow-Origin' => "null", @@ -262,7 +262,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function provideUnnormalizedResponses(): iterable { + public static function provideUnnormalizedResponses(): iterable { $stream = fopen("php://memory", "w+b"); fwrite($stream, "ook"); return [ @@ -312,7 +312,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($rMock)->normalizeResponse(\Phake::anyParameters()); } - public function provideMockRequests(): iterable { + public static function provideMockRequests(): iterable { return [ [new ServerRequest("GET", "/index.php/apps/news/api/v1-2/feeds"), "GET", true, NCN::class, "/feeds"], [new ServerRequest("GET", "/index.php/apps/news/api/v1-2/feeds"), "GET", true, NCN::class, "/feeds"], diff --git a/tests/cases/REST/TinyTinyRSS/TestAPI.php b/tests/cases/REST/TinyTinyRSS/TestAPI.php index bd3983a5..7a27a3fd 100644 --- a/tests/cases/REST/TinyTinyRSS/TestAPI.php +++ b/tests/cases/REST/TinyTinyRSS/TestAPI.php @@ -26,7 +26,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { protected const NOW = "2020-12-21T23:09:17.189065Z"; protected $h; - protected $userId = "john.doe@example.com"; + protected static $userId = "john.doe@example.com"; protected $folders = [ ['id' => 5, 'parent' => 3, 'children' => 0, 'feeds' => 1, 'name' => "Local"], ['id' => 6, 'parent' => 3, 'children' => 0, 'feeds' => 2, 'name' => "National"], @@ -101,7 +101,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { ], ]; // text from https://corrigeur.fr/lorem-ipsum-traduction-origine.php - protected $richContent = <<

Pour vous faire mieux @@ -124,7 +124,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { LONG_STRING; - protected function v($value) { + protected static function v($value) { return $value; } @@ -134,7 +134,7 @@ LONG_STRING; // create mock timestamps \Phake::when(Arsse::$obj)->get(\DateTimeImmutable::class)->thenReturn(new \DateTimeImmutable(self::NOW)); // create a mock user manager - $this->userId = "john.doe@example.com"; + self::$userId = "john.doe@example.com"; Arsse::$user = \Phake::mock(User::class); \Phake::when(Arsse::$user)->auth->thenReturn(true); // create a mock database interface @@ -145,13 +145,13 @@ LONG_STRING; 'id' => "PriestsOfSyrinx", 'created' => "2000-01-01 00:00:00", 'expires' => "2112-12-21 21:12:00", - 'user' => $this->userId, + 'user' => self::$userId, ]); $this->h = new API(); } protected function req($data, string $method = "POST", string $target = "", ?string $strData = null, ?string $user = null): ResponseInterface { - Arsse::$user->id = $this->userId; + Arsse::$user->id = self::$userId; $prefix = "/tt-rss/api"; $url = $prefix.$target; $body = $strData ?? json_encode($data); @@ -163,7 +163,7 @@ LONG_STRING; return $this->req($data, "POST", "", null, $user); } - protected function respGood($content = null, $seq = 0): ResponseInterface { + protected static function respGood($content = null, $seq = 0): ResponseInterface { return HTTP::respJson([ 'seq' => $seq, 'status' => 0, @@ -171,7 +171,7 @@ LONG_STRING; ]); } - protected function respErr(string $msg, $content = [], $seq = 0): ResponseInterface { + protected static function respErr(string $msg, $content = [], $seq = 0): ResponseInterface { $err = ['error' => $msg]; return HTTP::respJson([ 'seq' => $seq, @@ -181,7 +181,7 @@ LONG_STRING; } public function testHandleInvalidPaths(): void { - $exp = $this->respErr("MALFORMED_INPUT", [], null); + $exp = self::respErr("MALFORMED_INPUT", [], null); $this->assertMessage($exp, $this->req(null, "POST", "", "")); $this->assertMessage($exp, $this->req(null, "POST", "/", "")); $this->assertMessage($exp, $this->req(null, "POST", "/index.php", "")); @@ -198,14 +198,14 @@ LONG_STRING; } public function testHandleInvalidData(): void { - $exp = $this->respErr("MALFORMED_INPUT", [], null); + $exp = self::respErr("MALFORMED_INPUT", [], null); $this->assertMessage($exp, $this->req(null, "POST", "", "This is not valid JSON data")); $this->assertMessage($exp, $this->req(null, "POST", "", "")); // lack of data is also an error } /** @dataProvider provideLoginRequests */ public function testLogIn(array $conf, $httpUser, array $data, $sessions): void { - $this->userId = null; + self::$userId = null; self::setConf($conf); \Phake::when(Arsse::$user)->auth->thenReturn(false); \Phake::when(Arsse::$user)->auth("john.doe@example.com", "secret")->thenReturn(true); @@ -216,11 +216,11 @@ LONG_STRING; $exp1 = $sessions; $exp2 = $sessions; } elseif ($sessions) { - $exp1 = $this->respGood(['session_id' => $sessions[0], 'api_level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); - $exp2 = $this->respGood(['session_id' => $sessions[1], 'api_level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); + $exp1 = self::respGood(['session_id' => $sessions[0], 'api_level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); + $exp2 = self::respGood(['session_id' => $sessions[1], 'api_level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); } else { - $exp1 = $this->respErr("LOGIN_ERROR"); - $exp2 = $this->respErr("LOGIN_ERROR"); + $exp1 = self::respErr("LOGIN_ERROR"); + $exp2 = self::respErr("LOGIN_ERROR"); } $data['op'] = "login"; $this->assertMessage($exp1, $this->reqAuth($data, $httpUser)); @@ -233,13 +233,13 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::never())->sessionResume(\Phake::anyParameters()); } - public function provideLoginRequests(): iterable { - return $this->generateLoginRequests("login"); + public static function provideLoginRequests(): iterable { + return self::generateLoginRequests("login"); } /** @dataProvider provideResumeRequests */ public function testValidateASession(array $conf, $httpUser, string $data, $result): void { - $this->userId = null; + self::$userId = null; self::setConf($conf); \Phake::when(Arsse::$db)->sessionResume("PriestsOfSyrinx")->thenReturn([ 'id' => "PriestsOfSyrinx", @@ -261,21 +261,21 @@ LONG_STRING; $exp1 = $result; $exp2 = null; } elseif ($result) { - $exp1 = $this->respGood(['status' => true]); + $exp1 = self::respGood(['status' => true]); $exp2 = $result; } else { - $exp1 = $this->respErr("NOT_LOGGED_IN"); + $exp1 = self::respErr("NOT_LOGGED_IN"); $exp2 = ($httpUser) ? $httpUser : null; } $this->assertMessage($exp1, $this->reqAuth($data, $httpUser)); $this->assertSame($exp2, Arsse::$user->id); } - public function provideResumeRequests(): iterable { - return $this->generateLoginRequests("isLoggedIn"); + public static function provideResumeRequests(): iterable { + return self::generateLoginRequests("isLoggedIn"); } - public function generateLoginRequests(string $type): array { + public static function generateLoginRequests(string $type): array { $john = "john.doe@example.com"; $johnGood = [ 'user' => $john, @@ -526,7 +526,7 @@ LONG_STRING; \Phake::when(Arsse::$user)->auth->thenThrow(new \JKingWeb\Arsse\Db\ExceptionTimeout("general")); $data = [ 'op' => "login", - 'user' => $this->userId, + 'user' => self::$userId, 'password' => "secret", ]; $exp = HTTP::respEmpty(500); @@ -539,13 +539,13 @@ LONG_STRING; 'op' => "logout", 'sid' => "PriestsOfSyrinx", ]; - $exp = $this->respGood(['status' => "OK"]); + $exp = self::respGood(['status' => "OK"]); $this->assertMessage($exp, $this->req($data)); - \Phake::verify(Arsse::$db)->sessionDestroy($this->userId, "PriestsOfSyrinx"); + \Phake::verify(Arsse::$db)->sessionDestroy(self::$userId, "PriestsOfSyrinx"); } public function testHandleUnknownMethods(): void { - $exp = $this->respErr("UNKNOWN_METHOD", ['method' => "thisMethodDoesNotExist"]); + $exp = self::respErr("UNKNOWN_METHOD", ['method' => "thisMethodDoesNotExist"]); $data = [ 'op' => "thisMethodDoesNotExist", 'sid' => "PriestsOfSyrinx", @@ -558,7 +558,7 @@ LONG_STRING; 'op' => "isLoggedIn", 'sid' => "PriestsOfSyrinx", ]; - $exp = $this->respGood(['status' => true]); + $exp = self::respGood(['status' => true]); $this->assertMessage($exp, $this->req($data)); $data['op'] = "isloggedin"; $this->assertMessage($exp, $this->req($data)); @@ -573,7 +573,7 @@ LONG_STRING; 'op' => "getVersion", 'sid' => "PriestsOfSyrinx", ]; - $exp = $this->respGood([ + $exp = self::respGood([ 'version' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::VERSION, 'arsse_version' => Arsse::VERSION, ]); @@ -585,7 +585,7 @@ LONG_STRING; 'op' => "getApiLevel", 'sid' => "PriestsOfSyrinx", ]; - $exp = $this->respGood(['level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); + $exp = self::respGood(['level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); $this->assertMessage($exp, $this->req($data)); } @@ -594,30 +594,30 @@ LONG_STRING; $in = array_merge(['op' => "addCategory", 'sid' => "PriestsOfSyrinx"], $in); $action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn"; \Phake::when(Arsse::$db)->folderAdd->$action($out); - \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result($this->v([ + \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result(self::v([ ['id' => 2, 'name' => "Software", 'parent' => null], ['id' => 1, 'name' => "Politics", 'parent' => null], ]))); - \Phake::when(Arsse::$db)->folderList($this->anything(), 1, false)->thenReturn(new Result($this->v([ + \Phake::when(Arsse::$db)->folderList($this->anything(), 1, false)->thenReturn(new Result(self::v([ ['id' => 3, 'name' => "Hardware", 'parent' => 1], ]))); $this->assertMessage($exp, $this->req($in)); - \Phake::verify(Arsse::$db)->folderAdd($this->userId, $data); + \Phake::verify(Arsse::$db)->folderAdd(self::$userId, $data); if (!$out instanceof \Exception) { \Phake::verify(Arsse::$db, \Phake::never())->folderList(\Phake::anyParameters()); } } - public function provideCategoryAdditions(): iterable { + public static function provideCategoryAdditions(): iterable { return [ - [[], ['name' => null, 'parent' => null], new ExceptionInput("missing"), $this->respErr("INCORRECT_USAGE")], - [['caption' => ""], ['name' => "", 'parent' => null], new ExceptionInput("missing"), $this->respErr("INCORRECT_USAGE")], - [['caption' => " "], ['name' => " ", 'parent' => null], new ExceptionInput("whitespace"), $this->respErr("INCORRECT_USAGE")], - [['caption' => "Software"], ['name' => "Software", 'parent' => null], 2, $this->respGood("2")], - [['caption' => "Hardware", 'parent_id' => 1], ['name' => "Hardware", 'parent' => 1], 3, $this->respGood("3")], - [['caption' => "Hardware", 'parent_id' => 2112], ['name' => "Hardware", 'parent' => 2112], new ExceptionInput("idMissing"), $this->respGood(false)], - [['caption' => "Software"], ['name' => "Software", 'parent' => null], new ExceptionInput("constraintViolation"), $this->respGood("2")], - [['caption' => "Hardware", 'parent_id' => 1], ['name' => "Hardware", 'parent' => 1], new ExceptionInput("constraintViolation"), $this->respGood("3")], + [[], ['name' => null, 'parent' => null], new ExceptionInput("missing"), self::respErr("INCORRECT_USAGE")], + [['caption' => ""], ['name' => "", 'parent' => null], new ExceptionInput("missing"), self::respErr("INCORRECT_USAGE")], + [['caption' => " "], ['name' => " ", 'parent' => null], new ExceptionInput("whitespace"), self::respErr("INCORRECT_USAGE")], + [['caption' => "Software"], ['name' => "Software", 'parent' => null], 2, self::respGood("2")], + [['caption' => "Hardware", 'parent_id' => 1], ['name' => "Hardware", 'parent' => 1], 3, self::respGood("3")], + [['caption' => "Hardware", 'parent_id' => 2112], ['name' => "Hardware", 'parent' => 2112], new ExceptionInput("idMissing"), self::respGood(false)], + [['caption' => "Software"], ['name' => "Software", 'parent' => null], new ExceptionInput("constraintViolation"), self::respGood("2")], + [['caption' => "Hardware", 'parent_id' => 1], ['name' => "Hardware", 'parent' => 1], new ExceptionInput("constraintViolation"), self::respGood("3")], ]; } @@ -628,16 +628,16 @@ LONG_STRING; \Phake::when(Arsse::$db)->folderRemove->$action($out); $this->assertMessage($exp, $this->req($in)); if ($data > 0) { - \Phake::verify(Arsse::$db)->folderRemove($this->userId, (int) $data); + \Phake::verify(Arsse::$db)->folderRemove(self::$userId, (int) $data); } } - public function provideCategoryRemovals(): iterable { + public static function provideCategoryRemovals(): iterable { return [ - [['category_id' => 42], 42, true, $this->respGood()], - [['category_id' => 2112], 2112, new ExceptionInput("subjectMissing"), $this->respGood()], - [[], null, null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => -1], null, null, $this->respErr("INCORRECT_USAGE")], + [['category_id' => 42], 42, true, self::respGood()], + [['category_id' => 2112], 2112, new ExceptionInput("subjectMissing"), self::respGood()], + [[], null, null, self::respErr("INCORRECT_USAGE")], + [['category_id' => -1], null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -654,17 +654,17 @@ LONG_STRING; } } - public function provideCategoryMoves(): iterable { + public static function provideCategoryMoves(): iterable { return [ - [['category_id' => 42, 'parent_id' => 1], [$this->userId, 42, ['parent' => 1]], true, $this->respGood()], - [['category_id' => 2112, 'parent_id' => 2], [$this->userId, 2112, ['parent' => 2]], new ExceptionInput("subjectMissing"), $this->respGood()], - [['category_id' => 42, 'parent_id' => 0], [$this->userId, 42, ['parent' => 0]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['category_id' => 42, 'parent_id' => 47], [$this->userId, 42, ['parent' => 47]], new ExceptionInput("idMissing"), $this->respGood()], - [['category_id' => -1, 'parent_id' => 1], [$this->userId, -1, ['parent' => 1]], null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => 42, 'parent_id' => -1], [$this->userId, 42, ['parent' => -1]], null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => 42], [$this->userId, 42, ['parent' => 0]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['parent_id' => -1], [$this->userId, 0, ['parent' => -1]], null, $this->respErr("INCORRECT_USAGE")], - [[], [$this->userId, 0, ['parent' => 0]], null, $this->respErr("INCORRECT_USAGE")], + [['category_id' => 42, 'parent_id' => 1], [self::$userId, 42, ['parent' => 1]], true, self::respGood()], + [['category_id' => 2112, 'parent_id' => 2], [self::$userId, 2112, ['parent' => 2]], new ExceptionInput("subjectMissing"), self::respGood()], + [['category_id' => 42, 'parent_id' => 0], [self::$userId, 42, ['parent' => 0]], new ExceptionInput("constraintViolation"), self::respGood()], + [['category_id' => 42, 'parent_id' => 47], [self::$userId, 42, ['parent' => 47]], new ExceptionInput("idMissing"), self::respGood()], + [['category_id' => -1, 'parent_id' => 1], [self::$userId, -1, ['parent' => 1]], null, self::respErr("INCORRECT_USAGE")], + [['category_id' => 42, 'parent_id' => -1], [self::$userId, 42, ['parent' => -1]], null, self::respErr("INCORRECT_USAGE")], + [['category_id' => 42], [self::$userId, 42, ['parent' => 0]], new ExceptionInput("constraintViolation"), self::respGood()], + [['parent_id' => -1], [self::$userId, 0, ['parent' => -1]], null, self::respErr("INCORRECT_USAGE")], + [[], [self::$userId, 0, ['parent' => 0]], null, self::respErr("INCORRECT_USAGE")], ]; } @@ -681,17 +681,17 @@ LONG_STRING; } } - public function provideCategoryRenamings(): iterable { + public static function provideCategoryRenamings(): iterable { return [ - [['category_id' => 42, 'caption' => "Ook"], [$this->userId, 42, ['name' => "Ook"]], true, $this->respGood()], - [['category_id' => 2112, 'caption' => "Eek"], [$this->userId, 2112, ['name' => "Eek"]], new ExceptionInput("subjectMissing"), $this->respGood()], - [['category_id' => 42, 'caption' => "Eek"], [$this->userId, 42, ['name' => "Eek"]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['category_id' => 42, 'caption' => ""], null, null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => 42, 'caption' => " "], null, null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => -1, 'caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => 42], null, null, $this->respErr("INCORRECT_USAGE")], - [['caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['category_id' => 42, 'caption' => "Ook"], [self::$userId, 42, ['name' => "Ook"]], true, self::respGood()], + [['category_id' => 2112, 'caption' => "Eek"], [self::$userId, 2112, ['name' => "Eek"]], new ExceptionInput("subjectMissing"), self::respGood()], + [['category_id' => 42, 'caption' => "Eek"], [self::$userId, 42, ['name' => "Eek"]], new ExceptionInput("constraintViolation"), self::respGood()], + [['category_id' => 42, 'caption' => ""], null, null, self::respErr("INCORRECT_USAGE")], + [['category_id' => 42, 'caption' => " "], null, null, self::respErr("INCORRECT_USAGE")], + [['category_id' => -1, 'caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [['category_id' => 42], null, null, self::respErr("INCORRECT_USAGE")], + [['caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -706,37 +706,37 @@ LONG_STRING; ['id' => 4, 'url' => "http://example.com/9"], ]; \Phake::when(Arsse::$db)->subscriptionAdd->$action($out); - \Phake::when(Arsse::$db)->folderPropertiesGet($this->userId, 42)->thenReturn($this->v(['id' => 42])); - \Phake::when(Arsse::$db)->folderPropertiesGet($this->userId, 47)->thenReturn($this->v(['id' => 47])); - \Phake::when(Arsse::$db)->folderPropertiesGet($this->userId, 2112)->thenThrow(new ExceptionInput("subjectMissing")); - \Phake::when(Arsse::$db)->subscriptionPropertiesSet($this->userId, $this->anything())->thenReturn(true); - \Phake::when(Arsse::$db)->subscriptionPropertiesSet($this->userId, 4, $this->anything())->thenThrow(new ExceptionInput("idMissing")); - \Phake::when(Arsse::$db)->subscriptionList($this->userId)->thenReturn(new Result($this->v($list))); + \Phake::when(Arsse::$db)->folderPropertiesGet(self::$userId, 42)->thenReturn(self::v(['id' => 42])); + \Phake::when(Arsse::$db)->folderPropertiesGet(self::$userId, 47)->thenReturn(self::v(['id' => 47])); + \Phake::when(Arsse::$db)->folderPropertiesGet(self::$userId, 2112)->thenThrow(new ExceptionInput("subjectMissing")); + \Phake::when(Arsse::$db)->subscriptionPropertiesSet(self::$userId, $this->anything())->thenReturn(true); + \Phake::when(Arsse::$db)->subscriptionPropertiesSet(self::$userId, 4, $this->anything())->thenThrow(new ExceptionInput("idMissing")); + \Phake::when(Arsse::$db)->subscriptionList(self::$userId)->thenReturn(new Result(self::v($list))); $this->assertMessage($exp, $this->req($in)); if ($data !== null) { \Phake::verify(Arsse::$db)->subscriptionAdd(...$data); } else { \Phake::verify(Arsse::$db, \Phake::never())->subscriptionAdd(\Phake::anyParameters()); } - \Phake::verify(Arsse::$db, \Phake::never())->subscriptionPropertiesSet($this->userId, 4, ['folder' => 1]); + \Phake::verify(Arsse::$db, \Phake::never())->subscriptionPropertiesSet(self::$userId, 4, ['folder' => 1]); } - public function provideFeedSubscriptions(): iterable { + public static function provideFeedSubscriptions(): iterable { return [ - [['feed_url' => "http://example.com/0"], [$this->userId, "http://example.com/0", "", ""], 2, $this->respGood(['code' => 1, 'feed_id' => 2])], - [['feed_url' => "http://example.com/1", 'category_id' => 42], [$this->userId, "http://example.com/1", "", ""], new FeedException("unauthorized"), $this->respGood(['code' => 5, 'message' => (new FeedException("unauthorized"))->getMessage()])], - [['feed_url' => "http://example.com/2", 'category_id' => 2112], null, null, $this->respGood(['code' => 1, 'feed_id' => 0])], - [['feed_url' => "http://example.com/3"], [$this->userId, "http://example.com/3", "", ""], new ExceptionInput("constraintViolation"), $this->respGood(['code' => 0, 'feed_id' => 3])], - [['feed_url' => "http://localhost:8000/Feed/Discovery/Valid"], [$this->userId, "http://localhost:8000/Feed/Discovery/Valid", "", ""], new ExceptionInput("constraintViolation"), $this->respGood(['code' => 0, 'feed_id' => 1])], - [['feed_url' => "http://localhost:8000/Feed/Discovery/Invalid"], [$this->userId, "http://localhost:8000/Feed/Discovery/Invalid", "", ""], new ExceptionInput("constraintViolation"), $this->respGood(['code' => 3, 'message' => (new FeedException("subscriptionNotFound", ['url' => "http://localhost:8000/Feed/Discovery/Invalid"]))->getMessage()])], - [['feed_url' => "http://example.com/6"], [$this->userId, "http://example.com/6", "", ""], new FeedException("invalidUrl"), $this->respGood(['code' => 2, 'message' => (new FeedException("invalidUrl"))->getMessage()])], - [['feed_url' => "http://example.com/7"], [$this->userId, "http://example.com/7", "", ""], new FeedException("malformedXml"), $this->respGood(['code' => 6, 'message' => (new FeedException("malformedXml"))->getMessage()])], - [['feed_url' => "http://example.com/8", 'category_id' => 47], [$this->userId, "http://example.com/8", "", ""], 4, $this->respGood(['code' => 1, 'feed_id' => 4])], - [['feed_url' => "http://example.com/9", 'category_id' => 1], [$this->userId, "http://example.com/9", "", ""], new ExceptionInput("constraintViolation"), $this->respGood(['code' => 0, 'feed_id' => 4])], - [[], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_url' => "http://example.com/", 'login' => []], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_url' => "http://example.com/", 'login' => "", 'password' => []], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_url' => "http://example.com/", 'category_id' => -1], null, null, $this->respErr("INCORRECT_USAGE")], + [['feed_url' => "http://example.com/0"], [self::$userId, "http://example.com/0", "", ""], 2, self::respGood(['code' => 1, 'feed_id' => 2])], + [['feed_url' => "http://example.com/1", 'category_id' => 42], [self::$userId, "http://example.com/1", "", ""], new FeedException("unauthorized"), self::respGood(['code' => 5, 'message' => (new FeedException("unauthorized"))->getMessage()])], + [['feed_url' => "http://example.com/2", 'category_id' => 2112], null, null, self::respGood(['code' => 1, 'feed_id' => 0])], + [['feed_url' => "http://example.com/3"], [self::$userId, "http://example.com/3", "", ""], new ExceptionInput("constraintViolation"), self::respGood(['code' => 0, 'feed_id' => 3])], + [['feed_url' => "http://localhost:8000/Feed/Discovery/Valid"], [self::$userId, "http://localhost:8000/Feed/Discovery/Valid", "", ""], new ExceptionInput("constraintViolation"), self::respGood(['code' => 0, 'feed_id' => 1])], + [['feed_url' => "http://localhost:8000/Feed/Discovery/Invalid"], [self::$userId, "http://localhost:8000/Feed/Discovery/Invalid", "", ""], new ExceptionInput("constraintViolation"), self::respGood(['code' => 3, 'message' => (new FeedException("subscriptionNotFound", ['url' => "http://localhost:8000/Feed/Discovery/Invalid"]))->getMessage()])], + [['feed_url' => "http://example.com/6"], [self::$userId, "http://example.com/6", "", ""], new FeedException("invalidUrl"), self::respGood(['code' => 2, 'message' => (new FeedException("invalidUrl"))->getMessage()])], + [['feed_url' => "http://example.com/7"], [self::$userId, "http://example.com/7", "", ""], new FeedException("malformedXml"), self::respGood(['code' => 6, 'message' => (new FeedException("malformedXml"))->getMessage()])], + [['feed_url' => "http://example.com/8", 'category_id' => 47], [self::$userId, "http://example.com/8", "", ""], 4, self::respGood(['code' => 1, 'feed_id' => 4])], + [['feed_url' => "http://example.com/9", 'category_id' => 1], [self::$userId, "http://example.com/9", "", ""], new ExceptionInput("constraintViolation"), self::respGood(['code' => 0, 'feed_id' => 4])], + [[], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_url' => "http://example.com/", 'login' => []], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_url' => "http://example.com/", 'login' => "", 'password' => []], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_url' => "http://example.com/", 'category_id' => -1], null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -753,12 +753,12 @@ LONG_STRING; } } - public function provideFeedUnsubscriptions(): iterable { + public static function provideFeedUnsubscriptions(): iterable { return [ - [['feed_id' => 42], [$this->userId, 42], true, $this->respGood(['status' => "OK"])], - [['feed_id' => 2112], [$this->userId, 2112], new ExceptionInput("subjectMissing"), $this->respErr("FEED_NOT_FOUND")], - [['feed_id' => -1], [$this->userId, -1], new ExceptionInput("typeViolation"), $this->respErr("FEED_NOT_FOUND")], - [[], [$this->userId, 0], new ExceptionInput("typeViolation"), $this->respErr("FEED_NOT_FOUND")], + [['feed_id' => 42], [self::$userId, 42], true, self::respGood(['status' => "OK"])], + [['feed_id' => 2112], [self::$userId, 2112], new ExceptionInput("subjectMissing"), self::respErr("FEED_NOT_FOUND")], + [['feed_id' => -1], [self::$userId, -1], new ExceptionInput("typeViolation"), self::respErr("FEED_NOT_FOUND")], + [[], [self::$userId, 0], new ExceptionInput("typeViolation"), self::respErr("FEED_NOT_FOUND")], ]; } @@ -775,17 +775,17 @@ LONG_STRING; } } - public function provideFeedMoves(): iterable { + public static function provideFeedMoves(): iterable { return [ - [['feed_id' => 42, 'category_id' => 1], [$this->userId, 42, ['folder' => 1]], true, $this->respGood()], - [['feed_id' => 2112, 'category_id' => 2], [$this->userId, 2112, ['folder' => 2]], new ExceptionInput("subjectMissing"), $this->respGood()], - [['feed_id' => 42, 'category_id' => 0], [$this->userId, 42, ['folder' => 0]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['feed_id' => 42, 'category_id' => 47], [$this->userId, 42, ['folder' => 47]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['feed_id' => -1, 'category_id' => 1], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_id' => 42, 'category_id' => -1], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_id' => 42], null, null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => -1], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['feed_id' => 42, 'category_id' => 1], [self::$userId, 42, ['folder' => 1]], true, self::respGood()], + [['feed_id' => 2112, 'category_id' => 2], [self::$userId, 2112, ['folder' => 2]], new ExceptionInput("subjectMissing"), self::respGood()], + [['feed_id' => 42, 'category_id' => 0], [self::$userId, 42, ['folder' => 0]], new ExceptionInput("constraintViolation"), self::respGood()], + [['feed_id' => 42, 'category_id' => 47], [self::$userId, 42, ['folder' => 47]], new ExceptionInput("constraintViolation"), self::respGood()], + [['feed_id' => -1, 'category_id' => 1], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_id' => 42, 'category_id' => -1], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_id' => 42], null, null, self::respErr("INCORRECT_USAGE")], + [['category_id' => -1], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -802,28 +802,28 @@ LONG_STRING; } } - public function provideFeedRenamings(): iterable { + public static function provideFeedRenamings(): iterable { return [ - [['feed_id' => 42, 'caption' => "Ook"], [$this->userId, 42, ['title' => "Ook"]], true, $this->respGood()], - [['feed_id' => 2112, 'caption' => "Eek"], [$this->userId, 2112, ['title' => "Eek"]], new ExceptionInput("subjectMissing"), $this->respGood()], - [['feed_id' => 42, 'caption' => "Eek"], [$this->userId, 42, ['title' => "Eek"]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['feed_id' => 42, 'caption' => ""], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_id' => 42, 'caption' => " "], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_id' => -1, 'caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_id' => 42], null, null, $this->respErr("INCORRECT_USAGE")], - [['caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['feed_id' => 42, 'caption' => "Ook"], [self::$userId, 42, ['title' => "Ook"]], true, self::respGood()], + [['feed_id' => 2112, 'caption' => "Eek"], [self::$userId, 2112, ['title' => "Eek"]], new ExceptionInput("subjectMissing"), self::respGood()], + [['feed_id' => 42, 'caption' => "Eek"], [self::$userId, 42, ['title' => "Eek"]], new ExceptionInput("constraintViolation"), self::respGood()], + [['feed_id' => 42, 'caption' => ""], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_id' => 42, 'caption' => " "], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_id' => -1, 'caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_id' => 42], null, null, self::respErr("INCORRECT_USAGE")], + [['caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } public function testRetrieveTheGlobalUnreadCount(): void { $in = ['op' => "getUnread", 'sid' => "PriestsOfSyrinx"]; - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v([ + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v([ ['id' => 1, 'unread' => 2112], ['id' => 2, 'unread' => 42], ['id' => 3, 'unread' => 47], ]))); - $exp = $this->respGood(['unread' => (string) (2112 + 42 + 47)]); + $exp = self::respGood(['unread' => (string) (2112 + 42 + 47)]); $this->assertMessage($exp, $this->req($in)); } @@ -833,9 +833,9 @@ LONG_STRING; $valid = (new \DateTimeImmutable("now", new \DateTimezone("UTC")))->sub($interval); $invalid = $valid->sub($interval)->sub($interval); \Phake::when(Arsse::$db)->metaGet("service_last_checkin")->thenReturn(Date::transform($valid, "sql"))->thenReturn(Date::transform($invalid, "sql")); - \Phake::when(Arsse::$db)->subscriptionCount($this->userId)->thenReturn(12)->thenReturn(2); - $this->assertMessage($this->respGood(['icons_dir' => "feed-icons", 'icons_url' => "feed-icons", 'daemon_is_running' => true, 'num_feeds' => 12]), $this->req($in)); - $this->assertMessage($this->respGood(['icons_dir' => "feed-icons", 'icons_url' => "feed-icons", 'daemon_is_running' => false, 'num_feeds' => 2]), $this->req($in)); + \Phake::when(Arsse::$db)->subscriptionCount(self::$userId)->thenReturn(12)->thenReturn(2); + $this->assertMessage(self::respGood(['icons_dir' => "feed-icons", 'icons_url' => "feed-icons", 'daemon_is_running' => true, 'num_feeds' => 12]), $this->req($in)); + $this->assertMessage(self::respGood(['icons_dir' => "feed-icons", 'icons_url' => "feed-icons", 'daemon_is_running' => false, 'num_feeds' => 2]), $this->req($in)); } /** @dataProvider provideFeedUpdates */ @@ -857,12 +857,12 @@ LONG_STRING; } } - public function provideFeedUpdates(): iterable { + public static function provideFeedUpdates(): iterable { return [ - [['feed_id' => 1], [$this->userId, 1], $this->v(['id' => 1, 'feed' => 11]), 11, $this->respGood(['status' => "OK"])], - [['feed_id' => 2], [$this->userId, 2], new ExceptionInput("subjectMissing"), null, $this->respErr("FEED_NOT_FOUND")], - [['feed_id' => -1], null, null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, null, $this->respErr("INCORRECT_USAGE")], + [['feed_id' => 1], [self::$userId, 1], self::v(['id' => 1, 'feed' => 11]), 11, self::respGood(['status' => "OK"])], + [['feed_id' => 2], [self::$userId, 2], new ExceptionInput("subjectMissing"), null, self::respErr("FEED_NOT_FOUND")], + [['feed_id' => -1], null, null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -885,15 +885,15 @@ LONG_STRING; } } - public function provideLabelAdditions(): iterable { + public static function provideLabelAdditions(): iterable { return [ - [['caption' => "Software"], [$this->userId, ['name' => "Software"]], 2, null, null, $this->respGood(-1026)], - [['caption' => "Hardware"], [$this->userId, ['name' => "Hardware"]], 3, null, null, $this->respGood(-1027)], - [['caption' => "Software"], [$this->userId, ['name' => "Software"]], new ExceptionInput("constraintViolation"), [$this->userId, "Software", true], ['id' => 2], $this->respGood(-1026)], - [['caption' => "Hardware"], [$this->userId, ['name' => "Hardware"]], new ExceptionInput("constraintViolation"), [$this->userId, "Hardware", true], ['id' => 3], $this->respGood(-1027)], - [[], [$this->userId, ['name' => ""]], new ExceptionInput("typeViolation"), null, null, $this->respErr("INCORRECT_USAGE")], - [['caption' => ""], [$this->userId, ['name' => ""]], new ExceptionInput("typeViolation"), null, null, $this->respErr("INCORRECT_USAGE")], - [['caption' => " "], [$this->userId, ['name' => " "]], new ExceptionInput("typeViolation"), null, null, $this->respErr("INCORRECT_USAGE")], + [['caption' => "Software"], [self::$userId, ['name' => "Software"]], 2, null, null, self::respGood(-1026)], + [['caption' => "Hardware"], [self::$userId, ['name' => "Hardware"]], 3, null, null, self::respGood(-1027)], + [['caption' => "Software"], [self::$userId, ['name' => "Software"]], new ExceptionInput("constraintViolation"), [self::$userId, "Software", true], ['id' => 2], self::respGood(-1026)], + [['caption' => "Hardware"], [self::$userId, ['name' => "Hardware"]], new ExceptionInput("constraintViolation"), [self::$userId, "Hardware", true], ['id' => 3], self::respGood(-1027)], + [[], [self::$userId, ['name' => ""]], new ExceptionInput("typeViolation"), null, null, self::respErr("INCORRECT_USAGE")], + [['caption' => ""], [self::$userId, ['name' => ""]], new ExceptionInput("typeViolation"), null, null, self::respErr("INCORRECT_USAGE")], + [['caption' => " "], [self::$userId, ['name' => " "]], new ExceptionInput("typeViolation"), null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -910,14 +910,14 @@ LONG_STRING; } } - public function provideLabelRemovals(): iterable { + public static function provideLabelRemovals(): iterable { return [ - [['label_id' => -1042], [$this->userId, 18], true, $this->respGood()], - [['label_id' => -2112], [$this->userId, 1088], new ExceptionInput("subjectMissing"), $this->respGood()], - [['label_id' => 1], null, null, $this->respErr("INCORRECT_USAGE")], - [['label_id' => 0], null, null, $this->respErr("INCORRECT_USAGE")], - [['label_id' => -10], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['label_id' => -1042], [self::$userId, 18], true, self::respGood()], + [['label_id' => -2112], [self::$userId, 1088], new ExceptionInput("subjectMissing"), self::respGood()], + [['label_id' => 1], null, null, self::respErr("INCORRECT_USAGE")], + [['label_id' => 0], null, null, self::respErr("INCORRECT_USAGE")], + [['label_id' => -10], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -934,34 +934,34 @@ LONG_STRING; } } - public function provideLabelRenamings(): iterable { + public static function provideLabelRenamings(): iterable { return [ - [['label_id' => -1042, 'caption' => "Ook"], [$this->userId, 18, ['name' => "Ook"]], true, $this->respGood()], - [['label_id' => -2112, 'caption' => "Eek"], [$this->userId, 1088, ['name' => "Eek"]], new ExceptionInput("subjectMissing"), $this->respGood()], - [['label_id' => -1042, 'caption' => "Eek"], [$this->userId, 18, ['name' => "Eek"]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['label_id' => -1042, 'caption' => ""], [$this->userId, 18, ['name' => ""]], new ExceptionInput("missing"), $this->respGood()], - [['label_id' => -1042, 'caption' => " "], [$this->userId, 18, ['name' => " "]], new ExceptionInput("whitespace"), $this->respGood()], - [['label_id' => -1042], [$this->userId, 18, ['name' => ""]], new ExceptionInput("missing"), $this->respGood()], - [['label_id' => -1042], [$this->userId, 18, ['name' => ""]], new ExceptionInput("typeViolation"), $this->respErr("INCORRECT_USAGE")], - [['label_id' => -1, 'caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [['caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['label_id' => -1042, 'caption' => "Ook"], [self::$userId, 18, ['name' => "Ook"]], true, self::respGood()], + [['label_id' => -2112, 'caption' => "Eek"], [self::$userId, 1088, ['name' => "Eek"]], new ExceptionInput("subjectMissing"), self::respGood()], + [['label_id' => -1042, 'caption' => "Eek"], [self::$userId, 18, ['name' => "Eek"]], new ExceptionInput("constraintViolation"), self::respGood()], + [['label_id' => -1042, 'caption' => ""], [self::$userId, 18, ['name' => ""]], new ExceptionInput("missing"), self::respGood()], + [['label_id' => -1042, 'caption' => " "], [self::$userId, 18, ['name' => " "]], new ExceptionInput("whitespace"), self::respGood()], + [['label_id' => -1042], [self::$userId, 18, ['name' => ""]], new ExceptionInput("missing"), self::respGood()], + [['label_id' => -1042], [self::$userId, 18, ['name' => ""]], new ExceptionInput("typeViolation"), self::respErr("INCORRECT_USAGE")], + [['label_id' => -1, 'caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [['caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } /** @dataProvider provideCategoryListings */ public function testRetrieveCategoryLists(array $in, ResponseInterface $exp): void { $in = array_merge(['op' => "getCategories", 'sid' => "PriestsOfSyrinx"], $in); - \Phake::when(Arsse::$db)->folderList($this->anything(), null, true)->thenReturn(new Result($this->v($this->folders))); - \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result($this->v($this->topFolders))); - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v($this->subscriptions))); - \Phake::when(Arsse::$db)->labelList->thenReturn(new Result($this->v($this->labels))); + \Phake::when(Arsse::$db)->folderList($this->anything(), null, true)->thenReturn(new Result(self::v($this->folders))); + \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result(self::v($this->topFolders))); + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v($this->subscriptions))); + \Phake::when(Arsse::$db)->labelList->thenReturn(new Result(self::v($this->labels))); \Phake::when(Arsse::$db)->articleCount($this->anything(), $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null)))->thenReturn(7); - \Phake::when(Arsse::$db)->articleStarred->thenReturn($this->v($this->starred)); + \Phake::when(Arsse::$db)->articleStarred->thenReturn(self::v($this->starred)); $this->assertMessage($exp, $this->req($in)); } - public function provideCategoryListings(): iterable { + public static function provideCategoryListings(): iterable { $exp = [ [ ['id' => "5", 'title' => "Local", 'unread' => 10, 'order_id' => 1], @@ -1015,22 +1015,22 @@ LONG_STRING; ], ]; return [ - [['include_empty' => true], $this->respGood($exp[0])], - [[], $this->respGood($exp[1])], - [['unread_only' => true], $this->respGood($exp[2])], - [['enable_nested' => true, 'include_empty' => true], $this->respGood($exp[3])], - [['enable_nested' => true], $this->respGood($exp[4])], - [['enable_nested' => true, 'unread_only' => true], $this->respGood($exp[5])], + [['include_empty' => true], self::respGood($exp[0])], + [[], self::respGood($exp[1])], + [['unread_only' => true], self::respGood($exp[2])], + [['enable_nested' => true, 'include_empty' => true], self::respGood($exp[3])], + [['enable_nested' => true], self::respGood($exp[4])], + [['enable_nested' => true, 'unread_only' => true], self::respGood($exp[5])], ]; } public function testRetrieveCounterList(): void { $in = ['op' => "getCounters", 'sid' => "PriestsOfSyrinx"]; - \Phake::when(Arsse::$db)->folderList->thenReturn(new Result($this->v($this->folders))); - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v($this->subscriptions))); - \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->v($this->usedLabels))); + \Phake::when(Arsse::$db)->folderList->thenReturn(new Result(self::v($this->folders))); + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v($this->subscriptions))); + \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result(self::v($this->usedLabels))); \Phake::when(Arsse::$db)->articleCount->thenReturn(7); - \Phake::when(Arsse::$db)->articleStarred->thenReturn($this->v($this->starred)); + \Phake::when(Arsse::$db)->articleStarred->thenReturn(self::v($this->starred)); $exp = [ ['id' => "global-unread", 'counter' => 35], ['id' => "subscribed-feeds", 'counter' => 6], @@ -1056,22 +1056,22 @@ LONG_STRING; ['id' => 0, 'kind' => "cat", 'counter' => 0], ['id' => -2, 'kind' => "cat", 'counter' => 6], ]; - $this->assertMessage($this->respGood($exp), $this->req($in)); - \Phake::verify(Arsse::$db)->articleCount($this->userId, $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null))); + $this->assertMessage(self::respGood($exp), $this->req($in)); + \Phake::verify(Arsse::$db)->articleCount(self::$userId, $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null))); } /** @dataProvider provideLabelListings */ public function testRetrieveTheLabelList(array $in, ResponseInterface $exp): void { $in = array_merge(['op' => "getLabels", 'sid' => "PriestsOfSyrinx"], $in); - \Phake::when(Arsse::$db)->labelList->thenReturn(new Result($this->v($this->labels))); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 1)->thenReturn($this->v([1,3])); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2)->thenReturn($this->v([3])); + \Phake::when(Arsse::$db)->labelList->thenReturn(new Result(self::v($this->labels))); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 1)->thenReturn(self::v([1,3])); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2)->thenReturn(self::v([3])); \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 3)->thenReturn([]); \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 4)->thenThrow(new ExceptionInput("idMissing")); $this->assertMessage($exp, $this->req($in)); } - public function provideLabelListings(): iterable { + public static function provideLabelListings(): iterable { $exp = [ [ ['id' => -1027, 'caption' => "Fascinating", 'fg_color' => "", 'bg_color' => "", 'checked' => false], @@ -1100,37 +1100,37 @@ LONG_STRING; ], ]; return [ - [[], $this->respGood($exp[0])], - [['article_id' => 1], $this->respGood($exp[1])], - [['article_id' => 2], $this->respGood($exp[2])], - [['article_id' => 3], $this->respGood($exp[3])], - [['article_id' => 4], $this->respGood($exp[4])], + [[], self::respGood($exp[0])], + [['article_id' => 1], self::respGood($exp[1])], + [['article_id' => 2], self::respGood($exp[2])], + [['article_id' => 3], self::respGood($exp[3])], + [['article_id' => 4], self::respGood($exp[4])], ]; } - public function provideLabelAssignments(): iterable { + public static function provideLabelAssignments(): iterable { $ids = implode(",", range(1, 100)); return [ - [['label_id' => -2112, 'article_ids' => $ids], 1088, Database::ASSOC_REMOVE, $this->respGood(['status' => "OK", 'updated' => 89])], - [['label_id' => -2112, 'article_ids' => $ids, 'assign' => true], 1088, Database::ASSOC_ADD, $this->respGood(['status' => "OK", 'updated' => 7])], - [['label_id' => -2112], null, null, $this->respGood(['status' => "OK", 'updated' => 0])], - [['label_id' => -42], null, null, $this->respErr("INCORRECT_USAGE")], - [['label_id' => 42], null, null, $this->respErr("INCORRECT_USAGE")], - [['label_id' => 0], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['label_id' => -2112, 'article_ids' => $ids], 1088, Database::ASSOC_REMOVE, self::respGood(['status' => "OK", 'updated' => 89])], + [['label_id' => -2112, 'article_ids' => $ids, 'assign' => true], 1088, Database::ASSOC_ADD, self::respGood(['status' => "OK", 'updated' => 7])], + [['label_id' => -2112], null, null, self::respGood(['status' => "OK", 'updated' => 0])], + [['label_id' => -42], null, null, self::respErr("INCORRECT_USAGE")], + [['label_id' => 42], null, null, self::respErr("INCORRECT_USAGE")], + [['label_id' => 0], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } /** @dataProvider provideLabelAssignments */ public function testAssignArticlesToALabel(array $in, ?int $label, ?int $operation, ResponseInterface $exp): void { $in = array_merge(['op' => "setArticleLabel", 'sid' => "PriestsOfSyrinx"], $in); - \Phake::when(Arsse::$db)->labelArticlesSet($this->userId, $this->anything(), $this->anything(), Database::ASSOC_REMOVE)->thenReturn(42)->thenReturn(47); - \Phake::when(Arsse::$db)->labelArticlesSet($this->userId, $this->anything(), $this->anything(), Database::ASSOC_ADD)->thenReturn(5)->thenReturn(2); - \Phake::when(Arsse::$db)->labelArticlesSet($this->userId, $this->anything(), $this->equalTo((new Context)->articles([])), $this->anything())->thenThrow(new ExceptionInput("tooShort")); + \Phake::when(Arsse::$db)->labelArticlesSet(self::$userId, $this->anything(), $this->anything(), Database::ASSOC_REMOVE)->thenReturn(42)->thenReturn(47); + \Phake::when(Arsse::$db)->labelArticlesSet(self::$userId, $this->anything(), $this->anything(), Database::ASSOC_ADD)->thenReturn(5)->thenReturn(2); + \Phake::when(Arsse::$db)->labelArticlesSet(self::$userId, $this->anything(), $this->equalTo((new Context)->articles([])), $this->anything())->thenThrow(new ExceptionInput("tooShort")); $this->assertMessage($exp, $this->req($in)); if ($label !== null) { - \Phake::verify(Arsse::$db)->labelArticlesSet($this->userId, $label, $this->equalTo((new Context)->articles(range(1, 50))), $operation); - \Phake::verify(Arsse::$db)->labelArticlesSet($this->userId, $label, $this->equalTo((new Context)->articles(range(51, 100))), $operation); + \Phake::verify(Arsse::$db)->labelArticlesSet(self::$userId, $label, $this->equalTo((new Context)->articles(range(1, 50))), $operation); + \Phake::verify(Arsse::$db)->labelArticlesSet(self::$userId, $label, $this->equalTo((new Context)->articles(range(51, 100))), $operation); } } @@ -1139,17 +1139,17 @@ LONG_STRING; ['op' => "getFeedTree", 'sid' => "PriestsOfSyrinx", 'include_empty' => true], ['op' => "getFeedTree", 'sid' => "PriestsOfSyrinx"], ]; - \Phake::when(Arsse::$db)->folderList($this->anything(), null, true)->thenReturn(new Result($this->v($this->folders))); - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v($this->subscriptions))); - \Phake::when(Arsse::$db)->labelList($this->anything(), true)->thenReturn(new Result($this->v($this->labels))); + \Phake::when(Arsse::$db)->folderList($this->anything(), null, true)->thenReturn(new Result(self::v($this->folders))); + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v($this->subscriptions))); + \Phake::when(Arsse::$db)->labelList($this->anything(), true)->thenReturn(new Result(self::v($this->labels))); \Phake::when(Arsse::$db)->articleCount->thenReturn(7); - \Phake::when(Arsse::$db)->articleStarred->thenReturn($this->v($this->starred)); + \Phake::when(Arsse::$db)->articleStarred->thenReturn(self::v($this->starred)); // the expectations are packed tightly since they're very verbose; one can use var_export() (or convert to JSON) to pretty-print them $exp = ['categories' => ['identifier' => 'id','label' => 'name','items' => [['name' => 'Special','id' => 'CAT:-1','bare_id' => -1,'type' => 'category','unread' => 0,'items' => [['name' => 'All articles','id' => 'FEED:-4','bare_id' => -4,'icon' => 'images/folder.png','unread' => 35,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Fresh articles','id' => 'FEED:-3','bare_id' => -3,'icon' => 'images/fresh.png','unread' => 7,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Starred articles','id' => 'FEED:-1','bare_id' => -1,'icon' => 'images/star.png','unread' => 4,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Published articles','id' => 'FEED:-2','bare_id' => -2,'icon' => 'images/feed.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Archived articles','id' => 'FEED:0','bare_id' => 0,'icon' => 'images/archive.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Recently read','id' => 'FEED:-6','bare_id' => -6,'icon' => 'images/time.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => '']]],['name' => 'Labels','id' => 'CAT:-2','bare_id' => -2,'type' => 'category','unread' => 6,'items' => [['name' => 'Fascinating','id' => 'FEED:-1027','bare_id' => -1027,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Interesting','id' => 'FEED:-1029','bare_id' => -1029,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Logical','id' => 'FEED:-1025','bare_id' => -1025,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => '']]],['name' => 'Photography','id' => 'CAT:4','bare_id' => 4,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(0 feeds)','items' => []],['name' => 'Politics','id' => 'CAT:3','bare_id' => 3,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(3 feeds)','items' => [['name' => 'Local','id' => 'CAT:5','bare_id' => 5,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'Toronto Star','id' => 'FEED:2','bare_id' => 2,'icon' => 'feed-icons/2.ico','error' => 'oops','param' => '2011-11-11T11:11:11Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'National','id' => 'CAT:6','bare_id' => 6,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'CBC News','id' => 'FEED:4','bare_id' => 4,'icon' => 'feed-icons/4.ico','error' => '','param' => '2017-10-09T15:58:34Z','unread' => 0,'auxcounter' => 0,'checkbox' => false],['name' => 'Ottawa Citizen','id' => 'FEED:5','bare_id' => 5,'icon' => false,'error' => '','param' => '2017-07-07T17:07:17Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]],['name' => 'Science','id' => 'CAT:1','bare_id' => 1,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'Rocketry','id' => 'CAT:2','bare_id' => 2,'parent_id' => 1,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'NASA JPL','id' => 'FEED:1','bare_id' => 1,'icon' => false,'error' => '','param' => '2017-09-15T22:54:16Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Ars Technica','id' => 'FEED:3','bare_id' => 3,'icon' => 'feed-icons/3.ico','error' => 'argh','param' => '2016-05-23T06:40:02Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Uncategorized','id' => 'CAT:0','bare_id' => 0,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'parent_id' => null,'param' => '(1 feed)','items' => [['name' => 'Eurogamer','id' => 'FEED:6','bare_id' => 6,'icon' => 'feed-icons/6.ico','error' => '','param' => '2010-02-12T20:08:47Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]]]; - $this->assertMessage($this->respGood($exp), $this->req($in[0])); + $this->assertMessage(self::respGood($exp), $this->req($in[0])); $exp = ['categories' => ['identifier' => 'id','label' => 'name','items' => [['name' => 'Special','id' => 'CAT:-1','bare_id' => -1,'type' => 'category','unread' => 0,'items' => [['name' => 'All articles','id' => 'FEED:-4','bare_id' => -4,'icon' => 'images/folder.png','unread' => 35,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Fresh articles','id' => 'FEED:-3','bare_id' => -3,'icon' => 'images/fresh.png','unread' => 7,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Starred articles','id' => 'FEED:-1','bare_id' => -1,'icon' => 'images/star.png','unread' => 4,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Published articles','id' => 'FEED:-2','bare_id' => -2,'icon' => 'images/feed.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Archived articles','id' => 'FEED:0','bare_id' => 0,'icon' => 'images/archive.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Recently read','id' => 'FEED:-6','bare_id' => -6,'icon' => 'images/time.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => '']]],['name' => 'Labels','id' => 'CAT:-2','bare_id' => -2,'type' => 'category','unread' => 6,'items' => [['name' => 'Fascinating','id' => 'FEED:-1027','bare_id' => -1027,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Interesting','id' => 'FEED:-1029','bare_id' => -1029,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Logical','id' => 'FEED:-1025','bare_id' => -1025,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => '']]],['name' => 'Politics','id' => 'CAT:3','bare_id' => 3,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(3 feeds)','items' => [['name' => 'Local','id' => 'CAT:5','bare_id' => 5,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'Toronto Star','id' => 'FEED:2','bare_id' => 2,'icon' => 'feed-icons/2.ico','error' => 'oops','param' => '2011-11-11T11:11:11Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'National','id' => 'CAT:6','bare_id' => 6,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'CBC News','id' => 'FEED:4','bare_id' => 4,'icon' => 'feed-icons/4.ico','error' => '','param' => '2017-10-09T15:58:34Z','unread' => 0,'auxcounter' => 0,'checkbox' => false],['name' => 'Ottawa Citizen','id' => 'FEED:5','bare_id' => 5,'icon' => false,'error' => '','param' => '2017-07-07T17:07:17Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]],['name' => 'Science','id' => 'CAT:1','bare_id' => 1,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'Rocketry','id' => 'CAT:2','bare_id' => 2,'parent_id' => 1,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'NASA JPL','id' => 'FEED:1','bare_id' => 1,'icon' => false,'error' => '','param' => '2017-09-15T22:54:16Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Ars Technica','id' => 'FEED:3','bare_id' => 3,'icon' => 'feed-icons/3.ico','error' => 'argh','param' => '2016-05-23T06:40:02Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Uncategorized','id' => 'CAT:0','bare_id' => 0,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'parent_id' => null,'param' => '(1 feed)','items' => [['name' => 'Eurogamer','id' => 'FEED:6','bare_id' => 6,'icon' => 'feed-icons/6.ico','error' => '','param' => '2010-02-12T20:08:47Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]]]; - $this->assertMessage($this->respGood($exp), $this->req($in[1])); - \Phake::verify(Arsse::$db, \Phake::times(2))->articleCount($this->userId, $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null))); + $this->assertMessage(self::respGood($exp), $this->req($in[1])); + \Phake::verify(Arsse::$db, \Phake::times(2))->articleCount(self::$userId, $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null))); } /** @dataProvider provideMassMarkings */ @@ -1160,15 +1160,15 @@ LONG_STRING; // create a mock-current time \Phake::when(Arsse::$obj)->get(\DateTimeImmutable::class)->thenReturn(new \DateTimeImmutable(self::NOW)); // TT-RSS always responds the same regardless of success or failure - $this->assertMessage($this->respGood(['status' => "OK"]), $this->req($in)); + $this->assertMessage(self::respGood(['status' => "OK"]), $this->req($in)); if (isset($c)) { - \Phake::verify(Arsse::$db)->articleMark($this->userId, ['read' => true], $this->equalTo($c)); + \Phake::verify(Arsse::$db)->articleMark(self::$userId, ['read' => true], $this->equalTo($c)); } else { \Phake::verify(Arsse::$db, \Phake::never())->articleMark(\Phake::anyParameters()); } } - public function provideMassMarkings(): iterable { + public static function provideMassMarkings(): iterable { $c = (new Context)->hidden(false); return [ [[], null], @@ -1198,24 +1198,24 @@ LONG_STRING; public function testRetrieveFeedList(array $in, ResponseInterface $exp): void { $in = array_merge(['op' => "getFeeds", 'sid' => "PriestsOfSyrinx"], $in); // statistical mocks - \Phake::when(Arsse::$db)->articleStarred->thenReturn($this->v($this->starred)); + \Phake::when(Arsse::$db)->articleStarred->thenReturn(self::v($this->starred)); \Phake::when(Arsse::$db)->articleCount($this->anything(), $this->equalTo((new Context)->unread(true)->hidden(false)->modifiedRange(Date::sub("PT24H", self::NOW), null)))->thenReturn(7); \Phake::when(Arsse::$db)->articleCount($this->anything(), $this->equalTo((new Context)->unread(true)->hidden(false)))->thenReturn(35); // label mocks - \Phake::when(Arsse::$db)->labelList->thenReturn(new Result($this->v($this->labels))); - \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->v($this->usedLabels))); + \Phake::when(Arsse::$db)->labelList->thenReturn(new Result(self::v($this->labels))); + \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result(self::v($this->usedLabels))); // subscription and folder list and unread count mocks \Phake::when(Arsse::$db)->folderList->thenThrow(new ExceptionInput("subjectMissing")); \Phake::when(Arsse::$db)->subscriptionList->thenThrow(new ExceptionInput("subjectMissing")); - \Phake::when(Arsse::$db)->folderList($this->anything())->thenReturn(new Result($this->v($this->folders))); - \Phake::when(Arsse::$db)->subscriptionList($this->anything(), null, true)->thenReturn(new Result($this->v($this->subscriptions))); - \Phake::when(Arsse::$db)->subscriptionList($this->anything(), null, false)->thenReturn(new Result($this->v($this->filterSubs(null)))); - \Phake::when(Arsse::$db)->folderList($this->anything(), null)->thenReturn(new Result($this->v($this->folders))); - \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result($this->v($this->filterFolders(null)))); + \Phake::when(Arsse::$db)->folderList($this->anything())->thenReturn(new Result(self::v($this->folders))); + \Phake::when(Arsse::$db)->subscriptionList($this->anything(), null, true)->thenReturn(new Result(self::v($this->subscriptions))); + \Phake::when(Arsse::$db)->subscriptionList($this->anything(), null, false)->thenReturn(new Result(self::v($this->filterSubs(null)))); + \Phake::when(Arsse::$db)->folderList($this->anything(), null)->thenReturn(new Result(self::v($this->folders))); + \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result(self::v($this->filterFolders(null)))); foreach ($this->folders as $f) { - \Phake::when(Arsse::$db)->folderList($this->anything(), $f['id'], false)->thenReturn(new Result($this->v($this->filterFolders($f['id'])))); + \Phake::when(Arsse::$db)->folderList($this->anything(), $f['id'], false)->thenReturn(new Result(self::v($this->filterFolders($f['id'])))); \Phake::when(Arsse::$db)->articleCount($this->anything(), $this->equalTo((new Context)->unread(true)->hidden(false)->folder($f['id'])))->thenReturn($this->reduceFolders($f['id'])); - \Phake::when(Arsse::$db)->subscriptionList($this->anything(), $f['id'], false)->thenReturn(new Result($this->v($this->filterSubs($f['id'])))); + \Phake::when(Arsse::$db)->subscriptionList($this->anything(), $f['id'], false)->thenReturn(new Result(self::v($this->filterSubs($f['id'])))); } $this->assertMessage($exp, $this->req($in)); } @@ -1245,7 +1245,7 @@ LONG_STRING; return $out; } - public function provideFeedListings(): iterable { + public static function provideFeedListings(): iterable { $exp = [ [ ['id' => 6, 'title' => 'Eurogamer', 'unread' => 0, 'cat_id' => 0, 'feed_url' => " http://example.com/6", 'has_icon' => true, 'last_updated' => 1266005327, 'order_id' => 1], @@ -1331,25 +1331,25 @@ LONG_STRING; ], ]; return [ - [[], $this->respGood($exp[0])], - [['cat_id' => -1], $this->respGood($exp[1])], - [['cat_id' => -1, 'unread_only' => true], $this->respGood($exp[2])], - [['cat_id' => -2], $this->respGood($exp[3])], - [['cat_id' => -2, 'unread_only' => true], $this->respGood($exp[4])], - [['cat_id' => -3], $this->respGood($exp[5])], - [['cat_id' => -3, 'unread_only' => true], $this->respGood($exp[6])], - [['cat_id' => -4], $this->respGood($exp[7])], - [['cat_id' => -4, 'unread_only' => true], $this->respGood($exp[8])], - [['cat_id' => 6], $this->respGood($exp[9])], - [['cat_id' => 6, 'limit' => 1], $this->respGood($exp[10])], - [['cat_id' => 6, 'limit' => 1, 'offset' => 1], $this->respGood($exp[11])], - [['cat_id' => 1], $this->respGood($exp[12])], - [['cat_id' => 1, 'include_nested' => true], $this->respGood($exp[13])], - [['cat_id' => 0, 'unread_only' => true], $this->respGood([])], - [['cat_id' => 2112], $this->respGood([])], - [['cat_id' => 2112, 'include_nested' => true], $this->respGood([])], - [['cat_id' => 6, 'limit' => -42], $this->respGood([])], - [['cat_id' => 6, 'offset' => 2], $this->respGood([])], + [[], self::respGood($exp[0])], + [['cat_id' => -1], self::respGood($exp[1])], + [['cat_id' => -1, 'unread_only' => true], self::respGood($exp[2])], + [['cat_id' => -2], self::respGood($exp[3])], + [['cat_id' => -2, 'unread_only' => true], self::respGood($exp[4])], + [['cat_id' => -3], self::respGood($exp[5])], + [['cat_id' => -3, 'unread_only' => true], self::respGood($exp[6])], + [['cat_id' => -4], self::respGood($exp[7])], + [['cat_id' => -4, 'unread_only' => true], self::respGood($exp[8])], + [['cat_id' => 6], self::respGood($exp[9])], + [['cat_id' => 6, 'limit' => 1], self::respGood($exp[10])], + [['cat_id' => 6, 'limit' => 1, 'offset' => 1], self::respGood($exp[11])], + [['cat_id' => 1], self::respGood($exp[12])], + [['cat_id' => 1, 'include_nested' => true], self::respGood($exp[13])], + [['cat_id' => 0, 'unread_only' => true], self::respGood([])], + [['cat_id' => 2112], self::respGood([])], + [['cat_id' => 2112, 'include_nested' => true], self::respGood([])], + [['cat_id' => 6, 'limit' => -42], self::respGood([])], + [['cat_id' => 6, 'offset' => 2], self::respGood([])], ]; } @@ -1357,67 +1357,67 @@ LONG_STRING; public function testChangeArticles(array $in, ResponseInterface $exp): void { $in = array_merge(['op' => "updateArticle", 'sid' => "PriestsOfSyrinx"], $in); \Phake::when(Arsse::$db)->articleMark->thenReturn(1); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['starred' => false], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(2); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['starred' => true], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(4); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['starred' => false], $this->equalTo((new Context)->articles([42])))->thenReturn(8); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['starred' => true], $this->equalTo((new Context)->articles([2112])))->thenReturn(16); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['read' => true], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(32); // false is read for TT-RSS - \Phake::when(Arsse::$db)->articleMark($this->userId, ['read' => false], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(64); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['read' => true], $this->equalTo((new Context)->articles([42])))->thenReturn(128); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['read' => false], $this->equalTo((new Context)->articles([2112])))->thenReturn(256); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['note' => ""], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(512); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['note' => "eh"], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(1024); - \Phake::when(Arsse::$db)->articleList($this->userId, $this->equalTo((new Context)->articles([42, 2112])->starred(true)), $this->anything())->thenReturn(new Result($this->v([['id' => 42]]))); - \Phake::when(Arsse::$db)->articleList($this->userId, $this->equalTo((new Context)->articles([42, 2112])->starred(false)), $this->anything())->thenReturn(new Result($this->v([['id' => 2112]]))); - \Phake::when(Arsse::$db)->articleList($this->userId, $this->equalTo((new Context)->articles([42, 2112])->unread(true)), $this->anything())->thenReturn(new Result($this->v([['id' => 42]]))); - \Phake::when(Arsse::$db)->articleList($this->userId, $this->equalTo((new Context)->articles([42, 2112])->unread(false)), $this->anything())->thenReturn(new Result($this->v([['id' => 2112]]))); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['starred' => false], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(2); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['starred' => true], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(4); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['starred' => false], $this->equalTo((new Context)->articles([42])))->thenReturn(8); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['starred' => true], $this->equalTo((new Context)->articles([2112])))->thenReturn(16); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['read' => true], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(32); // false is read for TT-RSS + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['read' => false], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(64); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['read' => true], $this->equalTo((new Context)->articles([42])))->thenReturn(128); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['read' => false], $this->equalTo((new Context)->articles([2112])))->thenReturn(256); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['note' => ""], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(512); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['note' => "eh"], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(1024); + \Phake::when(Arsse::$db)->articleList(self::$userId, $this->equalTo((new Context)->articles([42, 2112])->starred(true)), $this->anything())->thenReturn(new Result(self::v([['id' => 42]]))); + \Phake::when(Arsse::$db)->articleList(self::$userId, $this->equalTo((new Context)->articles([42, 2112])->starred(false)), $this->anything())->thenReturn(new Result(self::v([['id' => 2112]]))); + \Phake::when(Arsse::$db)->articleList(self::$userId, $this->equalTo((new Context)->articles([42, 2112])->unread(true)), $this->anything())->thenReturn(new Result(self::v([['id' => 42]]))); + \Phake::when(Arsse::$db)->articleList(self::$userId, $this->equalTo((new Context)->articles([42, 2112])->unread(false)), $this->anything())->thenReturn(new Result(self::v([['id' => 2112]]))); $this->assertMessage($exp, $this->req($in)); } - public function provideArticleChanges(): iterable { + public static function provideArticleChanges(): iterable { return [ - [[], $this->respErr("INCORRECT_USAGE")], - [['article_ids' => "42, 2112, -1"], $this->respGood(['status' => "OK", 'updated' => 2])], - [['article_ids' => "42, 2112, -1", 'field' => 0], $this->respGood(['status' => "OK", 'updated' => 2])], - [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 0], $this->respGood(['status' => "OK", 'updated' => 2])], - [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 1], $this->respGood(['status' => "OK", 'updated' => 4])], - [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 2], $this->respGood(['status' => "OK", 'updated' => 24])], - [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 3], $this->respErr("INCORRECT_USAGE")], - [['article_ids' => "42, 2112, -1", 'field' => 1], $this->respGood(['status' => "OK", 'updated' => 0])], - [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 0], $this->respGood(['status' => "OK", 'updated' => 0])], - [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 1], $this->respGood(['status' => "OK", 'updated' => 0])], - [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 2], $this->respGood(['status' => "OK", 'updated' => 0])], - [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 3], $this->respErr("INCORRECT_USAGE")], - [['article_ids' => "42, 2112, -1", 'field' => 2], $this->respGood(['status' => "OK", 'updated' => 32])], - [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 0], $this->respGood(['status' => "OK", 'updated' => 32])], - [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 1], $this->respGood(['status' => "OK", 'updated' => 64])], - [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 2], $this->respGood(['status' => "OK", 'updated' => 384])], - [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 3], $this->respErr("INCORRECT_USAGE")], - [['article_ids' => "42, 2112, -1", 'field' => 3], $this->respGood(['status' => "OK", 'updated' => 512])], - [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 0], $this->respGood(['status' => "OK", 'updated' => 512])], - [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 1], $this->respGood(['status' => "OK", 'updated' => 512])], - [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 2], $this->respGood(['status' => "OK", 'updated' => 512])], - [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 3], $this->respGood(['status' => "OK", 'updated' => 512])], - [['article_ids' => "42, 2112, -1", 'field' => 3, 'data' => "eh"], $this->respGood(['status' => "OK", 'updated' => 1024])], - [['article_ids' => "42, 2112, -1", 'field' => 4], $this->respErr("INCORRECT_USAGE")], - [['article_ids' => "0, -1", 'field' => 3], $this->respErr("INCORRECT_USAGE")], + [[], self::respErr("INCORRECT_USAGE")], + [['article_ids' => "42, 2112, -1"], self::respGood(['status' => "OK", 'updated' => 2])], + [['article_ids' => "42, 2112, -1", 'field' => 0], self::respGood(['status' => "OK", 'updated' => 2])], + [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 0], self::respGood(['status' => "OK", 'updated' => 2])], + [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 1], self::respGood(['status' => "OK", 'updated' => 4])], + [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 2], self::respGood(['status' => "OK", 'updated' => 24])], + [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 3], self::respErr("INCORRECT_USAGE")], + [['article_ids' => "42, 2112, -1", 'field' => 1], self::respGood(['status' => "OK", 'updated' => 0])], + [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 0], self::respGood(['status' => "OK", 'updated' => 0])], + [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 1], self::respGood(['status' => "OK", 'updated' => 0])], + [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 2], self::respGood(['status' => "OK", 'updated' => 0])], + [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 3], self::respErr("INCORRECT_USAGE")], + [['article_ids' => "42, 2112, -1", 'field' => 2], self::respGood(['status' => "OK", 'updated' => 32])], + [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 0], self::respGood(['status' => "OK", 'updated' => 32])], + [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 1], self::respGood(['status' => "OK", 'updated' => 64])], + [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 2], self::respGood(['status' => "OK", 'updated' => 384])], + [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 3], self::respErr("INCORRECT_USAGE")], + [['article_ids' => "42, 2112, -1", 'field' => 3], self::respGood(['status' => "OK", 'updated' => 512])], + [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 0], self::respGood(['status' => "OK", 'updated' => 512])], + [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 1], self::respGood(['status' => "OK", 'updated' => 512])], + [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 2], self::respGood(['status' => "OK", 'updated' => 512])], + [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 3], self::respGood(['status' => "OK", 'updated' => 512])], + [['article_ids' => "42, 2112, -1", 'field' => 3, 'data' => "eh"], self::respGood(['status' => "OK", 'updated' => 1024])], + [['article_ids' => "42, 2112, -1", 'field' => 4], self::respErr("INCORRECT_USAGE")], + [['article_ids' => "0, -1", 'field' => 3], self::respErr("INCORRECT_USAGE")], ]; } /** @dataProvider provideArticleListings */ public function testListArticles(array $in, ResponseInterface $exp): void { $in = array_merge(['op' => "getArticle", 'sid' => "PriestsOfSyrinx"], $in); - \Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result($this->v($this->labels))); - \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->v($this->usedLabels))); + \Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result(self::v($this->labels))); + \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result(self::v($this->usedLabels))); \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 101)->thenReturn([]); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 102)->thenReturn($this->v([1,3])); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101, 102])), $this->anything())->thenReturn(new Result($this->v($this->articles))); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101])), $this->anything())->thenReturn(new Result($this->v([$this->articles[0]]))); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([102])), $this->anything())->thenReturn(new Result($this->v([$this->articles[1]]))); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 102)->thenReturn(self::v([1,3])); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101, 102])), $this->anything())->thenReturn(new Result(self::v($this->articles))); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101])), $this->anything())->thenReturn(new Result(self::v([$this->articles[0]]))); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([102])), $this->anything())->thenReturn(new Result(self::v([$this->articles[1]]))); $this->assertMessage($exp, $this->req($in)); } - public function provideArticleListings(): iterable { + public static function provideArticleListings(): iterable { $exp = [ [ 'id' => "101", @@ -1475,13 +1475,13 @@ LONG_STRING; ], ]; return [ - [[], $this->respErr("INCORRECT_USAGE")], - [['article_id' => 0], $this->respErr("INCORRECT_USAGE")], - [['article_id' => -1], $this->respErr("INCORRECT_USAGE")], - [['article_id' => "0,-1"], $this->respErr("INCORRECT_USAGE")], - [['article_id' => "101,102"], $this->respGood($exp)], - [['article_id' => "101"], $this->respGood([$exp[0]])], - [['article_id' => "102"], $this->respGood([$exp[1]])], + [[], self::respErr("INCORRECT_USAGE")], + [['article_id' => 0], self::respErr("INCORRECT_USAGE")], + [['article_id' => -1], self::respErr("INCORRECT_USAGE")], + [['article_id' => "0,-1"], self::respErr("INCORRECT_USAGE")], + [['article_id' => "101,102"], self::respGood($exp)], + [['article_id' => "101"], self::respGood([$exp[0]])], + [['article_id' => "102"], self::respGood([$exp[1]])], ]; } @@ -1491,14 +1491,14 @@ LONG_STRING; \Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result([])); \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result([])); \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 101)->thenReturn([]); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 102)->thenReturn($this->v([1,3])); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101, 102])), $this->anything())->thenReturn(new Result($this->v($this->articles))); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101])), $this->anything())->thenReturn(new Result($this->v([$this->articles[0]]))); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([102])), $this->anything())->thenReturn(new Result($this->v([$this->articles[1]]))); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 102)->thenReturn(self::v([1,3])); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101, 102])), $this->anything())->thenReturn(new Result(self::v($this->articles))); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101])), $this->anything())->thenReturn(new Result(self::v([$this->articles[0]]))); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([102])), $this->anything())->thenReturn(new Result(self::v([$this->articles[1]]))); $this->assertMessage($exp, $this->req($in)); } - public function provideArticleListingsWithoutLabels(): iterable { + public static function provideArticleListingsWithoutLabels(): iterable { $exp = [ [ 'id' => "101", @@ -1553,13 +1553,13 @@ LONG_STRING; ], ]; return [ - [[], $this->respErr("INCORRECT_USAGE")], - [['article_id' => 0], $this->respErr("INCORRECT_USAGE")], - [['article_id' => -1], $this->respErr("INCORRECT_USAGE")], - [['article_id' => "0,-1"], $this->respErr("INCORRECT_USAGE")], - [['article_id' => "101,102"], $this->respGood($exp)], - [['article_id' => "101"], $this->respGood([$exp[0]])], - [['article_id' => "102"], $this->respGood([$exp[1]])], + [[], self::respErr("INCORRECT_USAGE")], + [['article_id' => 0], self::respErr("INCORRECT_USAGE")], + [['article_id' => -1], self::respErr("INCORRECT_USAGE")], + [['article_id' => "0,-1"], self::respErr("INCORRECT_USAGE")], + [['article_id' => "101,102"], self::respGood($exp)], + [['article_id' => "101"], self::respGood([$exp[0]])], + [['article_id' => "102"], self::respGood([$exp[1]])], ]; } @@ -1569,48 +1569,48 @@ LONG_STRING; $in = array_merge($base, $in); $action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn"; \Phake::when(Arsse::$obj)->get(\DateTimeImmutable::class)->thenReturn(new \DateTimeImmutable(self::NOW)); - \Phake::when(Arsse::$db)->labelList->thenReturn(new Result($this->v($this->labels))); - \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->v($this->usedLabels))); + \Phake::when(Arsse::$db)->labelList->thenReturn(new Result(self::v($this->labels))); + \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result(self::v($this->usedLabels))); \Phake::when(Arsse::$db)->articleLabelsGet->thenReturn([]); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2112)->thenReturn($this->v([1,3])); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2112)->thenReturn(self::v([1,3])); \Phake::when(Arsse::$db)->articleCategoriesGet->thenReturn([]); \Phake::when(Arsse::$db)->articleCategoriesGet($this->anything(), 2112)->thenReturn(["Boring","Illogical"]); \Phake::when(Arsse::$db)->articleCount->thenReturn(2); \Phake::when(Arsse::$db)->articleList->$action($out); $this->assertMessage($exp, $this->req($in)); if ($out) { - \Phake::verify(Arsse::$db)->articleList($this->userId, $this->equalTo($c), $fields, $order); + \Phake::verify(Arsse::$db)->articleList(self::$userId, $this->equalTo($c), $fields, $order); } else { \Phake::verify(Arsse::$db, \Phake::never())->articleList(\Phake::anyParameters()); } } - public function provideHeadlines(): iterable { + public static function provideHeadlines(): iterable { $t = Date::normalize(self::NOW); $c = (new Context)->hidden(false)->limit(200); - $out = $this->generateHeadlines(47); + $out = self::generateHeadlines(47); $gone = new ExceptionInput("idMissing"); - $comp = new Result($this->v([['id' => 47], ['id' => 2112]])); - $expFull = $this->outputHeadlines(47); - $expComp = $this->respGood([['id' => 47], ['id' => 2112]]); + $comp = new Result(self::v([['id' => 47], ['id' => 2112]])); + $expFull = self::outputHeadlines(47); + $expComp = self::respGood([['id' => 47], ['id' => 2112]]); $fields = ["id", "guid", "title", "author", "url", "unread", "starred", "edited_date", "published_date", "subscription", "subscription_title", "note"]; $sort = ["edited_date desc"]; return [ - [true, [], null, $c, [], [], $this->respErr("INCORRECT_USAGE")], - [true, ['feed_id' => 0], null, $c, [], [], $this->respGood([])], + [true, [], null, $c, [], [], self::respErr("INCORRECT_USAGE")], + [true, ['feed_id' => 0], null, $c, [], [], self::respGood([])], [true, ['feed_id' => -1], $out, (clone $c)->starred(true), $fields, ["marked_date desc"], $expFull], - [true, ['feed_id' => -2], null, $c, [], [], $this->respGood([])], + [true, ['feed_id' => -2], null, $c, [], [], self::respGood([])], [true, ['feed_id' => -4], $out, $c, $fields, $sort, $expFull], - [true, ['feed_id' => 2112], $gone, (clone $c)->subscription(2112), $fields, $sort, $this->respGood([])], + [true, ['feed_id' => 2112], $gone, (clone $c)->subscription(2112), $fields, $sort, self::respGood([])], [true, ['feed_id' => -2112], $out, (clone $c)->label(1088), $fields, $sort, $expFull], [true, ['feed_id' => -4, 'view_mode' => "adaptive"], $out, (clone $c)->unread(true), $fields, $sort, $expFull], - [true, ['feed_id' => -4, 'view_mode' => "published"], null, $c, [], [], $this->respGood([])], + [true, ['feed_id' => -4, 'view_mode' => "published"], null, $c, [], [], self::respGood([])], [true, ['feed_id' => -2112, 'view_mode' => "adaptive"], $out, (clone $c)->label(1088)->unread(true), $fields, $sort, $expFull], [true, ['feed_id' => -2112, 'view_mode' => "unread"], $out, (clone $c)->label(1088)->unread(true), $fields, $sort, $expFull], [true, ['feed_id' => 42, 'view_mode' => "marked"], $out, (clone $c)->subscription(42)->starred(true), $fields, $sort, $expFull], [true, ['feed_id' => 42, 'view_mode' => "has_note"], $out, (clone $c)->subscription(42)->annotated(true), $fields, $sort, $expFull], - [true, ['feed_id' => 42, 'view_mode' => "unread", 'search' => "unread:false"], null, $c, [], [], $this->respGood([])], - [true, ['feed_id' => 42, 'search' => "pub:true"], null, $c, [], [], $this->respGood([])], + [true, ['feed_id' => 42, 'view_mode' => "unread", 'search' => "unread:false"], null, $c, [], [], self::respGood([])], + [true, ['feed_id' => 42, 'search' => "pub:true"], null, $c, [], [], self::respGood([])], [true, ['feed_id' => -4, 'limit' => 5], $out, (clone $c)->limit(5), $fields, $sort, $expFull], [true, ['feed_id' => -4, 'skip' => 2], $out, (clone $c)->offset(2), $fields, $sort, $expFull], [true, ['feed_id' => -4, 'limit' => 5, 'skip' => 2], $out, (clone $c)->limit(5)->offset(2), $fields, $sort, $expFull], @@ -1618,7 +1618,7 @@ LONG_STRING; [true, ['feed_id' => -3, 'is_cat' => true], $out, $c, $fields, $sort, $expFull], [true, ['feed_id' => -4, 'is_cat' => true], $out, $c, $fields, $sort, $expFull], [true, ['feed_id' => -2, 'is_cat' => true], $out, (clone $c)->labelled(true), $fields, $sort, $expFull], - [true, ['feed_id' => -1, 'is_cat' => true], null, $c, [], [], $this->respGood([])], + [true, ['feed_id' => -1, 'is_cat' => true], null, $c, [], [], self::respGood([])], [true, ['feed_id' => 0, 'is_cat' => true], $out, (clone $c)->folderShallow(0), $fields, $sort, $expFull], [true, ['feed_id' => 0, 'is_cat' => true, 'include_nested' => true], $out, (clone $c)->folderShallow(0), $fields, $sort, $expFull], [true, ['feed_id' => 42, 'is_cat' => true], $out, (clone $c)->folderShallow(42), $fields, $sort, $expFull], @@ -1627,18 +1627,18 @@ LONG_STRING; [true, ['feed_id' => -4, 'order_by' => "date_reverse"], $out, $c, $fields, ["edited_date"], $expFull], [true, ['feed_id' => 42, 'search' => "interesting"], $out, (clone $c)->subscription(42)->searchTerms(["interesting"]), $fields, $sort, $expFull], [true, ['feed_id' => -6], $out, (clone $c)->unread(false)->markedRange(Date::sub("PT24H", $t), null), $fields, ["marked_date desc"], $expFull], - [true, ['feed_id' => -6, 'view_mode' => "unread"], null, $c, $fields, $sort, $this->respGood([])], + [true, ['feed_id' => -6, 'view_mode' => "unread"], null, $c, $fields, $sort, self::respGood([])], [true, ['feed_id' => -3], $out, (clone $c)->unread(true)->modifiedRange(Date::sub("PT24H", $t), null), $fields, $sort, $expFull], [true, ['feed_id' => -3, 'view_mode' => "marked"], $out, (clone $c)->unread(true)->starred(true)->modifiedRange(Date::sub("PT24H", $t), null), $fields, $sort, $expFull], - [false, [], null, (clone $c)->limit(null), [], [], $this->respErr("INCORRECT_USAGE")], - [false, ['feed_id' => 0], null, (clone $c)->limit(null), [], [], $this->respGood([])], + [false, [], null, (clone $c)->limit(null), [], [], self::respErr("INCORRECT_USAGE")], + [false, ['feed_id' => 0], null, (clone $c)->limit(null), [], [], self::respGood([])], [false, ['feed_id' => -1], $comp, (clone $c)->limit(null)->starred(true), ["id"], ["marked_date desc"], $expComp], - [false, ['feed_id' => -2], null, (clone $c)->limit(null), [], [], $this->respGood([])], + [false, ['feed_id' => -2], null, (clone $c)->limit(null), [], [], self::respGood([])], [false, ['feed_id' => -4], $comp, (clone $c)->limit(null), ["id"], $sort, $expComp], - [false, ['feed_id' => 2112], $gone, (clone $c)->limit(null)->subscription(2112), ["id"], $sort, $this->respGood([])], + [false, ['feed_id' => 2112], $gone, (clone $c)->limit(null)->subscription(2112), ["id"], $sort, self::respGood([])], [false, ['feed_id' => -2112], $comp, (clone $c)->limit(null)->label(1088), ["id"], $sort, $expComp], [false, ['feed_id' => -4, 'view_mode' => "adaptive"], $comp, (clone $c)->limit(null)->unread(true), ["id"], $sort, $expComp], - [false, ['feed_id' => -4, 'view_mode' => "published"], null, (clone $c)->limit(null), [], [], $this->respGood([])], + [false, ['feed_id' => -4, 'view_mode' => "published"], null, (clone $c)->limit(null), [], [], self::respGood([])], [false, ['feed_id' => -2112, 'view_mode' => "adaptive"], $comp, (clone $c)->limit(null)->label(1088)->unread(true), ["id"], $sort, $expComp], [false, ['feed_id' => -2112, 'view_mode' => "unread"], $comp, (clone $c)->limit(null)->label(1088)->unread(true), ["id"], $sort, $expComp], [false, ['feed_id' => 42, 'view_mode' => "marked"], $comp, (clone $c)->limit(null)->subscription(42)->starred(true), ["id"], $sort, $expComp], @@ -1648,7 +1648,7 @@ LONG_STRING; [false, ['feed_id' => -4, 'limit' => 5, 'skip' => 2], $comp, (clone $c)->limit(5)->offset(2), ["id"], $sort, $expComp], [false, ['feed_id' => -4, 'since_id' => 47], $comp, (clone $c)->limit(null)->articleRange(48, null), ["id"], $sort, $expComp], [false, ['feed_id' => -6], $comp, (clone $c)->limit(null)->unread(false)->markedRange(Date::sub("PT24H", $t), null), ["id"], ["marked_date desc"], $expComp], - [false, ['feed_id' => -6, 'view_mode' => "unread"], null, (clone $c)->limit(null), ["id"], $sort, $this->respGood([])], + [false, ['feed_id' => -6, 'view_mode' => "unread"], null, (clone $c)->limit(null), ["id"], $sort, self::respGood([])], [false, ['feed_id' => -3], $comp, (clone $c)->limit(null)->unread(true)->modifiedRange(Date::sub("PT24H", $t), null), ["id"], $sort, $expComp], [false, ['feed_id' => -3, 'view_mode' => "marked"], $comp, (clone $c)->limit(null)->unread(true)->starred(true)->modifiedRange(Date::sub("PT24H", $t), null), ["id"], $sort, $expComp], ]; @@ -1669,23 +1669,23 @@ LONG_STRING; ['op' => "getHeadlines", 'sid' => "PriestsOfSyrinx", 'feed_id' => 42, 'skip' => 47, 'include_header' => true, 'order_by' => "date_reverse"], ['op' => "getHeadlines", 'sid' => "PriestsOfSyrinx", 'feed_id' => -4, 'show_excerpt' => true], ]; - \Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result($this->v($this->labels))); - \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->v($this->usedLabels))); + \Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result(self::v($this->labels))); + \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result(self::v($this->usedLabels))); \Phake::when(Arsse::$db)->articleLabelsGet->thenReturn([]); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2112)->thenReturn($this->v([1,3])); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2112)->thenReturn(self::v([1,3])); \Phake::when(Arsse::$db)->articleCategoriesGet->thenReturn([]); \Phake::when(Arsse::$db)->articleCategoriesGet($this->anything(), 2112)->thenReturn(["Boring","Illogical"]); - \Phake::when(Arsse::$db)->articleList->thenReturn($this->generateHeadlines(1)); + \Phake::when(Arsse::$db)->articleList->thenReturn(self::generateHeadlines(1)); \Phake::when(Arsse::$db)->articleCount->thenReturn(0); \Phake::when(Arsse::$db)->articleCount($this->anything(), $this->equalTo((new Context)->unread(true)->hidden(false)))->thenReturn(1); // sanity check; this makes sure extra fields are not included in default situations $test = $this->req($in[0]); - $this->assertMessage($this->outputHeadlines(1), $test); + $this->assertMessage(self::outputHeadlines(1), $test); // test 'show_content' $test = $this->req($in[1]); $this->assertArrayHasKey("content", $this->extractMessageJson($test)['content'][0]); $this->assertArrayHasKey("content", $this->extractMessageJson($test)['content'][1]); - foreach ($this->generateHeadlines(1) as $key => $row) { + foreach (self::generateHeadlines(1) as $key => $row) { $this->assertSame($row['content'], $this->extractMessageJson($test)['content'][$key]['content']); } // test 'include_attachments' @@ -1708,21 +1708,21 @@ LONG_STRING; $this->assertSame($exp, $this->extractMessageJson($test)['content'][1]['attachments']); // test 'include_header' $test = $this->req($in[3]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => -4, 'is_cat' => false, 'first_id' => 1], - $this->extractMessageJson($this->outputHeadlines(1))['content'], + $this->extractMessageJson(self::outputHeadlines(1))['content'], ]); $this->assertMessage($exp, $test); // test 'include_header' with a category $test = $this->req($in[4]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => -3, 'is_cat' => true, 'first_id' => 1], - $this->extractMessageJson($this->outputHeadlines(1))['content'], + $this->extractMessageJson(self::outputHeadlines(1))['content'], ]); $this->assertMessage($exp, $test); // test 'include_header' with an empty result $test = $this->req($in[5]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => -1, 'is_cat' => true, 'first_id' => 0], [], ]); @@ -1730,31 +1730,31 @@ LONG_STRING; // test 'include_header' with an erroneous result \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->limit(200)->subscription(2112)->hidden(false)), $this->anything(), ["edited_date desc"])->thenThrow(new ExceptionInput("subjectMissing")); $test = $this->req($in[6]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => 2112, 'is_cat' => false, 'first_id' => 0], [], ]); $this->assertMessage($exp, $test); // test 'include_header' with ascending order $test = $this->req($in[7]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => -4, 'is_cat' => false, 'first_id' => 0], - $this->extractMessageJson($this->outputHeadlines(1))['content'], + $this->extractMessageJson(self::outputHeadlines(1))['content'], ]); $this->assertMessage($exp, $test); // test 'include_header' with skip - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->limit(1)->subscription(42)->hidden(false)), $this->anything(), ["edited_date desc"])->thenReturn($this->generateHeadlines(1867)); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->limit(1)->subscription(42)->hidden(false)), $this->anything(), ["edited_date desc"])->thenReturn(self::generateHeadlines(1867)); $test = $this->req($in[8]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => 42, 'is_cat' => false, 'first_id' => 1867], - $this->extractMessageJson($this->outputHeadlines(1))['content'], + $this->extractMessageJson(self::outputHeadlines(1))['content'], ]); $this->assertMessage($exp, $test); // test 'include_header' with skip and ascending order $test = $this->req($in[9]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => 42, 'is_cat' => false, 'first_id' => 0], - $this->extractMessageJson($this->outputHeadlines(1))['content'], + $this->extractMessageJson(self::outputHeadlines(1))['content'], ]); $this->assertMessage($exp, $test); // test 'show_excerpt' @@ -1767,8 +1767,8 @@ LONG_STRING; $this->assertSame($exp2, $this->extractMessageJson($test)['content'][1]['excerpt']); } - protected function generateHeadlines(int $id): Result { - return new Result($this->v([ + protected static function generateHeadlines(int $id): Result { + return new Result(self::v([ [ 'id' => $id, 'url' => 'http://example.com/1', @@ -1795,7 +1795,7 @@ LONG_STRING; 'title' => 'Article title 2', 'subscription_title' => "Feed 11", 'author' => 'J. King', - 'content' => $this->richContent, + 'content' => self::$richContent, 'guid' => '5be8a5a46ecd52ed132191c8d27fb1af6b3d4edc00234c5d9f8f0e10562ed3b7', 'published_date' => '2000-01-02 00:00:00', 'edited_date' => '2000-01-02 00:00:02', @@ -1812,8 +1812,8 @@ LONG_STRING; ])); } - protected function outputHeadlines(int $id): ResponseInterface { - return $this->respGood([ + protected static function outputHeadlines(int $id): ResponseInterface { + return self::respGood([ [ 'id' => $id, 'guid' => '', diff --git a/tests/cases/REST/TinyTinyRSS/TestSearch.php b/tests/cases/REST/TinyTinyRSS/TestSearch.php index 23a51693..3c95ef84 100644 --- a/tests/cases/REST/TinyTinyRSS/TestSearch.php +++ b/tests/cases/REST/TinyTinyRSS/TestSearch.php @@ -12,7 +12,7 @@ use JKingWeb\Arsse\REST\TinyTinyRSS\Search; /** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Search */ class TestSearch extends \JKingWeb\Arsse\Test\AbstractTest { - public function provideSearchStrings(): iterable { + public static function provideSearchStrings(): iterable { return [ 'Blank string' => ["", new Context], 'Whitespace only' => [" \n \t", new Context], diff --git a/tests/cases/Service/TestDaemon.php b/tests/cases/Service/TestDaemon.php index afc0374f..cace0aa7 100644 --- a/tests/cases/Service/TestDaemon.php +++ b/tests/cases/Service/TestDaemon.php @@ -56,7 +56,7 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest { $this->AssertSame($exp, $daemon->resolveRelativePath($path)); } - public function providePathResolutions(): iterable { + public static function providePathResolutions(): iterable { return [ ["/", "/home/me", "/"], ["/.", "/home/me", "/"], @@ -94,7 +94,7 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePidFileChecks(): iterable { + public static function providePidFileChecks(): iterable { return [ ["ok/file", false, new Exception("pidDirUnresolvable")], ["not/found", true, new Exception("pidDirMissing")], @@ -136,7 +136,7 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePidReadChecks(): iterable { + public static function providePidReadChecks(): iterable { return [ ["current", new Exception("pidDuplicate")], ["malformed1", new Exception("pidCorrupt")], @@ -190,7 +190,7 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePidWriteChecks(): iterable { + public static function providePidWriteChecks(): iterable { return [ ["current", new Exception("pidDuplicate")], ["malformed1", new Exception("pidCorrupt")], diff --git a/tests/cases/TestArsse.php b/tests/cases/TestArsse.php index 151b26ff..2ca5afee 100644 --- a/tests/cases/TestArsse.php +++ b/tests/cases/TestArsse.php @@ -56,7 +56,7 @@ class TestArsse extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideExtensionChecks(): iterable { + public static function provideExtensionChecks(): iterable { return [ [["pcre"], null], [["foo", "bar", "baz"], new Exception("extMissing", ['first' => "foo", 'total' => 3])], diff --git a/tests/cases/User/TestInternal.php b/tests/cases/User/TestInternal.php index ce19849c..04570525 100644 --- a/tests/cases/User/TestInternal.php +++ b/tests/cases/User/TestInternal.php @@ -46,7 +46,7 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $this->d->auth($user, $password)); } - public function provideAuthentication(): iterable { + public static function provideAuthentication(): iterable { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; $owen = "owen.hardy@example.com"; diff --git a/tests/cases/User/TestUser.php b/tests/cases/User/TestUser.php index 02db8089..5a1be7d5 100644 --- a/tests/cases/User/TestUser.php +++ b/tests/cases/User/TestUser.php @@ -71,7 +71,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db, \Phake::times($exp && $user === "jane.doe@example.com" ? 1 : 0))->userAdd($user, $password); } - public function provideAuthentication(): iterable { + public static function provideAuthentication(): iterable { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; return [ @@ -163,7 +163,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { $u->add($user, "secret"); } - public function provideInvalidUserNames(): iterable { + public static function provideInvalidUserNames(): iterable { // output names with control characters foreach (array_merge(range(0x00, 0x1F), [0x7F]) as $ord) { yield [chr($ord)]; @@ -419,7 +419,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->userExists($user); } - public function provideProperties(): iterable { + public static function provideProperties(): iterable { $defaults = ['num' => 1, 'admin' => false, 'lang' => null, 'tz' => "Etc/UTC", 'sort_asc' => false]; return [ [$defaults, $defaults, []], @@ -499,7 +499,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePropertyChanges(): iterable { + public static function providePropertyChanges(): iterable { return [ [['admin' => true], ['admin' => true]], [['admin' => 2], new ExceptionInput("invalidValue")], diff --git a/tests/lib/AbstractTest.php b/tests/lib/AbstractTest.php index 19b31291..27f27585 100644 --- a/tests/lib/AbstractTest.php +++ b/tests/lib/AbstractTest.php @@ -27,8 +27,6 @@ use GuzzleHttp\Psr7\ServerRequest; /** @coversNothing */ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { - use \DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts; - public function setUp(): void { self::clearData(); // create the object factory as a mock @@ -133,19 +131,24 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { return $req; } - public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void { - if (method_exists(parent::class, "assertMatchesRegularExpression")) { - parent::assertMatchesRegularExpression($pattern, $string, $message); + public function assertArraySubset($expected, $actual, string $message = ''): void { + $this->assertIsArray($actual); + if (array_is_list($expected)) { + $missing = $actual; + $actual = []; + foreach ($expected as $k => $v) { + $found = array_search($v, $missing, true); + if ($found !== false) { + $actual[$k] = $missing[$found]; + unset($missing[$found]); + } + } + $this->assertEquals($expected, $actual, $message ?: "Array subset does not match expectation."); } else { - parent::assertRegExp($pattern, $string, $message); - } - } - - public static function assertFileDoesNotExist(string $filename, string $message = ''): void { - if (method_exists(parent::class, "assertFileDoesNotExist")) { - parent::assertFileDoesNotExist($filename, $message); - } else { - parent::assertFileNotExists($filename, $message); + $actual = array_intersect_key($actual, $expected); + ksort($actual); + ksort($expected); + $this->assertEquals($expected, $actual, $message ?: "Array subset does not match expectation."); } } @@ -344,7 +347,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { $data = $this->stringify($data); } } - $this->assertCount(sizeof($expected), $data, "Number of result rows (".sizeof($data).") differs from number of expected rows (".sizeof($expected).")"); + $this->assertSameSize($expected, $data, "Number of result rows (".sizeof($data).") differs from number of expected rows (".sizeof($expected).")"); if (sizeof($expected)) { // make sure the expectations are consistent foreach ($expected as $exp) { @@ -372,7 +375,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { $found = array_search($row, $expected); unset($expected[$found]); } - $this->assertArraySubset($expected, [], false, "Expectations not in result set."); + $this->assertEmpty($expected, "Expectations not in result set."); } } diff --git a/tests/lib/PDOTest.php b/tests/lib/PDOTest.php index f0d6621c..e33ccad4 100644 --- a/tests/lib/PDOTest.php +++ b/tests/lib/PDOTest.php @@ -8,13 +8,13 @@ declare(strict_types=1); namespace JKingWeb\Arsse\Test; trait PDOTest { - protected function v($value) { + protected static function v($value) { if (!is_array($value)) { return $value; } foreach ($value as $k => $v) { if (is_array($v)) { - $value[$k] = $this->v($v); + $value[$k] = self::v($v); } elseif (is_int($v) || is_float($v)) { $value[$k] = (string) $v; } diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json index 12aedb29..5aa1a084 100644 --- a/vendor-bin/phpunit/composer.json +++ b/vendor-bin/phpunit/composer.json @@ -1,10 +1,9 @@ { "require-dev": { - "phpunit/phpunit": "^9.0", - "dms/phpunit-arraysubset-asserts": "^0.1 || ^0.2", + "phpunit/phpunit": "^11.0", "clue/arguments": "^2.0", "mikey179/vfsstream": "^1.6", "webmozart/glob": "^4.1", - "phake/phake": "^4.4 | ^3.1.9" + "phake/phake": "^4.4" } } diff --git a/vendor-bin/phpunit/composer.lock b/vendor-bin/phpunit/composer.lock index f448d73d..5dbe0074 100644 --- a/vendor-bin/phpunit/composer.lock +++ b/vendor-bin/phpunit/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "428806f4a006a89c0f7044ca6a635eaa", + "content-hash": "102d2fd932931255fb7b9b247bfb4d91", "packages": [], "packages-dev": [ { @@ -74,51 +74,6 @@ ], "time": "2020-12-08T13:02:50+00:00" }, - { - "name": "dms/phpunit-arraysubset-asserts", - "version": "v0.2.1", - "source": { - "type": "git", - "url": "https://github.com/rdohms/phpunit-arraysubset-asserts.git", - "reference": "8e3673a70019a60df484e36fc3271d63cbdc40ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/rdohms/phpunit-arraysubset-asserts/zipball/8e3673a70019a60df484e36fc3271d63cbdc40ea", - "reference": "8e3673a70019a60df484e36fc3271d63cbdc40ea", - "shasum": "" - }, - "require": { - "php": "^7.3|^8.0", - "phpunit/phpunit": "^9.0" - }, - "require-dev": { - "dms/coding-standard": "^1.0", - "squizlabs/php_codesniffer": "^3.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "DMS\\PHPUnitExtensions\\ArraySubset\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Rafael Dohms", - "email": "rdohms@gmail.com" - } - ], - "description": "This package provides ArraySubset and related asserts once deprecated in PHPUnit 8", - "support": { - "issues": "https://github.com/rdohms/phpunit-arraysubset-asserts/issues", - "source": "https://github.com/rdohms/phpunit-arraysubset-asserts/tree/v0.2.1" - }, - "time": "2020-10-03T21:43:40+00:00" - }, { "name": "doctrine/instantiator", "version": "1.5.0", @@ -550,35 +505,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.32", + "version": "11.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/418c59fd080954f8c4aa5631d9502ecda2387118", + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.19.1 || ^5.1.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-text-template": "^2.0.4", - "sebastian/code-unit-reverse-lookup": "^2.0.3", - "sebastian/complexity": "^2.0.3", - "sebastian/environment": "^5.1.5", - "sebastian/lines-of-code": "^1.0.4", - "sebastian/version": "^3.0.2", + "nikic/php-parser": "^5.3.1", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-text-template": "^4.0.1", + "sebastian/code-unit-reverse-lookup": "^4.0.1", + "sebastian/complexity": "^4.0.1", + "sebastian/environment": "^7.2.0", + "sebastian/lines-of-code": "^3.0.1", + "sebastian/version": "^5.0.2", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^11.5.0" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -587,7 +542,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "9.2.x-dev" + "dev-main": "11.0.x-dev" } }, "autoload": { @@ -616,7 +571,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.8" }, "funding": [ { @@ -624,32 +579,32 @@ "type": "github" } ], - "time": "2024-08-22T04:23:01+00:00" + "time": "2024-12-11T12:34:27+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -676,7 +631,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" }, "funding": [ { @@ -684,28 +640,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2024-08-27T05:02:59+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcntl": "*" @@ -713,7 +669,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -739,7 +695,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" }, "funding": [ { @@ -747,32 +704,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2024-07-03T05:07:44+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -798,7 +755,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" }, "funding": [ { @@ -806,32 +764,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2024-07-03T05:08:43+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -857,7 +815,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" }, "funding": [ { @@ -865,24 +824,23 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2024-07-03T05:09:35+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.22", + "version": "11.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c" + "reference": "153d0531b9f7e883c5053160cad6dd5ac28140b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f80235cb4d3caa59ae09be3adf1ded27521d1a9c", - "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/153d0531b9f7e883c5053160cad6dd5ac28140b3", + "reference": "153d0531b9f7e883c5053160cad6dd5ac28140b3", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -892,27 +850,26 @@ "myclabs/deep-copy": "^1.12.1", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.32", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.4", - "phpunit/php-timer": "^5.0.3", - "sebastian/cli-parser": "^1.0.2", - "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.6", - "sebastian/environment": "^5.1.5", - "sebastian/exporter": "^4.0.6", - "sebastian/global-state": "^5.0.7", - "sebastian/object-enumerator": "^4.0.4", - "sebastian/resource-operations": "^3.0.4", - "sebastian/type": "^3.2.1", - "sebastian/version": "^3.0.2" + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0.8", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.2", + "sebastian/comparator": "^6.2.1", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.0", + "sebastian/exporter": "^6.3.0", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/type": "^5.1.0", + "sebastian/version": "^5.0.2", + "staabm/side-effects-detector": "^1.0.5" }, "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -920,7 +877,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "11.5-dev" } }, "autoload": { @@ -952,7 +909,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.22" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.2" }, "funding": [ { @@ -968,32 +925,32 @@ "type": "tidelift" } ], - "time": "2024-12-05T13:48:26+00:00" + "time": "2024-12-21T05:51:08+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.2", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1016,7 +973,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" }, "funding": [ { @@ -1024,32 +982,32 @@ "type": "github" } ], - "time": "2024-03-02T06:27:43+00:00" + "time": "2024-07-03T04:41:36+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1072,7 +1030,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.2" }, "funding": [ { @@ -1080,32 +1039,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2024-12-12T09:59:06+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "183a9b2632194febd219bb9246eee421dad8d45e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1127,7 +1086,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" }, "funding": [ { @@ -1135,34 +1095,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2024-07-03T04:45:54+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "6.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/43d129d6a0f81c78bee378b46688293eb7ea3739", + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.2-dev" } }, "autoload": { @@ -1201,7 +1163,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/6.2.1" }, "funding": [ { @@ -1209,33 +1172,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2024-10-31T05:30:08+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1258,7 +1221,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" }, "funding": [ { @@ -1266,33 +1230,33 @@ "type": "github" } ], - "time": "2023-12-22T06:19:30+00:00" + "time": "2024-07-03T04:49:50+00:00" }, { "name": "sebastian/diff", - "version": "4.0.6", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^11.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1324,7 +1288,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" }, "funding": [ { @@ -1332,27 +1297,27 @@ "type": "github" } ], - "time": "2024-03-02T06:30:58+00:00" + "time": "2024-07-03T04:53:05+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "7.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-posix": "*" @@ -1360,7 +1325,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "7.2-dev" } }, "autoload": { @@ -1379,7 +1344,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -1387,7 +1352,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.0" }, "funding": [ { @@ -1395,34 +1361,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2024-07-03T04:54:44+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.6", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/3473f61172093b2da7de1fb5782e1f24cc036dc3", + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -1464,7 +1430,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.0" }, "funding": [ { @@ -1472,38 +1439,35 @@ "type": "github" } ], - "time": "2024-03-02T06:33:00+00:00" + "time": "2024-12-05T09:17:50+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "7.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "3be331570a721f9a4b5917f4209773de17f747d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1522,13 +1486,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" }, "funding": [ { @@ -1536,33 +1501,33 @@ "type": "github" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2024-07-03T04:57:36+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1585,7 +1550,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" }, "funding": [ { @@ -1593,34 +1559,34 @@ "type": "github" } ], - "time": "2023-12-22T06:20:34+00:00" + "time": "2024-07-03T04:58:38+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "f5b498e631a74204185071eb41f33f38d64608aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1642,7 +1608,8 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" }, "funding": [ { @@ -1650,32 +1617,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2024-07-03T05:00:13+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1697,7 +1664,8 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" }, "funding": [ { @@ -1705,32 +1673,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2024-07-03T05:01:32+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1760,7 +1728,8 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" }, "funding": [ { @@ -1768,86 +1737,32 @@ "type": "github" } ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-14T16:00:52+00:00" + "time": "2024-07-03T05:10:34+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/461b9c5da241511a2a0e8f240814fb23ce5c0aac", + "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -1870,7 +1785,8 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.1.0" }, "funding": [ { @@ -1878,29 +1794,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2024-09-17T13:12:04+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1923,7 +1839,8 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" }, "funding": [ { @@ -1931,7 +1848,59 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2024-10-09T05:16:32+00:00" + }, + { + "name": "staabm/side-effects-detector", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00" }, { "name": "theseer/tokenizer",