title: How to test file upload with laravel and phpunit?
body: <p>I'm trying to run this functional test on my laravel controller. I would like to test image processing, but to do so I want to fake image uploading. How do I do this? I found a few examples online but none seem to work for me. Here's what I have:</p>
  
  <pre><code>public function testResizeMethod()
  {
      $this-&gt;prepareCleanDB();
  
      $this-&gt;_createAccessableCompany();
  
      $local_file = __DIR__ . '/test-files/large-avatar.jpg';
  
      $uploadedFile = new Symfony\Component\HttpFoundation\File\UploadedFile(
          $local_file,
          'large-avatar.jpg',
          'image/jpeg',
          null,
          null,
          true
      );
  
  
      $values =  array(
          'company_id' =&gt; $this-&gt;company-&gt;id
      );
  
      $response = $this-&gt;action(
          'POST',
          'FileStorageController@store',
          $values,
          ['file' =&gt; $uploadedFile]
      );
  
      $readable_response = $this-&gt;getReadableResponseObject($response);
  }
  </code></pre>
  
  <p>But the controller doesn't get passed this check:</p>
  
  <pre><code>elseif (!Input::hasFile('file'))
  {
      return Response::error('No file uploaded');
  }
  </code></pre>
  
  <p>So somehow the file isn't passed correctly. How do I go about this?</p>