diff --git a/tests/app/Models/EntryTest.php b/tests/app/Models/EntryTest.php index 75af92e69..b3f7b5588 100644 --- a/tests/app/Models/EntryTest.php +++ b/tests/app/Models/EntryTest.php @@ -109,4 +109,12 @@ final class EntryTest extends \PHPUnit\Framework\TestCase { self::assertSame('A & B', $item['title']); self::assertSame('B & C', $item['author']); } + + /** Above PHP_INT_MAX, an integer literal is a float on 32-bit platforms, so an entry ID is only ever a string */ + public function test_idRejectsAFloat(): void { + $entry = new FreshRSS_Entry(1, 'guid-1', 'Title', '', '', 'https://example.net/1', 1700000000); + $this->expectException(\TypeError::class); + // @phpstan-ignore argument.type + $entry->_id(1700000000000001.0); + } } diff --git a/tests/app/Views/exportArticlesTest.php b/tests/app/Views/exportArticlesTest.php index 6ba90fe6d..913f0c0ef 100644 --- a/tests/app/Views/exportArticlesTest.php +++ b/tests/app/Views/exportArticlesTest.php @@ -28,7 +28,8 @@ final class exportArticlesTest extends \PHPUnit\Framework\TestCase { for ($i = 1; $i <= $count; $i++) { $entry = new FreshRSS_Entry(1, 'guid-' . $i, 'Title ' . $i, '', str_repeat('

Contenu exporté ' . $i . '

', 200), 'https://example.net/' . $i, 1700000000 + $i); - $entry->_id(1700000000000000 + $i); + // A string, because this value exceeds PHP_INT_MAX on 32-bit platforms and would be a float there + $entry->_id('17000000000000' . sprintf('%02d', $i)); // @phpstan-ignore argument.type (numeric-string) $entries[] = $entry; } return $entries;