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