albertcht / lumen-testing

A testing suite for Lumen like Laravel does.
MIT License
43 stars 24 forks source link

use configured baseUrl instead of app url #5

Closed stevethomas closed 6 years ago

stevethomas commented 6 years ago

Lumen reads the $baseUrl from Laravel\Lumen\Testing\TestCase rather than from the config.

With the change I made, you can set a baseUrl like protected $baseUrl = 'http://localhost/v2'; rather than prefixing every URL with "v2", which is pretty handy.

https://github.com/laravel/lumen-framework/blob/5.6/src/Testing/Concerns/MakesHttpRequests.php#L358

stevethomas commented 6 years ago

on second thoughts, maybe you want to do it the Laravel way to keep maximum compatibility?

Seems Laravel $baseUrl diverged some time ago and prefers config(['app.url' => 'foo']) in setUp().

Unfortunate that the frameworks do this differently.

https://stackoverflow.com/questions/45381501/change-of-baseurl-for-phpunit-in-laravel-5-4

albertcht commented 6 years ago

Hi @stevethomas ,

Sorry for the late reply and thanks for your pull request, I decide to keep them both in the end.

https://github.com/albertcht/lumen-testing/commit/056c2187753edde5d28831841c4f875a092fa3f1