proper closer status
This commit is contained in:
@@ -222,6 +222,66 @@ final class TicketConversationTest extends TestCase
|
||||
self::assertSame($fixtures['high']->id, $ticket->priority_id);
|
||||
}
|
||||
|
||||
public function test_closing_ticket_requires_a_closure_comment(): void
|
||||
{
|
||||
$fixtures = $this->seedLookupData();
|
||||
$owner = $this->user();
|
||||
$agent = $this->agent();
|
||||
$ticket = $this->ticket([
|
||||
'owner' => $owner,
|
||||
'agent' => $agent,
|
||||
'status_id' => $fixtures['open']->id,
|
||||
'priority_id' => $fixtures['normal']->id,
|
||||
]);
|
||||
|
||||
$this->actingAs($agent)
|
||||
->from(route('helpdesk.tickets.show', $ticket))
|
||||
->post(route('helpdesk.tickets.status.update', $ticket), [
|
||||
'status_id' => $fixtures['closed']->id,
|
||||
])
|
||||
->assertRedirect(route('helpdesk.tickets.show', $ticket))
|
||||
->assertSessionHasErrors('closure_comment');
|
||||
|
||||
$ticket->refresh();
|
||||
|
||||
self::assertSame($fixtures['open']->id, $ticket->status_id);
|
||||
self::assertNull($ticket->completed_at);
|
||||
}
|
||||
|
||||
public function test_closing_ticket_creates_a_closure_comment(): void
|
||||
{
|
||||
$fixtures = $this->seedLookupData();
|
||||
$owner = $this->user();
|
||||
$agent = $this->agent();
|
||||
$ticket = $this->ticket([
|
||||
'owner' => $owner,
|
||||
'agent' => $agent,
|
||||
'status_id' => $fixtures['open']->id,
|
||||
'priority_id' => $fixtures['normal']->id,
|
||||
]);
|
||||
|
||||
$this->actingAs($agent)
|
||||
->post(route('helpdesk.tickets.status.update', $ticket), [
|
||||
'status_id' => $fixtures['closed']->id,
|
||||
'closure_comment' => 'Issue resolved and verified before closure.',
|
||||
'closure_internal' => '0',
|
||||
])
|
||||
->assertRedirect(route('helpdesk.tickets.show', $ticket));
|
||||
|
||||
$ticket->refresh();
|
||||
|
||||
self::assertSame($fixtures['closed']->id, $ticket->status_id);
|
||||
self::assertNotNull($ticket->completed_at);
|
||||
|
||||
$this->assertDatabaseHas('helpdesk_comments', [
|
||||
'ticket_id' => $ticket->id,
|
||||
'user_id' => $agent->id,
|
||||
'subject' => 'Closure comment',
|
||||
'body' => 'Issue resolved and verified before closure.',
|
||||
'is_internal' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_unassigned_agent_cannot_update_another_users_ticket(): void
|
||||
{
|
||||
$fixtures = $this->seedLookupData();
|
||||
|
||||
Reference in New Issue
Block a user