Have you tried naming your routes and then test like $response = $this->get(route('route_name'));?
P.S: Naming your routes can save you a lot of head-bangs ;)
Hi,
I'm working a new Laravel project at work. We are going to use Jetstream for authentication.
We are going to have a multi tennant application. The User modal will have to login on "https://admin.example.com/login". The participants on "https://www.example.com/login" with a Participant model
Howver the view of the admin login and public login is different. That can be done in the FortifyServiceProvider.
In the FortifyServiceProvider I want to check which domain is visited and do
dd(\Illuminate\Support\Facades\Request::getHost());
When I surf to "https://admin.example.test" I do get "admin.example.test" as expected. Also when I surf to "https://example.test" I get "example.test"
So that is working all as should.
However I am going to use TDD to create further my website. So in my pest test i want to check if the view is correct.
When i do
get('https://admin.example.com/login')
->assertViewIs('admin.auth.login');
Still with the dd in my FortifyServiceProvider I get "example.test" as output instead of "admin.example.test"
I've been using numerous other options but all still gives me "example.test"
$response = $this->call('GET', 'https://admin.example.test/login', [], [], [], [
'HTTP_HOST' => 'admin.example.test',
]);
$response = $this->withHeaders([
'Host' => 'admin.example.test',
])->get('https://admin.example.test/login');
$response = $this->call('GET', '/login', [], [], [], [
'SERVER_NAME' => 'admin.example.test',
]);
Any help on pointing me in the correct direction would be appreciated.
Please or to participate in this conversation.