Pest: Laravel .env not picked up in test

Created on 21 Aug 2020  路  6Comments  路  Source: pestphp/pest

When running my test, if I dd(config('services')); Nothing will be set in the array that is defined in my .env and loaded into the config.

Not sure if I am missing something in my TestCase that needs to be added or what might be causing these .env values to be ignored.

bug

Most helpful comment

Hey guys. Had an .env.testing I didn鈥檛 realize was taking precedence! My bad 馃槄

All 6 comments

@owenvoke Can you test this in a fresh laravel app very quickly? I am almost 100% sure this works.

Seems to be working as expected when I tested. 馃

https://asciinema.org/a/lVxc1Wwi8txmihEEhBHvqJg9z


Preview screenshot

image

Make sure you don鈥檛 have cached config. That鈥檒l wreak havoc on your expectations!

Hey guys. Had an .env.testing I didn鈥檛 realize was taking precedence! My bad 馃槄

No problem @JacobBennett, easy mistake to make. Going to close this issue if that's alright? 馃憤馃徎

Yes, please! Was going to close myself but couldn't find the option on Github Mobile :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

beliolfa picture beliolfa  路  3Comments

zingimmick picture zingimmick  路  3Comments

dingo-d picture dingo-d  路  6Comments

olivernybroe picture olivernybroe  路  7Comments

albertpratomo picture albertpratomo  路  7Comments