I'm using laravel 5.6
and Dusk
for this specific test.
I'm trying to assert a file upload in my dropzone. But my Dropzone is created in a way that I don't have a file
input element. So I can't use the attach()
method.
So I tried the following
$file = new \Symfony\Component\HttpFoundation\File\UploadedFile(base_path() . '/tests/samples/Cylinder.stl', 'Cylinder.stl');
$response = $this->actingAs( $this->user )
->from( 'my-url' )
->post( route('attachments.store' ) , [
'file' => $file
]);
But the error bag is containing this error
"errors" => Illuminate\Support\ViewErrorBag {#1194
#bags: array:1 [
"default" => Illuminate\Support\MessageBag {#1189
#messages: array:1 [
"file" => array:1 [
0 => "The file failed to upload."
]
]
#format: ":message"
}
]
}
And of course this is working when I do it manually.