Modernize to PHP 8.1

This commit is contained in:
Yassine Guedidi
2025-04-05 14:01:48 +02:00
parent ca018c77e3
commit 9e2720cddc
26 changed files with 48 additions and 52 deletions

View File

@ -50,7 +50,7 @@ class DeveloperControllerTest extends WallabagTestCase
$this->assertSame(200, $client->getResponse()->getStatusCode());
$data = json_decode($client->getResponse()->getContent(), true);
$data = json_decode((string) $client->getResponse()->getContent(), true);
$this->assertArrayHasKey('access_token', $data);
$this->assertArrayHasKey('expires_in', $data);
$this->assertArrayHasKey('token_type', $data);

View File

@ -351,7 +351,7 @@ class ConfigControllerTest extends WallabagTestCase
);
$this->assertSame(200, $client->getResponse()->getStatusCode());
$content = json_decode($client->getResponse()->getContent(), true);
$content = json_decode((string) $client->getResponse()->getContent(), true);
$this->assertArrayHasKey('token', $content);
}
@ -1296,7 +1296,7 @@ class ConfigControllerTest extends WallabagTestCase
$this->assertSame('attachment; filename="tagging_rules_admin.json"', $headers->get('content-disposition'));
$this->assertSame('UTF-8', $headers->get('content-transfer-encoding'));
$content = json_decode($client->getResponse()->getContent(), true);
$content = json_decode((string) $client->getResponse()->getContent(), true);
$this->assertCount(4, $content);
$this->assertSame('content matches "spurs"', $content[0]['rule']);

View File

@ -1283,7 +1283,7 @@ class EntryControllerTest extends WallabagTestCase
$this->assertSame($url, $entry->getUrl());
$this->assertStringContainsString('Comment Hidalgo', $entry->getTitle());
// instead of checking for the filename (which might change) check that the image is now local
$this->assertStringContainsString(rtrim($client->getContainer()->getParameter('domain_name'), '/') . '/assets/images/', $entry->getContent());
$this->assertStringContainsString(rtrim((string) $client->getContainer()->getParameter('domain_name'), '/') . '/assets/images/', $entry->getContent());
$client->getContainer()->get(Config::class)->set('download_images_enabled', 0);
}

View File

@ -177,7 +177,7 @@ class ExportControllerTest extends WallabagTestCase
$this->assertSame('attachment; filename="Archive articles.csv"', $headers->get('content-disposition'));
$this->assertSame('UTF-8', $headers->get('content-transfer-encoding'));
$csv = str_getcsv($client->getResponse()->getContent(), "\n");
$csv = str_getcsv((string) $client->getResponse()->getContent(), "\n");
$this->assertGreaterThan(1, $csv);
// +1 for title line
@ -216,7 +216,7 @@ class ExportControllerTest extends WallabagTestCase
$this->assertSame('attachment; filename="' . $this->getSanitizedFilename($contentInDB->getTitle()) . '.json"', $headers->get('content-disposition'));
$this->assertSame('UTF-8', $headers->get('content-transfer-encoding'));
$content = json_decode($client->getResponse()->getContent(), true);
$content = json_decode((string) $client->getResponse()->getContent(), true);
$this->assertArrayHasKey('id', $content[0]);
$this->assertArrayHasKey('title', $content[0]);
$this->assertArrayHasKey('url', $content[0]);
@ -262,7 +262,7 @@ class ExportControllerTest extends WallabagTestCase
$this->assertSame('attachment; filename="Search entry search articles.json"', $headers->get('content-disposition'));
$this->assertSame('UTF-8', $headers->get('content-transfer-encoding'));
$content = json_decode($client->getResponse()->getContent(), true);
$content = json_decode((string) $client->getResponse()->getContent(), true);
$this->assertCount(1, $content);
$this->tearDownForJsonExportFromSearch();
@ -339,7 +339,7 @@ class ExportControllerTest extends WallabagTestCase
$this->assertSame('attachment; filename="Same domain articles.json"', $headers->get('content-disposition'));
$this->assertSame('UTF-8', $headers->get('content-transfer-encoding'));
$content = json_decode($client->getResponse()->getContent(), true);
$content = json_decode((string) $client->getResponse()->getContent(), true);
$this->assertCount(4, $content);
}

View File

@ -36,7 +36,7 @@ class FeedControllerTest extends WallabagTestCase
$this->assertSame('admin', $xpath->query('/a:feed/a:author/a:name')->item(0)->nodeValue);
$this->assertSame(1, $xpath->query('/a:feed/a:subtitle')->length);
if (null !== $tagValue && str_starts_with($type, 'tag')) {
if (null !== $tagValue && str_starts_with((string) $type, 'tag')) {
$this->assertSame('wallabag — ' . $type . ' ' . $tagValue . ' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue);
$this->assertSame('Atom feed for entries tagged with ' . $tagValue, $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue);
} else {