mirror of
https://github.com/wallabag/wallabag.git
synced 2025-06-27 16:36:00 +00:00
Modernize to PHP 8.1
This commit is contained in:
parent
ca018c77e3
commit
9e2720cddc
26 changed files with 48 additions and 52 deletions
|
@ -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);
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1074,7 +1074,7 @@ class ContentProxyTest extends TestCase
|
|||
private function strToHex($string)
|
||||
{
|
||||
$hex = '';
|
||||
for ($i = 0; $i < \strlen($string); ++$i) {
|
||||
for ($i = 0; $i < \strlen((string) $string); ++$i) {
|
||||
$ord = \ord($string[$i]);
|
||||
$hexCode = dechex($ord);
|
||||
$hex .= substr('0' . $hexCode, -2);
|
||||
|
@ -1093,7 +1093,7 @@ class ContentProxyTest extends TestCase
|
|||
private function hexToStr($hex)
|
||||
{
|
||||
$string = '';
|
||||
for ($i = 0; $i < \strlen($hex) - 1; $i += 2) {
|
||||
for ($i = 0; $i < \strlen((string) $hex) - 1; $i += 2) {
|
||||
$string .= \chr(hexdec($hex[$i] . $hex[$i + 1]));
|
||||
}
|
||||
|
||||
|
|
|
@ -11,19 +11,19 @@
|
|||
function isPartialRun(): bool
|
||||
{
|
||||
foreach ($_SERVER['argv'] as $arg) {
|
||||
if (str_starts_with($arg, '--filter')) {
|
||||
if (str_starts_with((string) $arg, '--filter')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_starts_with($arg, '--testsuite')) {
|
||||
if (str_starts_with((string) $arg, '--testsuite')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_starts_with($arg, '--group')) {
|
||||
if (str_starts_with((string) $arg, '--group')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (str_starts_with($arg, '--exclude-group')) {
|
||||
if (str_starts_with((string) $arg, '--exclude-group')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue