title: Laravel faking file in the factory not working
body: <p>I am developing a Web application using Laravel. I am unit testing my application that involves file operation. Have a look at my scenario below.</p>
  
  <p>I have a download file action in the controller like this</p>
  
  <pre><code>public function downloadPersonalDetails(Order $order)
  {
      if (! auth()-&gt;user()-&gt;can('downloadPersonalDetails', $order)) {
          abort(401);
      }
  
      return Storage::download($order-&gt;path);
  }
  </code></pre>
  
  <p>I have the factory like this OrderFactory.php</p>
  
  <pre><code>$factory-&gt;define(Application::class, function (Faker $faker) {
      return [
          'first_name' =&gt; $faker-&gt;firstName,
          'last_name' =&gt; $faker-&gt;lastName,
          'email' =&gt; $faker-&gt;email,
          //other fields ....
          'path' =&gt; $faker-&gt;file('public/assets/files'),
  });
  </code></pre>
  
  <p>This is my unit test to that download action</p>
  
  <pre><code>public function test_download_personal_details_file()
      {
          $user = //created a authorized valid user
  
          $order = factory(Order::class)
              -&gt;create([
                 'user' =&gt; $user-&gt;id
              ]);
  
  
          $this-&gt;actingAs($user)-&gt;get(route('order.personal_info.download', $order))-&gt;assertStatus(200);
      }
  </code></pre>
  
  <p>When I run the test I am getting error saying file does not exist.</p>
  
  <pre><code>File not found at path: tmp/439fe03f-f1c7-3b84-b123-d627d0395bd8.pdf
  </code></pre>
  
  <p>Why is that not working? How can I fix it and what is wrong with my code.</p>