I'm using
if (Input::hasFile('index')) doSomething();
to check if the file was uploaded.
Now I wanna write a PHPUnit test case where the system needs to behave like the "index" file was uploaded.
Input::shouldReceive('hasFile')->andReturn(true)
does not work.
Also there's a note in laravel docs: You should not mock the Request facade. Instead, pass the input you desire into the call method when running your test.
So maybe this isn't such a great idea after all.
I tried mocking \Symfony\Component\HttpFoundation\File\UploadedFile and passing it to my call method but after I define "shouldReceive" for all methods the system is expecting it still doesn't work as I need it to.
Is there any way to test the call so that Input::hasFile
would return TRUE without uploading an actual file?
Thank you
Aucun commentaire:
Enregistrer un commentaire