(string) \UPLOAD_ERR_FORM_SIZE, 'uploadFormSizeErrorMessage'
],
[(string) \UPLOAD_ERR_PARTIAL, 'uploadPartialErrorMessage'
],
[(string) \UPLOAD_ERR_NO_FILE, 'uploadNoFileErrorMessage'
],
[(string) \UPLOAD_ERR_NO_TMP_DIR, 'uploadNoTmpDirErrorMessage'
],
[(string) \UPLOAD_ERR_CANT_WRITE, 'uploadCantWriteErrorMessage'
],
[(string) \UPLOAD_ERR_EXTENSION, 'uploadExtensionErrorMessage'
],
];
if (class_exists(UploadedFile::
class)) { // when no maxSize is specified on constraint, it should use the ini value
$tests[] =
[(string) \UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage',
[ '{{ limit }}' => UploadedFile::
getMaxFilesize() / 1048576,
'{{ suffix }}' => 'MiB',
]];
// 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());