admin()->create(); $admin->refresh(); // The base path is handled by Horizon (not a redirect) and renders the SPA. $this->actingAs($admin) ->get('/'.$path) ->assertOk() ->assertSee('Horizon', false); }); it('serves the Horizon dashboard at the /dashboard subpath for an admin', function () { $path = config('horizon.path'); $admin = User::factory()->admin()->create(); $admin->refresh(); $this->actingAs($admin) ->get('/'.$path.'/dashboard') ->assertOk(); }); it('does not allow a non-admin to access the Horizon dashboard', function () { $user = User::factory()->create(['is_admin' => false]); $user->refresh(); // Horizon's authorization gate (viewHorizon) forbids non-admins. $this->actingAs($user) ->get('/'.config('horizon.path')) ->assertForbidden(); });