How do I set laravel test to go to site name instead of localhost How do I set laravel test to go to site name instead of localhost laravel laravel

How do I set laravel test to go to site name instead of localhost


From Laravel 5.4 the $baseUrl method doesn't seem to work anymore

Also, trying to set the url dinamically with \Config:set('app.url', 'http://dev.myappnamehere') doesn't work either, as it seems that Laravel caches the root url

A way to set a custom root url is:

\URL::forceRootUrl('http://dev.myappnamehere');


For Laravel 5,In the tests directory there should be a file called TestCase.php. In that file is a property $baseUrl. Update the value to your desired url. For example change

protected $baseUrl = 'http://localhost';

to

protected $baseUrl = 'http://dev.myappnamehere';


So shortly after I asked I stumbled on the answer. In

 LaravelTestCase.php 

there is a function called

  baseUrl() 

which sets the url it looks for. Once I changed that it looked in the correct spot. That file was part of the laracast testing that I loaded in.