// it should use the smaller limitation (maxSize option in this case)
$tests[] =
[(string) \UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage',
[ '{{ limit }}' => 1,
'{{ suffix }}' => 'bytes',
], '1'
];
// access FileValidator::factorizeSizes() private method to format max file size
$reflection =
new \
ReflectionClass(new FileValidator());
$method =
$reflection->
getMethod('factorizeSizes'
);
[,
$limit,
$suffix] =
$method->
invokeArgs(new FileValidator(),
[0, UploadedFile::
getMaxFilesize(), false
]);
// it correctly parses the maxSize option and not only uses simple string comparison
// 1000G should be bigger than the ini value
$tests[] =
[(string) \UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage',
[ '{{ limit }}' =>
$limit,
'{{ suffix }}' =>
$suffix,
], '1000G'
];
$tests[] =
[(string) \UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage',
[ '{{ limit }}' => '100',
'{{ suffix }}' => 'kB',
],