jeudi 30 août 2018

Laravel unit test with upload file can not get file

I'm working on Laravel 5.6.

My code for unit test:

public function testUpload()
{
    Storage::fake('local');

    $this
        ->post(route('/upload', ['file' => UploadedFile::fake()->create('file.txt', 1024)]))
        ->assertSuccessful();
}

But in controller $request->file('file') always null.

Does anyone have any idea about this issue?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire