diff --git a/data/mysql/cleandata.sql b/data/mysql/cleandata.sql index ee9d49f63b..09be34d2a1 100644 --- a/data/mysql/cleandata.sql +++ b/data/mysql/cleandata.sql @@ -47,7 +47,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (0,'',4,0,0,0,0,7,10,0,0,'','^[^@]+$','','','','ezuser',12,'user_account',0,1,0,0,3,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:12:\"User account\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',5,0,0,0,0,150,0,0,0,'','','','',NULL,'ezstring',116,'name',0,1,1,0,1,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:4:\"Name\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',5,0,0,0,0,10,0,0,0,'','','','',NULL,'ezrichtext',117,'caption',0,0,1,0,2,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:7:\"Caption\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), - (1,'',5,0,0,0,0,10,0,0,0,'','','','',NULL,'ezimage',118,'image',0,0,0,1,3,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), + (1,'',5,10.0,0,0,0,0,0,0,0,'MB','','','',NULL,'ezimage',118,'image',0,0,0,1,3,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',1,NULL,NULL,NULL,NULL,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',119,'short_description',0,0,1,0,3,'N;','a:0:{}','a:1:{s:6:\"eng-GB\";s:17:\"Short description\";}',0), (1,'',2,0,0,0,0,10,0,0,0,'','','','','','ezrichtext',120,'intro',0,1,1,0,4,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Intro\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',2,0,0,0,0,20,0,0,0,'','','','','','ezrichtext',121,'body',0,0,1,0,5,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:4:\"Body\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), @@ -61,7 +61,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (1,'',1,NULL,NULL,NULL,NULL,100,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezstring',155,'short_name',0,0,1,0,2,'N;','a:0:{}','a:1:{s:6:\"eng-GB\";s:10:\"Short name\";}',0), (1,'',1,NULL,NULL,NULL,NULL,20,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',156,'description',0,0,1,0,4,'N;','a:0:{}','a:1:{s:6:\"eng-GB\";s:11:\"Description\";}',0), (1,'',4,0,0,0,0,10,0,0,0,'','','','','','eztext',179,'signature',0,0,1,0,4,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:9:\"Signature\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), - (1,'',4,0,0,0,0,10,0,0,0,'','','','','','ezimage',180,'image',0,0,0,1,5,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0); + (1,'',4,10.0,0,0,0,0,0,0,0,'MB','','','','','ezimage',180,'image',0,0,0,1,5,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0); INSERT INTO `ezcontentclass_classgroup` (`contentclass_id`, `contentclass_version`, `group_id`, `group_name`) VALUES (1, 0, 1, 'Content'), diff --git a/data/postgresql/cleandata.sql b/data/postgresql/cleandata.sql index bb4df5f6d8..fadaa1e7ea 100644 --- a/data/postgresql/cleandata.sql +++ b/data/postgresql/cleandata.sql @@ -47,7 +47,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (0,'',4,0,0,0,0,7,10,0,0,'','^[^@]+$','','','','ezuser',12,'user_account',0,1,0,FALSE,3,NULL,NULL,'a:2:{s:6:"eng-GB";s:12:"User account";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',5,0,0,0,0,150,0,0,0,'','','','',NULL,'ezstring',116,'name',0,1,1,FALSE,1,NULL,NULL,'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',5,0,0,0,0,10,0,0,0,'','','','',NULL,'ezrichtext',117,'caption',0,0,1,FALSE,2,NULL,NULL,'a:2:{s:6:"eng-GB";s:7:"Caption";s:16:"always-available";s:6:"eng-GB";}',0), - (1,'',5,0,0,0,0,10,0,0,0,'','','','',NULL,'ezimage',118,'image',0,0,0,TRUE,3,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0), + (1,'',5,10.0,0,0,0,0,0,0,0,'MB','','','',NULL,'ezimage',118,'image',0,0,0,TRUE,3,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',1,NULL,NULL,NULL,NULL,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',119,'short_description',0,0,1,FALSE,3,'N;','a:0:{}','a:1:{s:6:"eng-GB";s:17:"Short description";}',0), (1,'',2,0,0,0,0,10,0,0,0,'','','','','','ezrichtext',120,'intro',0,1,1,FALSE,4,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Intro";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',2,0,0,0,0,20,0,0,0,'','','','','','ezrichtext',121,'body',0,0,1,FALSE,5,NULL,NULL,'a:2:{s:6:"eng-GB";s:4:"Body";s:16:"always-available";s:6:"eng-GB";}',0), @@ -61,7 +61,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (1,'',1,NULL,NULL,NULL,NULL,100,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezstring',155,'short_name',0,0,1,FALSE,2,'N;','a:0:{}','a:1:{s:6:"eng-GB";s:10:"Short name";}',0), (1,'',1,NULL,NULL,NULL,NULL,20,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',156,'description',0,0,1,FALSE,4,'N;','a:0:{}','a:1:{s:6:"eng-GB";s:11:"Description";}',0), (1,'',4,0,0,0,0,10,0,0,0,'','','','','','eztext',179,'signature',0,0,1,FALSE,4,NULL,NULL,'a:2:{s:6:"eng-GB";s:9:"Signature";s:16:"always-available";s:6:"eng-GB";}',0), - (1,'',4,0,0,0,0,10,0,0,0,'','','','','','ezimage',180,'image',0,0,0,TRUE,5,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0); + (1,'',4,10.0,0,0,0,0,0,0,0,'MB','','','','','ezimage',180,'image',0,0,0,TRUE,5,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0); INSERT INTO "ezcontentclass_classgroup" ("contentclass_id", "contentclass_version", "group_id", "group_name") VALUES (1,0,1,'Content'), diff --git a/src/lib/FieldType/Image/Type.php b/src/lib/FieldType/Image/Type.php index ef84995998..6345fec17b 100644 --- a/src/lib/FieldType/Image/Type.php +++ b/src/lib/FieldType/Image/Type.php @@ -24,7 +24,7 @@ class Type extends FieldType implements TranslationContainerInterface protected $validatorConfigurationSchema = [ 'FileSizeValidator' => [ 'maxFileSize' => [ - 'type' => 'int', + 'type' => 'numeric', 'default' => null, ], ], @@ -134,11 +134,11 @@ protected function checkValueStructure(BaseValue $value) ); } - if (isset($value->fileSize) && (!is_int($value->fileSize) || $value->fileSize < 0)) { + if (isset($value->fileSize) && ((!is_int($value->fileSize) && !is_float($value->fileSize)) || $value->fileSize < 0)) { throw new InvalidArgumentType( '$value->fileSize', - 'int', - $value->alternativeText + 'numeric', + $value->fileSize ); } @@ -233,14 +233,14 @@ public function validateValidatorConfiguration($validatorConfiguration) ); break; } - if (!is_int($parameters['maxFileSize']) && $parameters['maxFileSize'] !== null) { + if (!is_numeric($parameters['maxFileSize']) && $parameters['maxFileSize'] !== null) { $validationErrors[] = new ValidationError( 'Validator %validator% expects parameter %parameter% to be of %type%.', null, [ '%validator%' => $validatorIdentifier, '%parameter%' => 'maxFileSize', - '%type%' => 'integer', + '%type%' => 'numeric', ], "[$validatorIdentifier][maxFileSize]" ); diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php index 0b06c09c40..436bcc6f87 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php @@ -183,8 +183,9 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField { $validators = $fieldDef->fieldTypeConstraints->validators; - $storageDef->dataInt1 = $validators['FileSizeValidator']['maxFileSize'] ?? 0; + $storageDef->dataFloat1 = $validators['FileSizeValidator']['maxFileSize'] ?? 0.0; $storageDef->dataInt2 = (int)($validators['AlternativeTextValidator']['required'] ?? 0); + $storageDef->dataText1 = 'MB'; } public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void @@ -193,7 +194,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin [ 'validators' => [ 'FileSizeValidator' => [ - 'maxFileSize' => $storageDef->dataInt1 !== 0 ? $storageDef->dataInt1 : null, + 'maxFileSize' => $storageDef->dataFloat1 !== 0.0 ? $storageDef->dataFloat1 : null, ], 'AlternativeTextValidator' => [ 'required' => (bool)$storageDef->dataInt2, diff --git a/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php b/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php index ff9555acc0..c3594c8055 100644 --- a/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php @@ -112,8 +112,8 @@ public function getValidatorSchema() return [ 'FileSizeValidator' => [ 'maxFileSize' => [ - 'type' => 'int', - 'default' => false, + 'type' => 'numeric', + 'default' => null, ], ], 'AlternativeTextValidator' => [ @@ -134,7 +134,7 @@ public function getValidValidatorConfiguration() { return [ 'FileSizeValidator' => [ - 'maxFileSize' => 2 * 1024 * 1024, // 2 MB + 'maxFileSize' => 2.0, ], 'AlternativeTextValidator' => [ 'required' => true, diff --git a/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml b/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml index 6611e9f474..62e092cdcd 100644 --- a/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml +++ b/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml @@ -87,16 +87,16 @@ ezcontentclass_attribute: - { can_translate: 0, category: '', contentclass_id: 14, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 6, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: image.ini, data_text2: large, data_text3: Filters, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 171, identifier: imagelarge, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 13, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:16:"Image Large Size";}', version: 0 } - { can_translate: 0, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: site.ini, data_text2: SiteSettings, data_text3: SiteName, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 172, identifier: title, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 1, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Title";}', version: 0 } - { can_translate: 0, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 6, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: site.ini, data_text2: SiteSettings, data_text3: MetaDataArray, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 173, identifier: meta_data, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 2, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:9:"Meta data";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 174, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Image";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 174, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Image";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: sitestyle, data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezpackage, id: 175, identifier: sitestyle, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 4, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:9:"Sitestyle";}', version: 0 } - { can_translate: 0, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: site.ini, data_text2: MailSettings, data_text3: AdminEmail, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 177, identifier: email, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 6, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Email";}', version: 0 } - { can_translate: 0, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: site.ini, data_text2: SiteSettings, data_text3: SiteURL, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 178, identifier: siteurl, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 7, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:8:"Site URL";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 4, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 10, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: eztext, id: 179, identifier: signature, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 4, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:9:"Signature";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 4, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 180, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 5, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Image";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 4, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1024, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 180, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 5, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Image";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 255, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'New article', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 181, identifier: title, is_information_collector: 0, is_required: 1, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Title";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 255, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 182, identifier: short_title, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 2, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:11:"Short title";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezauthor, id: 183, identifier: author, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:6:"Author";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 186, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 6, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 186, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 6, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezdatetime, id: 188, identifier: publish_date, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 8, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:12:"Publish date";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 190, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 10, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezgmaplocation, id: 191, identifier: location, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 11, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:8:"Location";s:16:"always-available";s:6:"eng-GB";}', version: 0 } @@ -110,7 +110,7 @@ ezcontentclass_attribute: - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 201, identifier: name, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 202, identifier: product_number, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 2, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:14:"Product number";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezfloat, id: 205, identifier: price, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 5, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Price";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 206, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 6, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 206, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 6, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezmultioption, id: 208, identifier: additional_options, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 8, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:18:"Additional options";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 210, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 10, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezcomcomments, id: 211, identifier: comments, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 11, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:8:"Comments";s:16:"always-available";s:6:"eng-GB";}', version: 0 } @@ -132,7 +132,7 @@ ezcontentclass_attribute: - { can_translate: 1, category: '', contentclass_id: 24, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 234, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 5, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 24, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezcomcomments, id: 235, identifier: comments, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 6, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:8:"Comments";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 150, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 236, identifier: name, is_information_collector: 0, is_required: 1, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 2, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 238, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 2048, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 238, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 240, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 5, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 26, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 255, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 241, identifier: name, is_information_collector: 0, is_required: 1, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 26, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezurl, id: 243, identifier: location, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:8:"Location";s:16:"always-available";s:6:"eng-GB";}', version: 0 } @@ -157,7 +157,7 @@ ezcontentclass_attribute: - { can_translate: 0, category: '', contentclass_id: 32, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: "\n\n", data_type_string: ezselection, id: 266, identifier: view, is_information_collector: 0, is_required: 1, is_searchable: 0, placement: 2, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"View";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 267, identifier: name, is_information_collector: 0, is_required: 1, is_searchable: 0, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 268, identifier: url, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 2, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:3:"URL";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 269, identifier: image, is_information_collector: 0, is_required: 1, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 269, identifier: image, is_information_collector: 0, is_required: 1, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 10, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: eztext, id: 270, identifier: image_map, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 4, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:9:"Image map";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 271, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 5, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 34, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 272, identifier: title, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Title";s:16:"always-available";s:6:"eng-GB";}', version: 0 } diff --git a/tests/lib/FieldType/ImageTest.php b/tests/lib/FieldType/ImageTest.php index 126639d1e1..042d400141 100644 --- a/tests/lib/FieldType/ImageTest.php +++ b/tests/lib/FieldType/ImageTest.php @@ -112,7 +112,7 @@ protected function getValidatorConfigurationSchemaExpectation() return [ 'FileSizeValidator' => [ 'maxFileSize' => [ - 'type' => 'int', + 'type' => 'numeric', 'default' => null, ], ], @@ -561,7 +561,7 @@ public function provideValidDataForValidate() [ 'validatorConfiguration' => [ 'FileSizeValidator' => [ - 'maxFileSize' => 1, + 'maxFileSize' => 1.0, ], ], ], diff --git a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php index b14eb6e415..5f03edb553 100644 --- a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php +++ b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php @@ -64,8 +64,9 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable ]), ]), new StorageFieldDefinition([ - 'dataInt1' => 0, + 'dataFloat1' => 0.0, 'dataInt2' => 0, + 'dataText1' => 'MB', ]), ]; @@ -74,14 +75,15 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable 'fieldTypeConstraints' => new FieldTypeConstraints([ 'validators' => [ 'FileSizeValidator' => [ - 'maxFileSize' => 1024, + 'maxFileSize' => 1.0, ], ], ]), ]), new StorageFieldDefinition([ - 'dataInt1' => 1024, + 'dataFloat1' => 1.0, 'dataInt2' => 0, + 'dataText1' => 'MB', ]), ]; @@ -96,8 +98,9 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable ]), ]), new StorageFieldDefinition([ - 'dataInt1' => 0, + 'dataFloat1' => 0.0, 'dataInt2' => 1, + 'dataText1' => 'MB', ]), ]; @@ -112,8 +115,9 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable ]), ]), new StorageFieldDefinition([ - 'dataInt1' => 0, + 'dataFloat1' => 0.0, 'dataInt2' => 0, + 'dataText1' => 'MB', ]), ]; } @@ -139,7 +143,7 @@ public function dataProviderForTestToFieldDefinition(): iterable { yield [ new StorageFieldDefinition([ - 'dataInt1' => 0, + 'dataFloat1' => 0.0, 'dataInt2' => 0, ]), new FieldDefinition([ @@ -158,14 +162,14 @@ public function dataProviderForTestToFieldDefinition(): iterable yield [ new StorageFieldDefinition([ - 'dataInt1' => 1024, + 'dataFloat1' => 1.0, 'dataInt2' => 1, ]), new FieldDefinition([ 'fieldTypeConstraints' => new FieldTypeConstraints([ 'validators' => [ 'FileSizeValidator' => [ - 'maxFileSize' => 1024, + 'maxFileSize' => 1.0, ], 'AlternativeTextValidator' => [ 'required' => true,