aboutsummaryrefslogtreecommitdiff
path: root/tests/lib/Minz/MigratorTest.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-09-06 09:06:46 +0200
committerGravatar GitHub <noreply@github.com> 2024-09-06 09:06:46 +0200
commita81656c3ed5b8fe0f31794a4fbe0d1a907fca8e8 (patch)
tree8bf49bd876aaebc985a9fb1214863190a799cbee /tests/lib/Minz/MigratorTest.php
parent8f7c3473a76809efc88814253722c76f0cc8eb04 (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/Minz/MigratorTest.php')
-rw-r--r--tests/lib/Minz/MigratorTest.php42
1 files changed, 21 insertions, 21 deletions
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.';