I am completely new to laravel, but just found that the only way to get tests running on my local machine and (for example) Codeship is with a .env when I need it. (I know this is not a very clean way, but hey, it works)
I have a local .env file:
and
For local tests, I made an alias:
alias pl='rm .env; ln -s .env.testing .env; phpunit; rm .env; ln -s .env.local .env'
Where .env.local is stored a copy of my local .env file.
And for the Codeships test pipeline:
ln -s .env.codeship .env php artisan migrate --seed phpunit
Database Configuration:
// CODESHIP 'codeship' => [ 'driver' => 'mysql', 'username' => getenv('MYSQL_USER'), 'password' => getenv('MYSQL_PASSWORD'), // etc ], // LOCAL DEV // PHPUNIT 'default_mysql' => [ 'driver' => 'mysql', 'username' => env('DB_USERNAME', 'localhost'), 'password' => env('DB_PASSWORD', 'forge'), // etc ],
If anyone has any better ideas, I'm glad to hear.
everyman
source share