Laravel - HTTP Tests - Fake File Customization

When creating files using the fake method provided by the UploadedFile class, you may specify the width, height, and size of the image (in kilobytes) in order to better test your application's validation rules:

    
    UploadedFile::fake()->image('avatar.jpg', $width, $height)->size(100);
	

In addition to creating images, you may create files of any other type using the create method:

    
    UploadedFile::fake()->create('document.pdf', $sizeInKilobytes);
	

If needed, you may pass a $mimeType argument to the method to explicitly define the MIME type that should be returned by the file:

    
    UploadedFile::fake()->create(
        'document.pdf', $sizeInKilobytes, 'application/pdf'
    );