How are you running your tests; inside PHPStorm, or on the commandline?
Oct 24, 2019
10
Level 12
phpunit.xml does not use my sqlite settings
I start to learn testing. After a lot of tests I realized, that even if i setup my phpunit.xml to use sqlite, it uses my main database, which is mysql.
I have this in my phpunit.xml:
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="MAIL_DRIVER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="DB_CONNECTION" value="sqlite" />
<server name="DB_DATABASE" value=":memory:" />
I don't want to use my production database for all my tests. I think it is better to use another one. But what have I forgot?
Level 12
Ok. After a lot of hours i found the problem. It was my fault... I ever was thinking that
php artisan config:cache
does the same as
php artisan config:clear & php artisan cache:clear
But that isn't so... not sure why... but when i do the second version (first config:clear then cache:clear) it works.
1 like
Please or to participate in this conversation.