aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> 2023-04-17 10:05:51 +0200
committerGravatar GitHub <noreply@github.com> 2023-04-17 10:05:51 +0200
commit5185bcef13862ee86298cd38b83da145d03055b5 (patch)
tree33445d5910ea55a4e1d79d073364f2616935dcac /tests
parentf3760f138dcbaf7a2190336a0378cf1b2190c9f5 (diff)
PHPstan level 7 for MigratorTest.php (#5307)
Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Minz/MigratorTest.php11
-rw-r--r--tests/phpstan-next.txt1
2 files changed, 7 insertions, 5 deletions
diff --git a/tests/lib/Minz/MigratorTest.php b/tests/lib/Minz/MigratorTest.php
index bd30ba87e..32498d64e 100644
--- a/tests/lib/Minz/MigratorTest.php
+++ b/tests/lib/Minz/MigratorTest.php
@@ -262,7 +262,7 @@ class MigratorTest extends TestCase
public function testExecute(): void {
$migrations_path = TESTS_PATH . '/fixtures/migrations/';
$applied_migrations_path = tempnam('/tmp', 'applied_migrations.txt');
-
+ $this->assertIsString($applied_migrations_path);
$result = Minz_Migrator::execute($migrations_path, $applied_migrations_path);
$this->assertTrue($result);
@@ -274,6 +274,7 @@ class MigratorTest extends TestCase
public function testExecuteWithAlreadyAppliedMigration(): void {
$migrations_path = TESTS_PATH . '/fixtures/migrations/';
$applied_migrations_path = tempnam('/tmp', 'applied_migrations.txt');
+ $this->assertIsString($applied_migrations_path);
file_put_contents($applied_migrations_path, '2019_12_22_FooBar');
$result = Minz_Migrator::execute($migrations_path, $applied_migrations_path);
@@ -287,6 +288,7 @@ class MigratorTest extends TestCase
public function testExecuteWithAppliedMigrationInDifferentOrder(): void {
$migrations_path = TESTS_PATH . '/fixtures/migrations/';
$applied_migrations_path = tempnam('/tmp', 'applied_migrations.txt');
+ $this->assertIsString($applied_migrations_path);
file_put_contents($applied_migrations_path, "2019_12_23_Baz\n2019_12_22_FooBar");
$result = Minz_Migrator::execute($migrations_path, $applied_migrations_path);
@@ -303,8 +305,8 @@ class MigratorTest extends TestCase
$migrations_path = TESTS_PATH . '/fixtures/migrations/';
$applied_migrations_path = tempnam('/tmp', 'applied_migrations.txt');
$expected_result = "Cannot open the {$applied_migrations_path} file";
+ $this->assertIsString($applied_migrations_path);
unlink($applied_migrations_path);
-
$result = Minz_Migrator::execute($migrations_path, $applied_migrations_path);
$this->assertSame($expected_result, $result);
@@ -315,9 +317,10 @@ class MigratorTest extends TestCase
$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.';
-
+ $this->assertIsString($applied_migrations_path);
$result = Minz_Migrator::execute($migrations_path, $applied_migrations_path);
- list($result, ) = explode("\n", $result, 2);
+ $this->assertIsString($result);
+ [$result,] = explode("\n", $result, 2);
$this->assertSame($expected_result, $result);
$versions = file_get_contents($applied_migrations_path);
diff --git a/tests/phpstan-next.txt b/tests/phpstan-next.txt
index e2e081ecf..9af4161db 100644
--- a/tests/phpstan-next.txt
+++ b/tests/phpstan-next.txt
@@ -45,4 +45,3 @@
./lib/Minz/Request.php
./p/api/greader.php
./tests/cli/i18n/I18nFileTest.php
-./tests/lib/Minz/MigratorTest.php