zenstruck / browser

A fluent interface for your Symfony functional tests.
MIT License
190 stars 18 forks source link

file multiupload support #51

Closed raneomik closed 3 years ago

raneomik commented 3 years ago

Greetings !

first of all, I really enjoy your library with its Developper eXperience friendly usage.

But we came to a cases with multiple file upload in a Symfony application. Is there a way to test a multiple upload on a file input with multiple="multiple" attribute ?

this kind of "generic code" ($files being an array of paths to fixtures files) :

    $browser = $this
        ->browser()
        ->get('/form-with-file-input-path')
     ;
     ...
     foreach($files as $file) {
         $brower->attachFile('file_input[]', "$file");
    }

    $browser->click('submit_button');

doesn't seem to work : in the controller, the concerned file field, or the $request->files seem to be systematicaly empty ....

thank you !

raneomik commented 3 years ago

(closed due to issue duplication creation - local browser bug)