create(['name' => 'Op', 'email' => 'op@example.com', 'roles' => ['operator']]); $ticket = makeTicket(); $id = $ticket->id; $ticket->delete(); $this->actingAs($operator) ->get("/operator/tickets/{$id}") ->assertRedirect(route('operator.queue')); }); test('visiting a deleted ticket as a client redirects to the client dashboard instead of 404ing', function () { seedStatusesAndPriorities(); $client = User::query()->create(['name' => 'Klient', 'email' => 'klient@example.com', 'roles' => ['client']]); $ticket = makeTicket(['customer_id' => $client->id]); $id = $ticket->id; $ticket->delete(); $this->actingAs($client) ->get("/client/tickets/{$id}") ->assertRedirect(route('client.dashboard')); }); test('a guest hitting a non-existent ticket route still gets the normal (non-redirected) handling', function () { $this->get('/operator/tickets/999999')->assertRedirect(route('login')); });