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?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NFK2IQ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire