samedi 28 novembre 2015

How can I write an integration test for an endpoint that uses the Storage filesystem in Laravel 5?

I have the following API endpoint (code has been simplified for the purpose of the question):

class TestController{
     public function test(Request $request)
     {
          $this->validate($request, ['picture' => 'required|image']);

          Storage::disk('s3')->put('tests/test.png', file_get_contents($request->file('picture'));

          return 'tests/test.png';
     }

How can I write an integration test for this code in phpunit?
I have a test that works, but the problem is that everytime I run phpunit, it uploads the file to Amazon S3.

Aucun commentaire:

Enregistrer un commentaire