From e144f5805659863bc055ee60db9b77d689b3781d Mon Sep 17 00:00:00 2001 From: Tomasz Kryszan Date: Thu, 2 Nov 2023 11:51:51 +0100 Subject: [PATCH] Added max file size unit to storage dataText1 column --- .../Legacy/Content/FieldValue/Converter/ImageConverter.php | 1 + .../Persistence/FieldValue/Converter/ImageConverterTest.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php index 2da5a66c2b..9e537aab67 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php @@ -187,6 +187,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField ? $validators['FileSizeValidator']['maxFileSize'] * 1024 : 0; $storageDef->dataInt2 = (int)($validators['AlternativeTextValidator']['required'] ?? 0); + $storageDef->dataText1 = 'KB'; } public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void diff --git a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php index ad59d8fec9..8247534445 100644 --- a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php +++ b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php @@ -66,6 +66,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable new StorageFieldDefinition([ 'dataInt1' => 0, 'dataInt2' => 0, + 'dataText1' => 'KB', ]), ]; @@ -82,6 +83,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable new StorageFieldDefinition([ 'dataInt1' => 1048576, 'dataInt2' => 0, + 'dataText1' => 'KB', ]), ]; @@ -98,6 +100,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable new StorageFieldDefinition([ 'dataInt1' => 0, 'dataInt2' => 1, + 'dataText1' => 'KB', ]), ]; @@ -114,6 +117,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable new StorageFieldDefinition([ 'dataInt1' => 0, 'dataInt2' => 0, + 'dataText1' => 'KB', ]), ]; }