laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 31 forks source link

Suggesting that ".env.testing" file be added to .gitignore #2659

Open Defrothew opened 3 years ago

ahinkle commented 2 years ago

Most applications don't have a .env.testing. If you setup your PHPUnit configuration; you shouldn't a need for a testing env.

michaeldyrynda commented 2 years ago

I disagree with that. phpunit.xml is great for environment variables that you never want to change between test environments (hash rounds, etc.), but can be problematic if you do have per-developer settings for testing.

You wouldn’t want to store Stripe keys in phpunit.xml, some developers may use host-available MySQL, some might use Docker or Sail, you may want to use SQLite locally.

From memory, phpunit.xml Will take precedence over any .env file values.

That said, I think it’s sufficient to just put this in your project ignore rather than the default project template.