How to specify a different .env file for phpunit in Laravel 5?

前端 未结 10 2336
礼貌的吻别
礼貌的吻别 2020-12-29 05:25

I have a .env file containing my database connection details, as is normal for Laravel 5. I want to override these for testing, which I can do in phpunit.

10条回答
  •  执笔经年
    2020-12-29 06:24

    I did all the steps in @Sambhu Singh answer as well as followed his link. But didn't work for me in L5.5

    When migrating, adding/setting APP_ENV to 'testing' in front of the artisan command worked for me:

    APP_ENV=testing php artisan migrate --database=sqlite_testing
    

提交回复
热议问题