#Does inertia's test helper make an actual http request?

1 messages · Page 1 of 1 (latest)

acoustic bloom
#

Test failing because auth user is null.

acoustic bloom
#

Does inertia's test helper make an actual http request?

acoustic bloom
#

I have a global scope that filters models based on the auth()->user()?->tenant_id. It is applied via a trait. This works fine when tested manually.

The issue is, I have a test that asserts that data from other tenants is filtered out. When I apply the filter on the query manually in the controller, the test passes. I.e I add to the query

->when($tenantId = auth()->user()?->tenant_id, fn ($query) =>
  $query->where('tenant_id', $tenantId)
)

What would be the correct way to test this functionality if the assertInertia method does not fetch the data from the controller via real http request?