trevorpan's avatar

Database connection [testing.sqlite] not configured.

https://laracasts.com/discuss/channels/testing/database-does-not-exist-when-trying-to-use-mysql-for-phpunit-tests

https://medium.com/@james_fairhurst/issues-i-ran-into-when-testing-in-laravel-5-with-sqlite-7ef79de29a94

I've spent the last few hours trying to setup a sqlite database.

What is the order of php artisan dusk reading the

env.dusk.local
phpunit.dusk.xml
database.php

It seems like I try one file, then a database not specified in any of the above files is used. Or the database migrations trait dumps the local mysql dev database.

Is it necessary to run php artisan serve and put that APP_URL=http://127.0.0.1:8000 in the env.dusk.local or is Laravel Valet just fine?

Thank you `

0 likes
1 reply
trevorpan's avatar

one more whack-a-mole shot seems to have found the database!!

I still think it's worth talking about.

        'sqlite' => [
            'driver' => 'sqlite',
            'database' => database_path('testing.sqlite'),
	    // 'database' => database_path('database.sqlite'), // this one was setup prior and did not fix issue
            'prefix' => '',
        ],

//         'sqlite_testing' => [
//            'driver' => 'sqlite',
//            'database' => env('DB_DATABASE', database_path('testing.sqlite')),
//            'prefix' => '',
//        ],

I saw a post on laracasts that said use the env('DB_DATABASE env variable. However, in the sqlite above it did not allow the database to be found. That post said you can remove the variable from the env.dusk.local file.

The other issue I may have found on accident, I thought it would be good to use a sqlite_testing connection. However, does the env.dusk.local or phpunit.dusk.xml stop at the first sqlite?

I'm wondering if the suffix of _testing is never read?

If you can share and make sense of all this that would be great.

Please or to participate in this conversation.