Neon Tsunami

A blog on Laravel & Rails

By Dwight Conrad Watson

While upgrading my app from to Laravel 5.4 and replacing my "BrowserKit" style tests with the new evolution TestCase I ran into some trouble testing routes that came through on subdomains. The tests that used to pass would now 404. Previously, I used this at the top of a test case to set the base URL (my API endpoint) so that the tests would run off it.

 * The base URL to use while testing the application.
 * @var string
protected $baseUrl = '';

However it seems Laravel 5.4 doesn't look for a baseUrl property and instead relies on the app.url configuration. Luckily, this is easy to change out on the fly in your tests, even in the setUp method.

function setUp()

    config(['app.url' => '']);
← See more posts