Skip to content

Commit 6aeb3e1

Browse files
committed
Tests of ticket edition access
1 parent c24b343 commit 6aeb3e1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/Feature/TicketsTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function testTicketCreate()
8181
/*
8282
* Access a Ticket Card
8383
*/
84-
public function testTicketShow()
84+
public function testTicketShowEdit()
8585
{
8686
$this->load_vars();
8787

@@ -93,6 +93,8 @@ public function testTicketShow()
9393
$ticket = $ticket->notHidden()->first();
9494
$response = $this->actingAs($this->member)->get(route($this->main_route . '.show', ['id' => $ticket->id]));
9595
$response->assertStatus(200);
96+
$response = $this->actingAs($this->member)->get(route($this->main_route . '.edit', ['id' => $ticket->id]));
97+
$response->assertStatus(302);
9698

9799
// Hidden ticket without $this->member in notifications
98100
$ticket = clone $this->member_tickets_builder;
@@ -105,15 +107,19 @@ public function testTicketShow()
105107
if(!is_null($ticket)){
106108
$response = $this->actingAs($this->member)->get(route($this->main_route . '.show', ['id' => $ticket->id]));
107109
$response->assertStatus(302);
110+
$response = $this->actingAs($this->member)->get(route($this->main_route . '.edit', ['id' => $ticket->id]));
111+
$response->assertStatus(302);
108112
}
109113
}
110114

111-
// Agent access
115+
// Agent access to assigned ticket
112116
if(!is_null($this->agent)){
113117
$ticket = $this->agent->agentTickets()->inRandomOrder()->first();
114118

115119
$response = $this->actingAs($this->agent)->get(route($this->main_route . '.show', ['id' => $ticket->id]));
116120
$response->assertStatus(200);
121+
$response = $this->actingAs($this->agent)->get(route($this->main_route . '.edit', ['id' => $ticket->id]));
122+
$response->assertStatus(200);
117123
}
118124

119125
// Admin access
@@ -127,6 +133,8 @@ public function testTicketShow()
127133
if (!is_null($ticket)){
128134
$response = $this->actingAs($this->admin)->get(route($this->main_route . '.show', ['id' => $ticket->id]));
129135
$response->assertStatus(200);
136+
$response = $this->actingAs($this->admin)->get(route($this->main_route . '.edit', ['id' => $ticket->id]));
137+
$response->assertStatus(200);
130138
}
131139

132140
// Active ticket
@@ -136,6 +144,8 @@ public function testTicketShow()
136144
if (!is_null($ticket)){
137145
$response = $this->actingAs($this->admin)->get(route($this->main_route . '.show', ['id' => $ticket->id]));
138146
$response->assertStatus(200);
147+
$response = $this->actingAs($this->admin)->get(route($this->main_route . '.edit', ['id' => $ticket->id]));
148+
$response->assertStatus(200);
139149
}
140150

141151
// Complete ticket
@@ -145,6 +155,8 @@ public function testTicketShow()
145155
if (!is_null($ticket)){
146156
$response = $this->actingAs($this->admin)->get(route($this->main_route . '.show', ['id' => $ticket->id]));
147157
$response->assertStatus(200);
158+
$response = $this->actingAs($this->admin)->get(route($this->main_route . '.edit', ['id' => $ticket->id]));
159+
$response->assertStatus(200);
148160
}
149161
}
150162
}

0 commit comments

Comments
 (0)