From 17a2fa96f85694e3613650f59b4863b53a5cacf4 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Wed, 16 Oct 2019 14:42:43 -0400 Subject: [PATCH] Upgrade to PHPUnit 8 --- .gitignore | 3 +- tests/cases/CLI/TestCLI.php | 24 +-- tests/cases/Conf/TestConf.php | 4 +- tests/cases/Database/AbstractTest.php | 8 +- tests/cases/Database/SeriesArticle.php | 6 +- tests/cases/Database/SeriesMiscellany.php | 2 +- tests/cases/Database/TestDatabase.php | 8 +- tests/cases/Db/BaseDriver.php | 8 +- tests/cases/Db/BaseResult.php | 8 +- tests/cases/Db/BaseStatement.php | 12 +- tests/cases/Db/BaseUpdate.php | 8 +- tests/cases/Db/MySQL/TestCreation.php | 2 +- tests/cases/Db/MySQLPDO/TestCreation.php | 2 +- tests/cases/Db/PostgreSQL/TestCreation.php | 4 +- tests/cases/Db/PostgreSQL/TestDatabase.php | 2 +- tests/cases/Db/PostgreSQL/TestDriver.php | 4 +- tests/cases/Db/PostgreSQL/TestResult.php | 2 +- tests/cases/Db/PostgreSQL/TestStatement.php | 2 +- tests/cases/Db/PostgreSQLPDO/TestCreation.php | 4 +- tests/cases/Db/PostgreSQLPDO/TestDatabase.php | 2 +- tests/cases/Db/PostgreSQLPDO/TestDriver.php | 2 +- tests/cases/Db/SQLite3/TestCreation.php | 4 +- tests/cases/Db/SQLite3/TestDriver.php | 4 +- tests/cases/Db/SQLite3/TestResult.php | 2 +- tests/cases/Db/SQLite3/TestStatement.php | 2 +- tests/cases/Db/SQLite3/TestUpdate.php | 2 +- tests/cases/Db/SQLite3PDO/TestCreation.php | 4 +- tests/cases/Db/SQLite3PDO/TestDriver.php | 4 +- tests/cases/Db/TestTransaction.php | 2 +- tests/cases/Exception/TestException.php | 4 +- tests/cases/Feed/TestFeed.php | 4 +- tests/cases/Feed/TestFetching.php | 2 +- tests/cases/ImportExport/TestFile.php | 8 +- tests/cases/ImportExport/TestImportExport.php | 4 +- tests/cases/ImportExport/TestOPML.php | 4 +- tests/cases/Misc/TestDate.php | 2 +- tests/cases/Misc/TestURL.php | 6 +- tests/cases/Misc/TestValueInfo.php | 6 +- tests/cases/REST/Fever/TestAPI.php | 12 +- tests/cases/REST/Fever/TestUser.php | 8 +- tests/cases/REST/NextCloudNews/TestV1_2.php | 4 +- .../cases/REST/NextCloudNews/TestVersions.php | 2 +- tests/cases/REST/TestREST.php | 14 +- tests/cases/REST/TinyTinyRSS/TestAPI.php | 8 +- tests/cases/REST/TinyTinyRSS/TestIcon.php | 4 +- tests/cases/REST/TinyTinyRSS/TestSearch.php | 2 +- tests/cases/Service/TestService.php | 2 +- tests/cases/User/TestInternal.php | 4 +- tests/cases/User/TestUser.php | 16 +- tests/lib/AbstractTest.php | 6 +- tests/lib/Lang/Setup.php | 4 +- vendor-bin/phpunit/composer.json | 3 +- vendor-bin/phpunit/composer.lock | 183 +++++++++++++----- 53 files changed, 273 insertions(+), 180 deletions(-) diff --git a/.gitignore b/.gitignore index b0f2b793..d90e245d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,8 @@ /arsse.db* /config.php /.php_cs.cache -yarn-error.log +/yarn-error.log +/tests/.phpunit.result.cache # Windows files diff --git a/tests/cases/CLI/TestCLI.php b/tests/cases/CLI/TestCLI.php index c62eac18..0009d405 100644 --- a/tests/cases/CLI/TestCLI.php +++ b/tests/cases/CLI/TestCLI.php @@ -17,7 +17,7 @@ use JKingWeb\Arsse\ImportExport\OPML; /** @covers \JKingWeb\Arsse\CLI */ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { self::clearData(false); $this->cli = \Phake::partialMock(CLI::class); \Phake::when($this->cli)->logError->thenReturn(null); @@ -57,7 +57,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertLoaded(false); } - public function provideHelpText() { + public function provideHelpText(): iterable { return [ ["arsse.php --help", "arsse.php"], ["arsse --help", "arsse"], @@ -98,7 +98,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->feedUpdate; } - public function provideFeedUpdates() { + public function provideFeedUpdates(): iterable { return [ ["arsse.php feed refresh 1", 0, ""], ["arsse.php feed refresh 2", 10502, ""], @@ -117,7 +117,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($conf)->exportFile($file, true); } - public function provideDefaultConfigurationSaves() { + public function provideDefaultConfigurationSaves(): iterable { return [ ["arsse.php conf save-defaults", 0, "php://output"], ["arsse.php conf save-defaults -", 0, "php://output"], @@ -134,7 +134,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($this->cli, $cmd, $exitStatus, $output); } - public function provideUserList() { + public function provideUserList(): iterable { $list = ["john.doe@example.com", "jane.doe@example.com"]; $str = implode(PHP_EOL, $list); return [ @@ -160,7 +160,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($this->cli, $cmd, $exitStatus, $output); } - public function provideUserAdditions() { + public function provideUserAdditions(): iterable { return [ ["arsse.php user add john.doe@example.com", 10403, ""], ["arsse.php user add jane.doe@example.com", 0, "random password"], @@ -186,7 +186,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($this->cli, $cmd, $exitStatus, $output); } - public function provideUserAuthentication() { + public function provideUserAuthentication(): iterable { $l = new \JKingWeb\Arsse\Lang; $success = $l("CLI.Auth.Success"); $failure = $l("CLI.Auth.Failure"); @@ -215,7 +215,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($this->cli, $cmd, $exitStatus, $output); } - public function provideUserRemovals() { + public function provideUserRemovals(): iterable { return [ ["arsse.php user remove john.doe@example.com", 0, ""], ["arsse.php user remove jane.doe@example.com", 10402, ""], @@ -241,7 +241,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($this->cli, $cmd, $exitStatus, $output); } - public function provideUserPasswordChanges() { + public 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, ""], @@ -271,7 +271,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertConsole($this->cli, $cmd, $exitStatus, $output); } - public function provideUserPasswordClearings() { + public function provideUserPasswordClearings(): iterable { return [ ["arsse.php user unset-pass john.doe@example.com", 0, ""], ["arsse.php user unset-pass jane.doe@example.com", 10402, ""], @@ -292,7 +292,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($opml)->exportFile($file, $user, $flat); } - public function provideOpmlExports() { + public 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], @@ -333,7 +333,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($opml)->importFile($file, $user, $flat, $replace); } - public function provideOpmlImports() { + public 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], diff --git a/tests/cases/Conf/TestConf.php b/tests/cases/Conf/TestConf.php index 40164431..f52d3b35 100644 --- a/tests/cases/Conf/TestConf.php +++ b/tests/cases/Conf/TestConf.php @@ -14,7 +14,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { public static $vfs; public static $path; - public function setUp() { + public function setUp(): void { self::clearData(); self::$vfs = vfsStream::setup("root", null, [ 'confGood' => ' "xx");', @@ -32,7 +32,7 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest { chmod(self::$path."confForbidden", 0000); } - public function tearDown() { + public function tearDown(): void { self::$path = null; self::$vfs = null; self::clearData(); diff --git a/tests/cases/Database/AbstractTest.php b/tests/cases/Database/AbstractTest.php index 1bccfde2..ff5acdd5 100644 --- a/tests/cases/Database/AbstractTest.php +++ b/tests/cases/Database/AbstractTest.php @@ -41,7 +41,7 @@ abstract class AbstractTest extends \JKingWeb\Arsse\Test\AbstractTest { return $class->getShortName(); } - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { // establish a clean baseline static::clearData(); // perform an initial connection to the database to reset its version to zero @@ -61,7 +61,7 @@ abstract class AbstractTest extends \JKingWeb\Arsse\Test\AbstractTest { Arsse::$db->driverSchemaUpdate(); } - public function setUp() { + public function setUp(): void { // get the name of the test's test series $this->series = $this->findTraitofTest($this->getName(false)); static::clearData(); @@ -83,7 +83,7 @@ abstract class AbstractTest extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function tearDown() { + public function tearDown(): void { // call the series-specific teardown method $this->series = $this->findTraitofTest($this->getName(false)); $tearDown = "tearDown".$this->series; @@ -96,7 +96,7 @@ abstract class AbstractTest extends \JKingWeb\Arsse\Test\AbstractTest { static::clearData(); } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { if (static::$drv) { // wipe the database absolutely clean static::dbRaze(static::$drv); diff --git a/tests/cases/Database/SeriesArticle.php b/tests/cases/Database/SeriesArticle.php index 0a92ba2c..26fc4f02 100644 --- a/tests/cases/Database/SeriesArticle.php +++ b/tests/cases/Database/SeriesArticle.php @@ -420,7 +420,7 @@ trait SeriesArticle { $this->assertEquals($exp, $ids); } - public function provideContextMatches() { + public function provideContextMatches(): iterable { return [ 'Blank context' => [new Context, [1,2,3,4,5,6,7,8,19,20]], 'Folder tree' => [(new Context)->folder(1), [5,6,7,8]], @@ -582,7 +582,7 @@ trait SeriesArticle { $this->assertSame($exp, $act); } - public function provideOrderedLists() { + public 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]], @@ -1058,7 +1058,7 @@ trait SeriesArticle { Arsse::$db->articleList($this->user, (new Context)->$option([])); } - public function provideArrayContextOptions() { + public function provideArrayContextOptions(): iterable { foreach ([ "articles", "editions", "subscriptions", "foldersShallow", //"folders", diff --git a/tests/cases/Database/SeriesMiscellany.php b/tests/cases/Database/SeriesMiscellany.php index a7591bbe..5a64ea47 100644 --- a/tests/cases/Database/SeriesMiscellany.php +++ b/tests/cases/Database/SeriesMiscellany.php @@ -42,7 +42,7 @@ trait SeriesMiscellany { } public function testCheckCharacterSetAcceptability() { - $this->assertInternalType("bool", Arsse::$db->driverCharsetAcceptable()); + $this->assertIsBool(Arsse::$db->driverCharsetAcceptable()); } public function testPerformMaintenance() { diff --git a/tests/cases/Database/TestDatabase.php b/tests/cases/Database/TestDatabase.php index 60926498..3ae4f5b2 100644 --- a/tests/cases/Database/TestDatabase.php +++ b/tests/cases/Database/TestDatabase.php @@ -12,7 +12,7 @@ use JKingWeb\Arsse\Database; class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest { protected $db = null; - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(); try { @@ -22,7 +22,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function tearDown() { + public function tearDown(): void { $this->db = null; self::clearData(); } @@ -34,7 +34,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $this->db->generateIn($inV, $inT)); } - public function provideInClauses() { + public function provideInClauses(): iterable { $l = Database::LIMIT_SET_SIZE + 1; $strings = array_fill(0, $l, ""); $ints = range(1, $l); @@ -69,7 +69,7 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $this->db->generateSearch($inV, $inC, $inAny)); } - public function provideSearchClauses() { + public function provideSearchClauses(): iterable { $terms = array_fill(0, Database::LIMIT_SET_SIZE + 1, "a"); $clause = array_fill(0, Database::LIMIT_SET_SIZE + 1, "test like '%a%' escape '^'"); $longString = str_repeat("0", Database::LIMIT_SET_STRING_LENGTH + 1); diff --git a/tests/cases/Db/BaseDriver.php b/tests/cases/Db/BaseDriver.php index 6d2193bc..59165a1b 100644 --- a/tests/cases/Db/BaseDriver.php +++ b/tests/cases/Db/BaseDriver.php @@ -23,14 +23,14 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { //'dbSQLite3File' => "(temporary file)", ]; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { // establish a clean baseline static::clearData(); static::setConf(static::$conf); static::$interface = static::dbInterface(); } - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(static::$conf); if (!static::$interface) { @@ -45,13 +45,13 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest { $this->drv = new static::$dbDriverClass; } - public function tearDown() { + public function tearDown(): void { // deconstruct the driver unset($this->drv); self::clearData(); } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { if (static::$interface) { // completely clear the database static::dbRaze(static::$interface); diff --git a/tests/cases/Db/BaseResult.php b/tests/cases/Db/BaseResult.php index e18e3393..0fa84dcc 100644 --- a/tests/cases/Db/BaseResult.php +++ b/tests/cases/Db/BaseResult.php @@ -15,14 +15,14 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { abstract protected function makeResult(string $q): array; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { // establish a clean baseline static::clearData(); static::setConf(); static::$interface = static::dbInterface(); } - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(); if (!static::$interface) { @@ -33,11 +33,11 @@ abstract class BaseResult extends \JKingWeb\Arsse\Test\AbstractTest { $this->resultClass = static::$dbResultClass; } - public function tearDown() { + public function tearDown(): void { self::clearData(); } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { if (static::$interface) { // completely clear the database static::dbRaze(static::$interface); diff --git a/tests/cases/Db/BaseStatement.php b/tests/cases/Db/BaseStatement.php index 0101f64b..6aa81cf3 100644 --- a/tests/cases/Db/BaseStatement.php +++ b/tests/cases/Db/BaseStatement.php @@ -15,14 +15,14 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { abstract protected function makeStatement(string $q, array $types = []): array; abstract protected function decorateTypeSyntax(string $value, string $type): string; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { // establish a clean baseline static::clearData(); static::setConf(); static::$interface = static::dbInterface(); } - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(); if (!static::$interface) { @@ -33,11 +33,11 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { $this->statementClass = static::$dbStatementClass; } - public function tearDown() { + public function tearDown(): void { self::clearData(); } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { if (static::$interface) { // completely clear the database static::dbRaze(static::$interface); @@ -129,7 +129,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { $s->runArray(['ook', 'eek']); } - public function provideBindings() { + public 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")); @@ -272,7 +272,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideBinaryBindings() { + public 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")); diff --git a/tests/cases/Db/BaseUpdate.php b/tests/cases/Db/BaseUpdate.php index 01c098cc..0c78dccb 100644 --- a/tests/cases/Db/BaseUpdate.php +++ b/tests/cases/Db/BaseUpdate.php @@ -18,14 +18,14 @@ class BaseUpdate extends \JKingWeb\Arsse\Test\AbstractTest { protected $base; protected $path; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { // establish a clean baseline static::clearData(); static::setConf(); static::$interface = static::dbInterface(); } - public function setUp() { + public function setUp(): void { if (!static::$interface) { $this->markTestSkipped(static::$implementation." database driver not available"); } @@ -42,14 +42,14 @@ class BaseUpdate extends \JKingWeb\Arsse\Test\AbstractTest { static::dbRaze(static::$interface); } - public function tearDown() { + public function tearDown(): void { // deconstruct the driver unset($this->drv); unset($this->path, $this->base, $this->vfs); self::clearData(); } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { if (static::$interface) { // completely clear the database static::dbRaze(static::$interface); diff --git a/tests/cases/Db/MySQL/TestCreation.php b/tests/cases/Db/MySQL/TestCreation.php index 52834587..5f9200c9 100644 --- a/tests/cases/Db/MySQL/TestCreation.php +++ b/tests/cases/Db/MySQL/TestCreation.php @@ -13,7 +13,7 @@ use JKingWeb\Arsse\Db\MySQL\Driver as Driver; * @covers \JKingWeb\Arsse\Db\MySQL\Driver * @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder */ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { if (!Driver::requirementsMet()) { $this->markTestSkipped("MySQL extension not loaded"); } diff --git a/tests/cases/Db/MySQLPDO/TestCreation.php b/tests/cases/Db/MySQLPDO/TestCreation.php index aa9b8492..56973eff 100644 --- a/tests/cases/Db/MySQLPDO/TestCreation.php +++ b/tests/cases/Db/MySQLPDO/TestCreation.php @@ -13,7 +13,7 @@ use JKingWeb\Arsse\Db\MySQL\PDODriver as Driver; * @covers \JKingWeb\Arsse\Db\MySQL\PDODriver * @covers \JKingWeb\Arsse\Db\MySQL\ExceptionBuilder */ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { if (!Driver::requirementsMet()) { $this->markTestSkipped("PDO-MySQL extension not loaded"); } diff --git a/tests/cases/Db/PostgreSQL/TestCreation.php b/tests/cases/Db/PostgreSQL/TestCreation.php index cbc7fb2c..bfd58a6d 100644 --- a/tests/cases/Db/PostgreSQL/TestCreation.php +++ b/tests/cases/Db/PostgreSQL/TestCreation.php @@ -13,7 +13,7 @@ use JKingWeb\Arsse\Db\PostgreSQL\Driver; * @group slow * @covers \JKingWeb\Arsse\Db\PostgreSQL\Driver */ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { if (!Driver::requirementsMet()) { $this->markTestSkipped("PostgreSQL extension not loaded"); } @@ -35,7 +35,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideConnectionStrings() { + public 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/TestDatabase.php b/tests/cases/Db/PostgreSQL/TestDatabase.php index 9fda4d97..ad1f8a53 100644 --- a/tests/cases/Db/PostgreSQL/TestDatabase.php +++ b/tests/cases/Db/PostgreSQL/TestDatabase.php @@ -19,7 +19,7 @@ class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest { return (int) static::$drv->query("SELECT coalesce(last_value, (select max(id) from $table)) + 1 from pg_sequences where sequencename = '{$table}_id_seq'")->getValue(); } - public function setUp() { + public function setUp(): void { parent::setUp(); $seqList = "select diff --git a/tests/cases/Db/PostgreSQL/TestDriver.php b/tests/cases/Db/PostgreSQL/TestDriver.php index ee5a9ba5..5e60915a 100644 --- a/tests/cases/Db/PostgreSQL/TestDriver.php +++ b/tests/cases/Db/PostgreSQL/TestDriver.php @@ -18,7 +18,7 @@ class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver { protected $lock = ["BEGIN", "LOCK TABLE arsse_meta IN EXCLUSIVE MODE NOWAIT"]; protected $setVersion = "UPDATE arsse_meta set value = '#' where key = 'schema_version'"; - public function tearDown() { + public function tearDown(): void { try { $this->drv->exec("ROLLBACK"); } catch (\Throwable $e) { @@ -26,7 +26,7 @@ class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver { parent::tearDown(); } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { if (static::$interface) { static::dbRaze(static::$interface); @pg_close(static::$interface); diff --git a/tests/cases/Db/PostgreSQL/TestResult.php b/tests/cases/Db/PostgreSQL/TestResult.php index f854b8dc..0992962b 100644 --- a/tests/cases/Db/PostgreSQL/TestResult.php +++ b/tests/cases/Db/PostgreSQL/TestResult.php @@ -21,7 +21,7 @@ class TestResult extends \JKingWeb\Arsse\TestCase\Db\BaseResult { return [static::$interface, $set]; } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { if (static::$interface) { static::dbRaze(static::$interface); @pg_close(static::$interface); diff --git a/tests/cases/Db/PostgreSQL/TestStatement.php b/tests/cases/Db/PostgreSQL/TestStatement.php index 3e3008e8..7b44ec1c 100644 --- a/tests/cases/Db/PostgreSQL/TestStatement.php +++ b/tests/cases/Db/PostgreSQL/TestStatement.php @@ -32,7 +32,7 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement { } } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { if (static::$interface) { static::dbRaze(static::$interface); @pg_close(static::$interface); diff --git a/tests/cases/Db/PostgreSQLPDO/TestCreation.php b/tests/cases/Db/PostgreSQLPDO/TestCreation.php index 5e2ad7b1..cb1b9cae 100644 --- a/tests/cases/Db/PostgreSQLPDO/TestCreation.php +++ b/tests/cases/Db/PostgreSQLPDO/TestCreation.php @@ -13,7 +13,7 @@ use JKingWeb\Arsse\Db\PostgreSQL\PDODriver as Driver; * @group slow * @covers \JKingWeb\Arsse\Db\PostgreSQL\PDODriver */ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { if (!Driver::requirementsMet()) { $this->markTestSkipped("PDO-PostgreSQL extension not loaded"); } @@ -35,7 +35,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideConnectionStrings() { + public 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/TestDatabase.php b/tests/cases/Db/PostgreSQLPDO/TestDatabase.php index 6f8ef2a1..e2dcedd7 100644 --- a/tests/cases/Db/PostgreSQLPDO/TestDatabase.php +++ b/tests/cases/Db/PostgreSQLPDO/TestDatabase.php @@ -20,7 +20,7 @@ class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest { return (int) static::$drv->query("SELECT coalesce(last_value, (select max(id) from $table)) + 1 from pg_sequences where sequencename = '{$table}_id_seq'")->getValue(); } - public function setUp() { + public function setUp(): void { parent::setUp(); $seqList = "select diff --git a/tests/cases/Db/PostgreSQLPDO/TestDriver.php b/tests/cases/Db/PostgreSQLPDO/TestDriver.php index b87828cb..dcde7cfd 100644 --- a/tests/cases/Db/PostgreSQLPDO/TestDriver.php +++ b/tests/cases/Db/PostgreSQLPDO/TestDriver.php @@ -19,7 +19,7 @@ class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver { protected $lock = ["BEGIN", "LOCK TABLE arsse_meta IN EXCLUSIVE MODE NOWAIT"]; protected $setVersion = "UPDATE arsse_meta set value = '#' where key = 'schema_version'"; - public function tearDown() { + public function tearDown(): void { try { $this->drv->exec("ROLLBACK"); } catch (\Throwable $e) { diff --git a/tests/cases/Db/SQLite3/TestCreation.php b/tests/cases/Db/SQLite3/TestCreation.php index a8077ce2..59a7d5b8 100644 --- a/tests/cases/Db/SQLite3/TestCreation.php +++ b/tests/cases/Db/SQLite3/TestCreation.php @@ -18,7 +18,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { protected $drv; protected $ch; - public function setUp() { + public function setUp(): void { if (!Driver::requirementsMet()) { $this->markTestSkipped("SQLite extension not loaded"); } @@ -108,7 +108,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { self::setConf(); } - public function tearDown() { + public function tearDown(): void { self::clearData(); } diff --git a/tests/cases/Db/SQLite3/TestDriver.php b/tests/cases/Db/SQLite3/TestDriver.php index 03ddf5ae..4c80cbad 100644 --- a/tests/cases/Db/SQLite3/TestDriver.php +++ b/tests/cases/Db/SQLite3/TestDriver.php @@ -17,7 +17,7 @@ class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver { protected $setVersion = "PRAGMA user_version=#"; protected static $file; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { // create a temporary database file rather than using a memory database // some tests require one connection to block another, so a memory database is not suitable static::$file = tempnam(sys_get_temp_dir(), 'ook'); @@ -25,7 +25,7 @@ class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver { parent::setUpBeforeclass(); } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { static::$interface->close(); static::$interface = null; parent::tearDownAfterClass(); diff --git a/tests/cases/Db/SQLite3/TestResult.php b/tests/cases/Db/SQLite3/TestResult.php index 6f0f57f5..d7f8c091 100644 --- a/tests/cases/Db/SQLite3/TestResult.php +++ b/tests/cases/Db/SQLite3/TestResult.php @@ -15,7 +15,7 @@ class TestResult extends \JKingWeb\Arsse\TestCase\Db\BaseResult { protected static $createMeta = "CREATE TABLE arsse_meta(key text primary key not null, value text) without rowid"; protected static $createTest = "CREATE TABLE arsse_test(id integer primary key)"; - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { static::$interface->close(); static::$interface = null; parent::tearDownAfterClass(); diff --git a/tests/cases/Db/SQLite3/TestStatement.php b/tests/cases/Db/SQLite3/TestStatement.php index f86ac7f4..1af5be4c 100644 --- a/tests/cases/Db/SQLite3/TestStatement.php +++ b/tests/cases/Db/SQLite3/TestStatement.php @@ -12,7 +12,7 @@ namespace JKingWeb\Arsse\TestCase\Db\SQLite3; class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement { use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3; - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { static::$interface->close(); static::$interface = null; parent::tearDownAfterClass(); diff --git a/tests/cases/Db/SQLite3/TestUpdate.php b/tests/cases/Db/SQLite3/TestUpdate.php index 26e99093..94842e25 100644 --- a/tests/cases/Db/SQLite3/TestUpdate.php +++ b/tests/cases/Db/SQLite3/TestUpdate.php @@ -15,7 +15,7 @@ class TestUpdate extends \JKingWeb\Arsse\TestCase\Db\BaseUpdate { protected static $minimal1 = "create table arsse_meta(key text primary key not null, value text); pragma user_version=1"; protected static $minimal2 = "pragma user_version=2"; - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { static::$interface->close(); static::$interface = null; parent::tearDownAfterClass(); diff --git a/tests/cases/Db/SQLite3PDO/TestCreation.php b/tests/cases/Db/SQLite3PDO/TestCreation.php index 03c63a61..d700d194 100644 --- a/tests/cases/Db/SQLite3PDO/TestCreation.php +++ b/tests/cases/Db/SQLite3PDO/TestCreation.php @@ -20,7 +20,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { protected $drv; protected $ch; - public function setUp() { + public function setUp(): void { if (!Driver::requirementsMet()) { $this->markTestSkipped("PDO-SQLite extension not loaded"); } @@ -110,7 +110,7 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { self::setConf(); } - public function tearDown() { + public function tearDown(): void { self::clearData(); } diff --git a/tests/cases/Db/SQLite3PDO/TestDriver.php b/tests/cases/Db/SQLite3PDO/TestDriver.php index 4c6f7155..3d6087ca 100644 --- a/tests/cases/Db/SQLite3PDO/TestDriver.php +++ b/tests/cases/Db/SQLite3PDO/TestDriver.php @@ -19,7 +19,7 @@ class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver { protected $setVersion = "PRAGMA user_version=#"; protected static $file; - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { // create a temporary database file rather than using a memory database // some tests require one connection to block another, so a memory database is not suitable static::$file = tempnam(sys_get_temp_dir(), 'ook'); @@ -27,7 +27,7 @@ class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver { parent::setUpBeforeclass(); } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { parent::tearDownAfterClass(); @unlink(self::$file); self::$file = null; diff --git a/tests/cases/Db/TestTransaction.php b/tests/cases/Db/TestTransaction.php index b26d810c..b189addc 100644 --- a/tests/cases/Db/TestTransaction.php +++ b/tests/cases/Db/TestTransaction.php @@ -14,7 +14,7 @@ use JKingWeb\Arsse\Db\Exception; class TestTransaction extends \JKingWeb\Arsse\Test\AbstractTest { protected $drv; - public function setUp() { + public function setUp(): void { self::clearData(); $drv = \Phake::mock(\JKingWeb\Arsse\Db\SQLite3\Driver::class); \Phake::when($drv)->savepointRelease->thenReturn(true); diff --git a/tests/cases/Exception/TestException.php b/tests/cases/Exception/TestException.php index e7cdd520..739f0522 100644 --- a/tests/cases/Exception/TestException.php +++ b/tests/cases/Exception/TestException.php @@ -13,14 +13,14 @@ use JKingWeb\Arsse\Lang\Exception as LangException; /** @covers \JKingWeb\Arsse\AbstractException */ class TestException extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { self::clearData(false); // create a mock Lang object so as not to create a dependency loop Arsse::$lang = \Phake::mock(Lang::class); \Phake::when(Arsse::$lang)->msg->thenReturn(""); } - public function tearDown() { + public function tearDown(): void { // verify calls to the mock Lang object \Phake::verify(Arsse::$lang, \Phake::atLeast(0))->msg($this->isType("string"), $this->anything()); \Phake::verifyNoOtherInteractions(Arsse::$lang); diff --git a/tests/cases/Feed/TestFeed.php b/tests/cases/Feed/TestFeed.php index efffb3fa..04d2194b 100644 --- a/tests/cases/Feed/TestFeed.php +++ b/tests/cases/Feed/TestFeed.php @@ -88,7 +88,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { ], ]; - public function setUp() { + public function setUp(): void { if (!@file_get_contents(self::$host."IsUp")) { $this->markTestSkipped("Test Web server is not accepting requests"); } @@ -264,7 +264,7 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertTime($exp, $f->nextFetch); } - public function provide304Timestamps() { + public 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/Feed/TestFetching.php b/tests/cases/Feed/TestFetching.php index b285ac5f..f2f7ce6a 100644 --- a/tests/cases/Feed/TestFetching.php +++ b/tests/cases/Feed/TestFetching.php @@ -16,7 +16,7 @@ class TestFetching extends \JKingWeb\Arsse\Test\AbstractTest { protected static $host = "http://localhost:8000/"; protected $base = ""; - public function setUp() { + public function setUp(): void { if (!extension_loaded('curl')) { $this->markTestSkipped("Feed fetching tests are only accurate with curl enabled."); } elseif (!@file_get_contents(self::$host."IsUp")) { diff --git a/tests/cases/ImportExport/TestFile.php b/tests/cases/ImportExport/TestFile.php index 5a85bb69..cd520d21 100644 --- a/tests/cases/ImportExport/TestFile.php +++ b/tests/cases/ImportExport/TestFile.php @@ -16,7 +16,7 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest { protected $path; protected $proc; - public function setUp() { + public function setUp(): void { self::clearData(); // create a mock Import/Export processor with stubbed underlying import/export routines $this->proc = \Phake::partialMock(AbstractImportExport::class); @@ -37,7 +37,7 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest { chmod($this->path."importBadFile", 0000); } - public function tearDown() { + public function tearDown(): void { $this->path = null; $this->vfs = null; $this->proc = null; @@ -60,7 +60,7 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideFileExports() { + public function provideFileExports(): iterable { $createException = new Exception("fileUncreatable"); $writeException = new Exception("fileUnwritable"); return [ @@ -98,7 +98,7 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideFileImports() { + public function provideFileImports(): iterable { $missingException = new Exception("fileMissing"); $permissionException = new Exception("fileUnreadable"); return [ diff --git a/tests/cases/ImportExport/TestImportExport.php b/tests/cases/ImportExport/TestImportExport.php index c8af2c19..acd7f13a 100644 --- a/tests/cases/ImportExport/TestImportExport.php +++ b/tests/cases/ImportExport/TestImportExport.php @@ -23,7 +23,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { 'arsse_tag_members' => ["tag", "subscription", "assigned"], ]; - public function setUp() { + public function setUp(): void { self::clearData(); // create a mock user manager Arsse::$user = \Phake::mock(\JKingWeb\Arsse\User::class); @@ -140,7 +140,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { $this->primeDatabase($this->drv, $this->data); } - public function tearDown() { + public function tearDown(): void { $this->drv = null; $this->proc = null; self::clearData(); diff --git a/tests/cases/ImportExport/TestOPML.php b/tests/cases/ImportExport/TestOPML.php index 503211ca..61f6b364 100644 --- a/tests/cases/ImportExport/TestOPML.php +++ b/tests/cases/ImportExport/TestOPML.php @@ -79,7 +79,7 @@ OPML_EXPORT_SERIALIZATION; OPML_EXPORT_SERIALIZATION; - public function setUp() { + public function setUp(): void { self::clearData(); Arsse::$db = \Phake::mock(\JKingWeb\Arsse\Database::class); Arsse::$user = \Phake::mock(\JKingWeb\Arsse\User::class); @@ -119,7 +119,7 @@ OPML_EXPORT_SERIALIZATION; } } - public function provideParserData() { + public function provideParserData(): iterable { return [ ["BrokenXML.opml", false, new Exception("invalidSyntax")], ["BrokenOPML.1.opml", false, new Exception("invalidSemantics")], diff --git a/tests/cases/Misc/TestDate.php b/tests/cases/Misc/TestDate.php index 7fdae602..f2eb2be3 100644 --- a/tests/cases/Misc/TestDate.php +++ b/tests/cases/Misc/TestDate.php @@ -10,7 +10,7 @@ use JKingWeb\Arsse\Misc\Date; /** @covers \JKingWeb\Arsse\Misc\Date */ class TestDate extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { self::clearData(); } diff --git a/tests/cases/Misc/TestURL.php b/tests/cases/Misc/TestURL.php index 8260c0b0..40e5c06f 100644 --- a/tests/cases/Misc/TestURL.php +++ b/tests/cases/Misc/TestURL.php @@ -10,7 +10,7 @@ use JKingWeb\Arsse\Misc\URL; /** @covers \JKingWeb\Arsse\Misc\URL */ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { self::clearData(); } @@ -19,7 +19,7 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, URL::normalize($url, $user, $pass)); } - public function provideNormalizations() { + public function provideNormalizations(): iterable { return [ ["http://example.com/", "http://example.com/"], ["HTTP://example.com/", "http://example.com/"], @@ -81,7 +81,7 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, URL::queryAppend($url, $query)); } - public function provideQueries() { + public function provideQueries(): iterable { return [ ["/", "ook=eek", "/?ook=eek"], ["/?", "ook=eek", "/?ook=eek"], diff --git a/tests/cases/Misc/TestValueInfo.php b/tests/cases/Misc/TestValueInfo.php index 9bf12bad..c2ed6053 100644 --- a/tests/cases/Misc/TestValueInfo.php +++ b/tests/cases/Misc/TestValueInfo.php @@ -12,7 +12,7 @@ use JKingWeb\Arsse\Test\Result; /** @covers \JKingWeb\Arsse\Misc\ValueInfo */ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { self::clearData(); } @@ -424,7 +424,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideSimpleNormalizationValues() { + public function provideSimpleNormalizationValues(): iterable { $types = [ "Mixed", "Null", @@ -556,7 +556,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideDateNormalizationValues() { + public function provideDateNormalizationValues(): iterable { $formats = [ "microtime", "iso8601", diff --git a/tests/cases/REST/Fever/TestAPI.php b/tests/cases/REST/Fever/TestAPI.php index 183e0037..ad54243c 100644 --- a/tests/cases/REST/Fever/TestAPI.php +++ b/tests/cases/REST/Fever/TestAPI.php @@ -152,7 +152,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { return $this->serverRequest($method, $url, $prefix, [], [], $dataPost, $type, $dataGet, $user); } - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(); // create a mock user manager @@ -168,7 +168,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::when($this->h)->baseResponse->thenReturn([]); } - public function tearDown() { + public function tearDown(): void { self::clearData(); } @@ -192,7 +192,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function provideTokenAuthenticationRequests() { + public function provideTokenAuthenticationRequests(): iterable { $success = new JsonResponse(['auth' => 1]); $failure = new JsonResponse(['auth' => 0]); $denied = new EmptyResponse(401); @@ -313,7 +313,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->articleList(Arsse::$user->id, $c, $fields, $order); } - public function provideItemListContexts() { + public function provideItemListContexts(): iterable { $c = (new Context)->limit(50); return [ ["items", (clone $c), false], @@ -388,7 +388,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideMarkingContexts() { + public function provideMarkingContexts(): iterable { $markRead = ['read' => true]; $markUnread = ['read' => false]; $markSaved = ['starred' => true]; @@ -431,7 +431,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $this->h->dispatch($req)); } - public function provideInvalidRequests() { + public function provideInvalidRequests(): iterable { return [ 'Not an API request' => [$this->req(""), new EmptyResponse(404)], 'Wrong method' => [$this->req("api", "", "GET"), new EmptyResponse(405, ['Allow' => "OPTIONS,POST"])], diff --git a/tests/cases/REST/Fever/TestUser.php b/tests/cases/REST/Fever/TestUser.php index c1856472..481057a2 100644 --- a/tests/cases/REST/Fever/TestUser.php +++ b/tests/cases/REST/Fever/TestUser.php @@ -18,7 +18,7 @@ use JKingWeb\Arsse\REST\Fever\User as FeverUser; class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { protected $u; - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(); // create a mock user manager @@ -31,7 +31,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { $this->u = new FeverUser(); } - public function tearDown() { + public function tearDown(): void { self::clearData(); } @@ -55,7 +55,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePasswordCreations() { + public function providePasswordCreations(): iterable { return [ ["jane.doe@example.com", "secret", "secret"], ["jane.doe@example.com", "superman", "superman"], @@ -83,7 +83,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $this->u->authenticate($user, $password)); } - public function provideUserAuthenticationRequests() { + public function provideUserAuthenticationRequests(): iterable { return [ ["jane.doe@example.com", "secret", true], ["jane.doe@example.com", "superman", false], diff --git a/tests/cases/REST/NextCloudNews/TestV1_2.php b/tests/cases/REST/NextCloudNews/TestV1_2.php index 5ae10feb..99940a86 100644 --- a/tests/cases/REST/NextCloudNews/TestV1_2.php +++ b/tests/cases/REST/NextCloudNews/TestV1_2.php @@ -305,7 +305,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { return $this->h->dispatch($req); } - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(); // create a mock user manager @@ -317,7 +317,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest { $this->h = new V1_2(); } - public function tearDown() { + public function tearDown(): void { self::clearData(); } diff --git a/tests/cases/REST/NextCloudNews/TestVersions.php b/tests/cases/REST/NextCloudNews/TestVersions.php index dff02afa..1587e97a 100644 --- a/tests/cases/REST/NextCloudNews/TestVersions.php +++ b/tests/cases/REST/NextCloudNews/TestVersions.php @@ -14,7 +14,7 @@ use Zend\Diactoros\Response\EmptyResponse; /** @covers \JKingWeb\Arsse\REST\NextCloudNews\Versions */ class TestVersions extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { self::clearData(); } diff --git a/tests/cases/REST/TestREST.php b/tests/cases/REST/TestREST.php index fb0dc2f7..dd810cd7 100644 --- a/tests/cases/REST/TestREST.php +++ b/tests/cases/REST/TestREST.php @@ -35,7 +35,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertEquals($exp, $out); } - public function provideApiMatchData() { + public function provideApiMatchData(): iterable { $real = null; $fake = [ 'unstripped' => ['match' => "/full/url", 'strip' => "", 'class' => "UnstrippedProtocol"], @@ -80,7 +80,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function provideAuthenticableRequests() { + public 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"]], @@ -112,7 +112,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $act); } - public function provideUnnormalizedOrigins() { + public function provideUnnormalizedOrigins(): iterable { return [ ["null", "null"], ["http://example.com", "http://example.com"], @@ -161,7 +161,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $act); } - public function provideCorsNegotiations() { + public function provideCorsNegotiations(): iterable { return [ ["http://example", true ], ["http://example", true, "http://example", "*" ], @@ -196,7 +196,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function provideCorsHeaders() { + public function provideCorsHeaders(): iterable { return [ ["GET", ['Origin' => "null"], [], [ 'Access-Control-Allow-Origin' => "null", @@ -264,7 +264,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertMessage($exp, $act); } - public function provideUnnormalizedResponses() { + public function provideUnnormalizedResponses(): iterable { $stream = fopen("php://memory", "w+b"); fwrite($stream, "ook"); return [ @@ -322,7 +322,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify($r)->normalizeResponse; } - public function provideMockRequests() { + public function provideMockRequests(): iterable { return [ [new ServerRequest([], [], "/index.php/apps/news/api/v1-2/feeds", "GET"), "GET", true, NCN::class, "/feeds"], [new ServerRequest([], [], "/index.php/apps/news/api/v1-2/feeds", "HEAD"), "GET", true, NCN::class, "/feeds"], diff --git a/tests/cases/REST/TinyTinyRSS/TestAPI.php b/tests/cases/REST/TinyTinyRSS/TestAPI.php index 7c8d230b..d3a275ac 100644 --- a/tests/cases/REST/TinyTinyRSS/TestAPI.php +++ b/tests/cases/REST/TinyTinyRSS/TestAPI.php @@ -154,7 +154,7 @@ LONG_STRING; ]); } - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(); // create a mock user manager @@ -174,7 +174,7 @@ LONG_STRING; $this->h = new API(); } - public function tearDown() { + public function tearDown(): void { self::clearData(); } @@ -231,7 +231,7 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::times(0))->sessionResume($this->anything()); } - public function provideLoginRequests() { + public function provideLoginRequests(): iterable { return $this->generateLoginRequests("login"); } @@ -269,7 +269,7 @@ LONG_STRING; $this->assertSame($exp2, Arsse::$user->id); } - public function provideResumeRequests() { + public function provideResumeRequests(): iterable { return $this->generateLoginRequests("isLoggedIn"); } diff --git a/tests/cases/REST/TinyTinyRSS/TestIcon.php b/tests/cases/REST/TinyTinyRSS/TestIcon.php index dc986787..d7f50626 100644 --- a/tests/cases/REST/TinyTinyRSS/TestIcon.php +++ b/tests/cases/REST/TinyTinyRSS/TestIcon.php @@ -19,7 +19,7 @@ class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest { protected $h; protected $user = "john.doe@example.com"; - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(); // create a mock user manager @@ -29,7 +29,7 @@ class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest { $this->h = new Icon(); } - public function tearDown() { + public function tearDown(): void { self::clearData(); } diff --git a/tests/cases/REST/TinyTinyRSS/TestSearch.php b/tests/cases/REST/TinyTinyRSS/TestSearch.php index c858d1be..82720bf9 100644 --- a/tests/cases/REST/TinyTinyRSS/TestSearch.php +++ b/tests/cases/REST/TinyTinyRSS/TestSearch.php @@ -11,7 +11,7 @@ use JKingWeb\Arsse\REST\TinyTinyRSS\Search; /** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Search */ class TestSearch extends \JKingWeb\Arsse\Test\AbstractTest { - public function provideSearchStrings() { + public function provideSearchStrings(): iterable { return [ 'Blank string' => ["", new Context], 'Whitespace only' => [" \n \t", new Context], diff --git a/tests/cases/Service/TestService.php b/tests/cases/Service/TestService.php index 3f6ea6b3..df14efe1 100644 --- a/tests/cases/Service/TestService.php +++ b/tests/cases/Service/TestService.php @@ -15,7 +15,7 @@ use JKingWeb\Arsse\Misc\Date; class TestService extends \JKingWeb\Arsse\Test\AbstractTest { protected $srv; - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(); Arsse::$db = \Phake::mock(Database::class); diff --git a/tests/cases/User/TestInternal.php b/tests/cases/User/TestInternal.php index b3b57a14..b72cf9a3 100644 --- a/tests/cases/User/TestInternal.php +++ b/tests/cases/User/TestInternal.php @@ -13,7 +13,7 @@ use JKingWeb\Arsse\User\Internal\Driver; /** @covers \JKingWeb\Arsse\User\Internal\Driver */ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(); // create a mock database interface @@ -46,7 +46,7 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, (new Driver)->auth($user, $password)); } - public function provideAuthentication() { + public 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 1398b177..971ac6ad 100644 --- a/tests/cases/User/TestUser.php +++ b/tests/cases/User/TestUser.php @@ -14,7 +14,7 @@ use JKingWeb\Arsse\User\Driver; /** @covers \JKingWeb\Arsse\User */ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { - public function setUp() { + public function setUp(): void { self::clearData(); self::setConf(); // create a mock database interface @@ -60,7 +60,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() { + public function provideAuthentication(): iterable { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; return [ @@ -86,7 +86,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $u->list()); } - public function provideUserList() { + public function provideUserList(): iterable { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; return [ @@ -107,7 +107,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $u->exists($user)); } - public function provideExistence() { + public function provideExistence(): iterable { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; return [ @@ -166,7 +166,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideAdditions() { + public function provideAdditions(): iterable { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; return [ @@ -201,7 +201,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideRemovals() { + public function provideRemovals(): iterable { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; return [ @@ -281,7 +281,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePasswordChanges() { + public function providePasswordChanges(): iterable { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; return [ @@ -314,7 +314,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePasswordClearings() { + public function providePasswordClearings(): iterable { $forbidden = new \JKingWeb\Arsse\User\ExceptionAuthz("notAuthorized"); $missing = new \JKingWeb\Arsse\User\Exception("doesNotExist"); return [ diff --git a/tests/lib/AbstractTest.php b/tests/lib/AbstractTest.php index a2e66a31..2dd1a0fb 100644 --- a/tests/lib/AbstractTest.php +++ b/tests/lib/AbstractTest.php @@ -24,11 +24,13 @@ use Zend\Diactoros\Response\XmlResponse; /** @coversNothing */ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { - public function setUp() { + use \DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts; + + public function setUp(): void { self::clearData(); } - public function tearDown() { + public function tearDown(): void { self::clearData(); } diff --git a/tests/lib/Lang/Setup.php b/tests/lib/Lang/Setup.php index 381806f5..16442d8f 100644 --- a/tests/lib/Lang/Setup.php +++ b/tests/lib/Lang/Setup.php @@ -11,7 +11,7 @@ use JKingWeb\Arsse\Arsse; use org\bovigo\vfs\vfsStream; trait Setup { - public function setUp() { + public function setUp(): void { // test files $this->files = [ 'en.php' => ' "and the Philosopher\'s Stone"];', @@ -47,7 +47,7 @@ trait Setup { } } - public function tearDown() { + public function tearDown(): void { // verify calls to the mock Lang object \Phake::verify(Arsse::$lang, \Phake::atLeast(0))->msg($this->isType("string"), $this->anything()); \Phake::verifyNoOtherInteractions(Arsse::$lang); diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json index 7faefcbf..6a40dd4a 100644 --- a/vendor-bin/phpunit/composer.json +++ b/vendor-bin/phpunit/composer.json @@ -1,6 +1,7 @@ { "require": { - "phpunit/phpunit": "6.* | 7.*", + "phpunit/phpunit": "8.*", + "dms/phpunit-arraysubset-asserts": "^0.1", "phake/phake": "^3.0", "clue/arguments": "^2.0", "mikey179/vfsstream": "^1.6", diff --git a/vendor-bin/phpunit/composer.lock b/vendor-bin/phpunit/composer.lock index 558318c8..9f736396 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": "0efc271cb10b6582cac5f373a48fc969", + "content-hash": "95cd95b15b030103607205ea2f05ea81", "packages": [ { "name": "clue/arguments", @@ -56,6 +56,47 @@ ], "time": "2016-12-18T14:37:39+00:00" }, + { + "name": "dms/phpunit-arraysubset-asserts", + "version": "v0.1.0", + "source": { + "type": "git", + "url": "https://github.com/rdohms/phpunit-arraysubset-asserts.git", + "reference": "d618ece5d53e05be87eba835b079377eaafbd7c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rdohms/phpunit-arraysubset-asserts/zipball/d618ece5d53e05be87eba835b079377eaafbd7c8", + "reference": "d618ece5d53e05be87eba835b079377eaafbd7c8", + "shasum": "" + }, + "require": { + "php": "^7.2", + "phpunit/phpunit": "^8.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 Array Subset and related asserts once depracated in PHPunit 8", + "time": "2019-02-17T14:29:58+00:00" + }, { "name": "doctrine/instantiator", "version": "1.2.0", @@ -581,40 +622,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "7.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa0d179a13284c7420fc281fc32750e6cc7c9e2f", + "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", + "php": "^7.2", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", + "phpunit/php-token-stream": "^3.1.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", + "sebastian/environment": "^4.2.2", "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -640,7 +681,7 @@ "testing", "xunit" ], - "time": "2018-10-31T16:06:48+00:00" + "time": "2019-09-17T06:24:36+00:00" }, { "name": "phpunit/php-file-iterator", @@ -833,53 +874,52 @@ }, { "name": "phpunit/phpunit", - "version": "7.5.16", + "version": "8.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "316afa6888d2562e04aeb67ea7f2017a0eb41661" + "reference": "366a4a0f2b971fd43b7c351d621e8dd7d7131869" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/316afa6888d2562e04aeb67ea7f2017a0eb41661", - "reference": "316afa6888d2562e04aeb67ea7f2017a0eb41661", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/366a4a0f2b971fd43b7c351d621e8dd7d7131869", + "reference": "366a4a0f2b971fd43b7c351d621e8dd7d7131869", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", + "doctrine/instantiator": "^1.2.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.9.1", + "phar-io/manifest": "^1.0.3", + "phar-io/version": "^2.0.1", + "php": "^7.2", + "phpspec/prophecy": "^1.8.1", + "phpunit/php-code-coverage": "^7.0.7", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.2", + "sebastian/exporter": "^3.1.1", + "sebastian/global-state": "^3.0.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", "sebastian/version": "^2.0.1" }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -887,7 +927,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "8.4-dev" } }, "autoload": { @@ -913,7 +953,7 @@ "testing", "xunit" ], - "time": "2019-09-14T09:08:39+00:00" + "time": "2019-10-07T12:57:41+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1202,23 +1242,26 @@ }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -1226,7 +1269,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1249,7 +1292,7 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "time": "2019-02-01T05:30:01+00:00" }, { "name": "sebastian/object-enumerator", @@ -1438,6 +1481,52 @@ "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "time": "2018-10-04T04:07:39+00:00" }, + { + "name": "sebastian/type", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", + "shasum": "" + }, + "require": { + "php": "^7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "time": "2019-07-02T08:10:15+00:00" + }, { "name": "sebastian/version", "version": "2.0.1",