you can change bootstrap/start.php and set $env if php CLI is running (http://nl1.php.net/php_sapi_name)
I have looked at this but it impacts all cli commands, I was hoping for something like php artisan serve --env=testing. This may not be the best way of running integration tests
maybe you can set (define) the environment in /server.php and then check it in /bootstrap/start.php
Thanks, this worked. It took a few hacks to set everything up before the tests but at least its workable.
I figured it out. Use environment variables.
(in bash)
export APP_ENV=testing
(in bootstrap/start.php)
$env = $app->detectEnvironment(function ()
{
return getenv('APP_ENV') ?: 'development';
});
If you do the export command before running the artisan server you'll be fine. Do
unset APP_ENV
afterwards to clear it.
So this way you have to manually change the environments?
I tried:
APP_ENV=local php artisan serve
And it seems to be working.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community