0
votes

VERSIONS: Laravel v5.8.21 & Laravel Dusk v5.1.0

I'm having real issues with getting Dusk to work with a testing database. I seem to have gone through every piece of advice and still no luck. Dusk is not loading my .env.dusk.local file for some reason. Can anyone help?

// test
class ApplicationTest extends DuskTestCase
{
    use DatabaseMigrations;

    /** @test */
    public function it_works()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/test')->assertSee('It works!');
        });
    }
}

// .env.dusk.local
APP_NAME="Laravel"
APP_ENV=local
APP_URL=http://127.0.0.1:8000

DB_CONNECTION=dusk

// database.php
'dusk' => [
    'driver' => 'sqlite',
    'database' => database_path('dusk.sqlite'),
    'prefix' => '',
]

Then I run the PHP web server with php artisan serve --env=dusk.local however Dusk uses the .env file and goes to my development site using the development database.

What am I doing wrong?

1
What's the result of dd(env('DB_CONNECTION')); inside the test?Jonas Staudenmeir

1 Answers

0
votes

I think you might need to update Laravel. Are you using an older version of the framework? This used to be a bug pre-5.8.7. See: https://github.com/laravel/framework/issues/27828