Closed
Description
Symfony version(s) affected: 3.4.25
Description
According to the docs you can test a form with a file field as follow:
// uploads a file
$form['photo']->upload('/path/to/lucas.jpg');
In Symfony 3.4.24 this works, in 3.4.25 it does not because the form errors are added & isValid on the UploadedFile returns false.
elseif ($requestHandler->isFileUpload($event->getData()) && method_exists($requestHandler, 'getUploadFileError') && null !== $errorCode = $requestHandler->getUploadFileError($event->getData())) {
$form->addError($this->getFileUploadError($errorCode));
}
The related change is added in #30895 in the file src/Symfony/Component/Form/Extension/Core/Type/FileType.php
on line 80
Not sure why this worked before this change and how to get it working again..
How to reproduce
Create a functional test with an upload form and submit it
$form['photo']->upload('/path/to/lucas.jpg');
$client->submit($form);