I'm writing a test for one of my Form's store methods, and basically I have a file upload with it. I upload the file via ajax into a temp directory on the server and then when the form is submitted, I transfer it from temp into s3 storage.
I'm having some issues mocking this for my test. I was hoping someone could provide an example of how I could create a temp image file in my temp Storage?
Contents of the image file don't matter so it can just be an empty image. I've tried creating one myself but the code is relatively messy and it's still causing errors in the test.
You can use Illuminate\Http\Testing\File to simulate creating a file for upload
And you can use Storage::fake(DRIVER) to fake the upload, so that you can assert that the file has been uploaded.
This will upload to /storage/framework/testing/disks/DRIVER