If you want to statically specify the root URL for your tests, add it to phpunit.xml:
<env name="APP_URL" value="http://testing.local"/>
Instead, if you want to change the URL dynamically during tests, from Laravel 5.4 the method $baseUrlno longer works
Also, trying to set the URL dynamically using \Config:set('app.url', 'http://testing.local')doesn't work either, as it seems like Laravel is caching the root URL
A dynamically configurable URL can be configured using:
\URL::forceRootUrl('http://testing.local');
Moppo source
share