chore(tests): check Snowflake ID preserved in 32 bits

Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
This commit is contained in:
Benjamin Gaussorgues 2026-04-03 17:00:01 +02:00
parent 92e4c882fc
commit 71aa36860f
No known key found for this signature in database

View file

@ -64,7 +64,7 @@ class PreviewMapperTest extends TestCase {
$this->assertEquals('default', $previews[43][0]->getObjectStoreName());
}
private function createPreviewForFileId(int $fileId, ?int $bucket = null): void {
private function createPreviewForFileId(int $fileId, ?int $bucket = null): string {
$locationId = null;
if ($bucket) {
$qb = $this->connection->getQueryBuilder();
@ -95,5 +95,16 @@ class PreviewMapperTest extends TestCase {
$preview->setLocationId($locationId);
}
$this->previewMapper->insert($preview);
return $preview->id;
}
public function testLargeIdInsertRetrieve(): void {
$fileId = PHP_INT_MAX;
$originalPreviewId = $this->createPreviewForFileId($fileId);
$dbPreview = $this->previewMapper->getAvailablePreviews([$fileId])[$fileId][0];
$this->assertEquals($originalPreviewId, $dbPreview->id);
$this->assertEquals($fileId, $dbPreview->getFileId());
}
}