title: Laravel 5.4 ModelNotFoundException when testing database with SQLite
body: <p>I have encountered a problem with my feature tests  in Laravel 5.4. Whenever I try to run my database tests with the SQLite memory configuration I get this error:</p>
  
  <blockquote>
    <p>1) Tests\Feature\ParseAccountingFilesTest::testExample<br>
    │/Middleware/ValidatePostSize.php(27):
    Illuminate\Routing\Pipeline->Illuminate\R
    Illuminate\Database\Eloquent\ModelNotFoundException: No query results
    for model [App\QueuedAction] 1</p>
  </blockquote>
  
  <p>What I think is strange is the fact that this error is to my knowledge generally encountered only whenever the query builder uses one of the -OrFail() methods. My code works perfectly fine outside the tests when using a database queue driver and MySQL as the database driver. I have debugged the problem and found that it is caused by the following statement in the class constructor below:</p>
  
  <pre><code>$this-&gt;scheduledAction = $action;
  </code></pre>
  
  <p>This error makes no sense to me. There should be no query involved, only a simple allocation. This class is used as a simple parent class for the actual job classes to keep track of what actions have already been queued.</p>
  
  <pre><code>abstract class SchedulesOnce implements ShouldQueue
  {
      use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  
      protected $scheduledAction;
  
      public function __construct(string $id, string $type)
      {
          $action = new QueuedAction();
          $action-&gt;id = $id;
          $action-&gt;type = $type;
          $action-&gt;save();
          $this-&gt;scheduledAction = $action;
      }
  
      // Execute the job
      public function handle()
      {
          $this-&gt;execute();
  
          // Delete the queue reservation
          $this-&gt;scheduledAction-&gt;delete();
      }
  
      // Child functionality
      protected abstract function execute();
  }
  </code></pre>
  
  <p>Here are the relevant lines in my phpunit.xml</p>
  
  <pre><code>&lt;php&gt;
  &lt;env name="APP_ENV" value="testing"/&gt;
  &lt;env name="CACHE_DRIVER" value="array"/&gt;
  &lt;env name="SESSION_DRIVER" value="array"/&gt;
  &lt;env name="QUEUE_DRIVER" value="sync"/&gt;
  &lt;env name="DB_CONNECTION" value="sqlite"/&gt;
  &lt;env name="DB_DATABASE" value=":memory:"/&gt;
  &lt;/php&gt;
  </code></pre>