diff options
| author | 2024-09-06 09:06:46 +0200 | |
|---|---|---|
| committer | 2024-09-06 09:06:46 +0200 | |
| commit | a81656c3ed5b8fe0f31794a4fbe0d1a907fca8e8 (patch) | |
| tree | 8bf49bd876aaebc985a9fb1214863190a799cbee /tests/lib | |
| parent | 8f7c3473a76809efc88814253722c76f0cc8eb04 (diff) | |
Upgrade to PHP 8.1 (#6711)
* Upgrade to PHP 8.1
As discussed in https://github.com/FreshRSS/FreshRSS/discussions/5474
https://www.php.net/releases/8.0/en.php
https://www.php.net/releases/8.1/en.php
Upgrade to available native type declarations
https://php.net/language.types.declarations
Upgrade to https://phpunit.de/announcements/phpunit-10.html which requires PHP 8.1+ (good timing, as version 9 was not maintained anymore)
Upgrade `:oldest` Docker dev image to oldest Alpine version supporting PHP 8.1: Alpine 3.16, which includes PHP 8.1.22.
* Include 6736
https://github.com/FreshRSS/FreshRSS/pull/6736
Diffstat (limited to 'tests/lib')
| -rw-r--r-- | tests/lib/CssXPath/CssXPathTest.php | 2 | ||||
| -rw-r--r-- | tests/lib/Minz/MigratorTest.php | 42 | ||||
| -rw-r--r-- | tests/lib/PHPMailer/PHPMailerTest.php | 2 |
3 files changed, 23 insertions, 23 deletions
diff --git a/tests/lib/CssXPath/CssXPathTest.php b/tests/lib/CssXPath/CssXPathTest.php index ed92ece16..8197f5b87 100644 --- a/tests/lib/CssXPath/CssXPathTest.php +++ b/tests/lib/CssXPath/CssXPathTest.php @@ -3,7 +3,7 @@ declare(strict_types=1); class CssXPathTest extends PHPUnit\Framework\TestCase { - public function testCssXPathTranslatorClassExists(): void { + public static function testCssXPathTranslatorClassExists(): void { self::assertTrue(class_exists('Gt\\CssXPath\\Translator')); } } diff --git a/tests/lib/Minz/MigratorTest.php b/tests/lib/Minz/MigratorTest.php index 6560715da..75c6eee23 100644 --- a/tests/lib/Minz/MigratorTest.php +++ b/tests/lib/Minz/MigratorTest.php @@ -4,7 +4,7 @@ use PHPUnit\Framework\TestCase; class MigratorTest extends TestCase { - public function testAddMigration(): void { + public static function testAddMigration(): void { $migrator = new Minz_Migrator(); $migrator->addMigration('foo', fn() => true); @@ -15,7 +15,7 @@ class MigratorTest extends TestCase self::assertTrue($result); } - public function testMigrationsIsSorted(): void { + public static function testMigrationsIsSorted(): void { $migrator = new Minz_Migrator(); $migrator->addMigration('2_foo', fn() => true); $migrator->addMigration('10_foo', fn() => true); @@ -27,7 +27,7 @@ class MigratorTest extends TestCase self::assertSame($expected_versions, array_keys($migrations)); } - public function testSetAppliedVersions(): void { + public static function testSetAppliedVersions(): void { $migrator = new Minz_Migrator(); $migrator->addMigration('foo', fn() => true); @@ -36,7 +36,7 @@ class MigratorTest extends TestCase self::assertSame(['foo'], $migrator->appliedVersions()); } - public function testSetAppliedVersionsTrimArgument(): void { + public static function testSetAppliedVersionsTrimArgument(): void { $migrator = new Minz_Migrator(); $migrator->addMigration('foo', fn() => true); @@ -54,7 +54,7 @@ class MigratorTest extends TestCase $migrator->setAppliedVersions(['foo']); } - public function testVersions(): void { + public static function testVersions(): void { $migrator = new Minz_Migrator(); $migrator->addMigration('foo', fn() => true); $migrator->addMigration('bar', fn() => true); @@ -64,7 +64,7 @@ class MigratorTest extends TestCase self::assertSame(['bar', 'foo'], $versions); } - public function testMigrate(): void { + public static function testMigrate(): void { $migrator = new Minz_Migrator(); $spy = false; $migrator->addMigration('foo', function () use (&$spy) { @@ -82,7 +82,7 @@ class MigratorTest extends TestCase ], $result); } - public function testMigrateCallsMigrationsInSortedOrder(): void { + public static function testMigrateCallsMigrationsInSortedOrder(): void { $migrator = new Minz_Migrator(); $spy_foo_1_is_called = false; $migrator->addMigration('2_foo', function () use (&$spy_foo_1_is_called) { @@ -102,7 +102,7 @@ class MigratorTest extends TestCase ], $result); } - public function testMigrateDoesNotCallAppliedMigrations(): void { + public static function testMigrateDoesNotCallAppliedMigrations(): void { $migrator = new Minz_Migrator(); $spy = false; $migrator->addMigration('1_foo', function () use (&$spy) { @@ -117,7 +117,7 @@ class MigratorTest extends TestCase self::assertSame([], $result); } - public function testMigrateCallNonAppliedBetweenTwoApplied(): void { + public static function testMigrateCallNonAppliedBetweenTwoApplied(): void { $migrator = new Minz_Migrator(); $migrator->addMigration('1_foo', fn() => true); $migrator->addMigration('2_foo', fn() => true); @@ -132,7 +132,7 @@ class MigratorTest extends TestCase ], $result); } - public function testMigrateWithMigrationReturningFalseDoesNotApplyVersion(): void { + public static function testMigrateWithMigrationReturningFalseDoesNotApplyVersion(): void { $migrator = new Minz_Migrator(); $migrator->addMigration('1_foo', fn() => true); $migrator->addMigration('2_foo', fn() => false); @@ -146,7 +146,7 @@ class MigratorTest extends TestCase ], $result); } - public function testMigrateWithMigrationReturningFalseDoesNotExecuteNextMigrations(): void { + public static function testMigrateWithMigrationReturningFalseDoesNotExecuteNextMigrations(): void { $migrator = new Minz_Migrator(); $migrator->addMigration('1_foo', fn() => false); $spy = false; @@ -164,7 +164,7 @@ class MigratorTest extends TestCase ], $result); } - public function testMigrateWithFailingMigration(): void { + public static function testMigrateWithFailingMigration(): void { $migrator = new Minz_Migrator(); $migrator->addMigration('foo', function () { throw new \Exception('Oops, it failed.'); @@ -178,7 +178,7 @@ class MigratorTest extends TestCase ], $result); } - public function testUpToDate(): void { + public static function testUpToDate(): void { $migrator = new Minz_Migrator(); $migrator->addMigration('foo', fn() => true); $migrator->setAppliedVersions(['foo']); @@ -188,7 +188,7 @@ class MigratorTest extends TestCase self::assertTrue($upToDate); } - public function testUpToDateIfRemainingMigration(): void { + public static function testUpToDateIfRemainingMigration(): void { $migrator = new Minz_Migrator(); $migrator->addMigration('1_foo', fn() => true); $migrator->addMigration('2_foo', fn() => true); @@ -199,7 +199,7 @@ class MigratorTest extends TestCase self::assertFalse($upToDate); } - public function testUpToDateIfNoMigrations(): void { + public static function testUpToDateIfNoMigrations(): void { $migrator = new Minz_Migrator(); $upToDate = $migrator->upToDate(); @@ -207,7 +207,7 @@ class MigratorTest extends TestCase self::assertTrue($upToDate); } - public function testConstructorLoadsDirectory(): void { + public static function testConstructorLoadsDirectory(): void { $migrations_path = TESTS_PATH . '/fixtures/migrations/'; $migrator = new Minz_Migrator($migrations_path); $expected_versions = ['2019_12_22_FooBar', '2019_12_23_Baz']; @@ -217,7 +217,7 @@ class MigratorTest extends TestCase self::assertSame($expected_versions, array_keys($migrations)); } - public function testExecute(): void { + public static function testExecute(): void { $migrations_path = TESTS_PATH . '/fixtures/migrations/'; $applied_migrations_path = tempnam('/tmp', 'applied_migrations.txt'); self::assertIsString($applied_migrations_path); @@ -229,7 +229,7 @@ class MigratorTest extends TestCase @unlink($applied_migrations_path); } - public function testExecuteWithAlreadyAppliedMigration(): void { + public static function testExecuteWithAlreadyAppliedMigration(): void { $migrations_path = TESTS_PATH . '/fixtures/migrations/'; $applied_migrations_path = tempnam('/tmp', 'applied_migrations.txt'); self::assertIsString($applied_migrations_path); @@ -243,7 +243,7 @@ class MigratorTest extends TestCase @unlink($applied_migrations_path); } - public function testExecuteWithAppliedMigrationInDifferentOrder(): void { + public static function testExecuteWithAppliedMigrationInDifferentOrder(): void { $migrations_path = TESTS_PATH . '/fixtures/migrations/'; $applied_migrations_path = tempnam('/tmp', 'applied_migrations.txt'); self::assertIsString($applied_migrations_path); @@ -258,7 +258,7 @@ class MigratorTest extends TestCase @unlink($applied_migrations_path); } - public function testExecuteFailsIfVersionPathDoesNotExist(): void { + public static function testExecuteFailsIfVersionPathDoesNotExist(): void { $migrations_path = TESTS_PATH . '/fixtures/migrations/'; $applied_migrations_path = tempnam('/tmp', 'applied_migrations.txt'); $expected_result = "Cannot open the {$applied_migrations_path} file"; @@ -270,7 +270,7 @@ class MigratorTest extends TestCase @unlink($applied_migrations_path); } - public function testExecuteFailsIfAMigrationIsFailing(): void { + public static function testExecuteFailsIfAMigrationIsFailing(): void { $migrations_path = TESTS_PATH . '/fixtures/migrations_with_failing/'; $applied_migrations_path = tempnam('/tmp', 'applied_migrations.txt'); $expected_result = 'A migration failed to be applied, please see previous logs.'; diff --git a/tests/lib/PHPMailer/PHPMailerTest.php b/tests/lib/PHPMailer/PHPMailerTest.php index bb08deaa8..8bc8378b6 100644 --- a/tests/lib/PHPMailer/PHPMailerTest.php +++ b/tests/lib/PHPMailer/PHPMailerTest.php @@ -5,7 +5,7 @@ use PHPMailer\PHPMailer\PHPMailer; class PHPMailerTest extends PHPUnit\Framework\TestCase { - public function testPHPMailerClassExists(): void { + public static function testPHPMailerClassExists(): void { self::assertTrue(class_exists(PHPMailer::class)); } } |
