Skip to content

Commit

Permalink
[Tests] Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ciastektk committed Oct 31, 2023
1 parent de43e90 commit e4592f5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function getValidatorSchema()
return [
'FileSizeValidator' => [
'maxFileSize' => [
'type' => 'int',
'type' => 'float',
'default' => false,
],
],
Expand All @@ -131,9 +131,11 @@ public function getValidatorSchema()
*/
public function getValidValidatorConfiguration()
{
$fileSize = 2 * 1024 * 1024;

return [
'FileSizeValidator' => [
'maxFileSize' => 2 * 1024 * 1024, // 2 MB
'maxFileSize' => (float)$fileSize, // 2 MB
],
'AlternativeTextValidator' => [
'required' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ezcontentclass_attribute:
- { 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: '', 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 }
Expand Down Expand Up @@ -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: '', 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 }
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/FieldType/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected function getValidatorConfigurationSchemaExpectation()
return [
'FileSizeValidator' => [
'maxFileSize' => [
'type' => 'int',
'type' => 'float',
'default' => null,
],
],
Expand Down Expand Up @@ -557,7 +557,7 @@ public function provideValidDataForValidate()
[
'validatorConfiguration' => [
'FileSizeValidator' => [
'maxFileSize' => 1,
'maxFileSize' => 1.0,
],
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable
'fieldTypeConstraints' => new FieldTypeConstraints([
'validators' => [
'FileSizeValidator' => [
'maxFileSize' => 1024,
'maxFileSize' => 1024.0,
],
],
]),
]),
new StorageFieldDefinition([
'dataInt1' => 1024,
'dataInt1' => 1048576,
'dataInt2' => 0,
]),
];
Expand Down Expand Up @@ -165,7 +165,7 @@ public function dataProviderForTestToFieldDefinition(): iterable
'fieldTypeConstraints' => new FieldTypeConstraints([
'validators' => [
'FileSizeValidator' => [
'maxFileSize' => 1024,
'maxFileSize' => 1.0,
],
'AlternativeTextValidator' => [
'required' => true,
Expand Down

0 comments on commit e4592f5

Please sign in to comment.