Laravel - HTTP Tests - Testing File Uploads

The Illuminate\Http\UploadedFile class provides a fake method which may be used to generate dummy files or images for testing. This, combined with the Storage facade's fake method, greatly simplifies the testing of file uploads. For example, you may combine these two features to easily test an avatar upload form:

            $response = $this->post('/avatar', [
                'avatar' => $file,

If you would like to assert that a given file does not exist, you may use the assertMissing method provided by the Storage facade:

    // ...