title: Mocking an uploaded file with content
body: <p>I'm working on a Laravel project that utilizes GraphQL with Lighthouse for the backend API.
  For some of the endpoints, we have file upload support. We have successfully tested that.</p>
  
  <p>The new endpoint that we are creating right now, will also support a file upload. But instead of just storing the file somewhere on our server, we have to read the contents of this file and do something depending on this content.</p>
  
  <p>We want to test this new feature, ofcourse. But to do that. We have to mock an uploaded file, with specific contents, to test this. All I could find was just a fake <code>UploadedFile::fake()</code> method that creates a random/empty file for you.</p>
  
  <p>I know I could create unit tests for this. But I really want to add an end-to-end test.</p>
  
  <p>The <a href="https://lighthouse-php.com/3.7/testing/phpunit.html#simulating-file-uploads" rel="nofollow noreferrer">official lighthouse docs</a> has the following code example:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  $this-&gt;multipartGraphQL(
      [
          'operations' =&gt; /* @lang JSON */
              '
              {
                  "query": "mutation Upload($file: Upload!) { upload(file: $file) }",
                  "variables": {
                      "file": null
                  }
              }
          ',
          'map' =&gt; /* @lang JSON */
              '
              {
                  "0": ["variables.file"]
              }
          ',
      ],
      [
          '0' =&gt; UploadedFile::fake()-&gt;create('image.jpg', 500),
      ]
  )
  </code></pre>
  
  <p>I need to replace that uploaded file with a mock that I created myself. Maybe something like:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  UploadedFile::fake()
      -&gt;fromPath('example/file/in/my/testsuite.obj')
      -&gt;create()
  </code></pre>
  
  <p>Is there any build-in way I can set the content of a fake uploaded file? Or is there any way I can extend the class with my own factory logic? </p>