create(); $ticket = Ticket::factory()->create(); $this->actingAs($user) ->post(route('helpdesk.tickets.time-logs.store', $ticket), [ 'minutes' => 45, 'description' => 'Investigated the issue and updated the ticket.', ]) ->assertRedirect(); $this->assertDatabaseHas('helpdesk_time_logs', [ 'ticket_id' => $ticket->id, 'user_id' => $user->id, 'minutes' => 45, 'description' => 'Investigated the issue and updated the ticket.', ]); } /** * It rejects invalid logged minutes. */ public function test_ticket_time_log_requires_valid_minutes(): void { $user = User::factory()->create(); $ticket = Ticket::factory()->create(); $this->actingAs($user) ->from(route('helpdesk.tickets.show', $ticket)) ->post(route('helpdesk.tickets.time-logs.store', $ticket), [ 'minutes' => 0, ]) ->assertRedirect(route('helpdesk.tickets.show', $ticket)) ->assertSessionHasErrors('minutes'); } }