title: Laravel Dusk Migration Rollback Causing Schema Changed Exceptions
body: <p>I am attempting to run some browser tests on an sqlite, in file database separate from my application.</p>
  
  <p>In one process I run</p>
  
  <pre><code>APP_ENV=local artisan serve --env=dusk.local
  </code></pre>
  
  <p>And in another I run</p>
  
  <pre><code>APP_ENV=local artisan dusk
  </code></pre>
  
  <p>What appears to happen is my test runs, the database migrates, runs my test which passes and then rolls back as expected.</p>
  
  <p>However, following the successful test my Laravel log gets filled with loads of exceptions varying from those which would be expected when a request is made in the absence of a schema and data, and others such as </p>
  
  <pre><code>General error: 17 database schema has changed in [...]/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:91
  </code></pre>
  
  <p>I can't understand why it'd be making a request or doing something after the successful test.</p>
  
  <pre><code>class RegistrationTest extends DuskTestCase
  {
      use DatabaseMigrations;
  
      public function testUserCanRegister()
      {
          // Some factories here
  
          $this-&gt;browse(function (Browser $browser) {
              $browser-&gt;visit('/register')
                  -&gt;assertSee('Sign up');
          });
      }
  </code></pre>
  
  <p>Which yields</p>
  
  <pre><code>PHPUnit 5.7.21 by Sebastian Bergmann and contributors.
  
  .                                                                   1 / 1 (100%)
  
  Time: 5.5 seconds, Memory: 22.00MB
  
  OK (1 test, 1 assertion)
  </code></pre>
  
  <p>But then I see my log files full of errors if i tail them.</p>
  
  <p>Anyone able to shed some light on what might be going on?</p>
  
  <p>The dusk env file i'm using is below</p>
  
  <pre><code>APP_ENV=local
  APP_KEY=...
  APP_URL=http://localhost:8000
  
  DB_DEFAULT=app_testing
  DB_CONNECTION=app_testing
  SECOND_DB_CONNECTION=other_testing #app uses 2 separate databases
  
  SESSION_DRIVER=file
  </code></pre>
  
  <p>Update: some malformed asset urls were causing subsequent failing requests.</p>
  
  <p>However, if i disable the rollback none of the aforementioned logged exceptions are created. Rolling back seems to cause issues if data exists.</p>
  
  <p>If i allow rollback but don't run any factories during the test, it rolls back fine.</p>
  
  <p>If I allow rollback after inserting data during the test, it rolls back but with loads of exceptions.</p>