i'm creating an API in Laravel 5.5 and this API supports receiving some files for profile pictures and such.
I want to limit this through a form request to accept only JPG and PNG images and i'm setting up my Form Request as follows:
'picture' => 'nullable|image|mimetypes:image/jpeg,image/png,image/jpg|max:2000' // 2000KB or around 2MB per picture
Then, on my PHPUnit/Codeception tests i'm sending a fake image using Laravel's own fake
static method as follows
'picture' => UploadedFile::fake()->image("hello.svg")
If i DD the image file that is being sent when i run the test it correctly lists it's MIMEType as image/svg+xml
, however, somehow this passes validation and comes out the other end and that should not be the case as my rule should limit only PNG or JPG files.
Does anyone else have this issue?