I was having this same problem with Laravel v5.6. I set up a .env.testing file with a different username, password, and database but my tests were always running in the main .env database.
It looks like you need to specify the test environment when running the config cache command. After running this command, it worked as described in the docs:
php artisan config:cache --env=testing