keevitaja's avatar

How to test uploading

Hello!

How to test uploading feature? User can select an image and upload it to server.

Testing is still something i have not done enough!

0 likes
1 reply
Vijay's avatar

If your form contains file input types, you may attach files to the form using the attach method:

public function testPhotoCanBeUploaded()

{

$this->visit('/upload')

     ->name('File Name', 'name')

     ->attach($absolutePathToFile, 'photo')

     ->press('Upload')

     ->see('Upload Successful!');

}

Refer this link : http://laravel.com/docs/5.1/testing

Please or to participate in this conversation.