get('/_admin-only-test', function () { return 'ok'; }); } public function test_guest_is_redirected_to_login(): void { $this->get('/_admin-only-test')->assertRedirect('/login'); } public function test_customer_is_redirected_to_customer_portal(): void { $user = \Mockery::mock(User::class)->makePartial(); $user->shouldReceive('isCustomer')->andReturn(true); $this->be($user); $this->get('/_admin-only-test')->assertRedirect('/customer-portal'); } public function test_admin_passes_through(): void { $user = User::factory()->create(); if (method_exists($user, 'assignRole')) { $user->assignRole('admin'); } $this->actingAs($user); $this->get('/_admin-only-test')->assertOk(); } }