Yeah that should be completely fine. Each member just adds their own .env.testing file and set their own env. Just remember to ignore it it gitignore
Nov 18, 2022
10
Level 1
How to handle testing DB data setup in new project
Hello Guys, We always in team have problem how to set DB data for whole team to be ok and simple. (we dont use dockers and sqlite in memory)
For now we are adding "testing" connection in config.database:
(...)
'host' => env('DB_TEST_HOST', 'localhost'),
'database' => env('DB_TEST_DATABASE', 'testdb'),
'username' => env('DB_TEST_USERNAME', 'root'),
'password' => env('DB_TEST_PASSWORD', 'secret'),
(...)
And then adding it to phpunix.xml:
<php>
<env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="DB_CONNECTION" value="testing"/> <--
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
and finally each team member set his own credentials via .env file variables
DB_TEST_DATABASE=xxx
DB_TEST_USERNAME=xxx
DB_TEST_PASSWORD=xxx
and Im not sure if this is the best way.
If you know better/other way to do this then I'm very interested in your opinion :)
Thank you! K
Please or to participate in this conversation.