strawberry's avatar

phpunit not using in memory sqlite

Hi, I've just started the 'Let's Build A Forum with Laravel and TDD' series, and am unable to get the tests running using the sqlite in memory database. Using Laragon if that makes any difference.

include in the php tag in phpunit.xml

<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>

Running 'php artisan test' results in the data being added to the mysql database and not the sqlite in memory.

If anyone has any ideas, thanks.

0 likes
6 replies
Sinnbeck's avatar

Any chance your $connection is set on the model?

Tray2's avatar

Maybe a stupid question but have you installed SQLite?

strawberry's avatar

@sinnbeck Nope. @tray2 Yes, I have, but I do also suspect that I've done something stupid or am missing something simple.

Tray2's avatar

What happens if you specify the phpunit.xml you want to use?

phpunit --configuration <path to your phpunit.xml>

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Any chance you cached config?

php artisan config:clear
2 likes

Please or to participate in this conversation.