Skip to content

Commit 3cb216e

Browse files
committed
adding tests
adding tests for the methods: makePriorityAsHigh() makePriorityAsNormal() makePriorityAsLow() and scopes: archived() unArchived()
1 parent c231aa3 commit 3cb216e

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

tests/Feature/TicketTest.php

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@
1616
'status' => 'closed',
1717
]);
1818

19-
$this->assertEquals(Ticket::count(), 10);
19+
Ticket::factory()
20+
->times(6)
21+
->create([
22+
'status' => 'archived',
23+
]);
24+
25+
$this->assertEquals(Ticket::count(), 16);
2026
$this->assertEquals(Ticket::opened()->count(), 3);
2127
$this->assertEquals(Ticket::closed()->count(), 7);
28+
$this->assertEquals(Ticket::archived()->count(), 6);
29+
$this->assertEquals(Ticket::unArchived()->count(), 10);
2230
});
2331

2432
it('filters tickets by resolved status', function () {
@@ -271,3 +279,33 @@
271279
expect($ticket->assigned_to)
272280
->toBe($agentUser->id);
273281
});
282+
283+
it('can mark a ticket priority as low', function () {
284+
$ticket = Ticket::factory()->create([
285+
'priority' => 'high',
286+
]);
287+
288+
$ticket->makePriorityAsLow();
289+
290+
$this->assertEquals($ticket->priority, 'low');
291+
});
292+
293+
it('can mark a ticket priority as normal', function () {
294+
$ticket = Ticket::factory()->create([
295+
'priority' => 'high',
296+
]);
297+
298+
$ticket->makePriorityAsNormal();
299+
300+
$this->assertEquals($ticket->priority, 'normal');
301+
});
302+
303+
it('can mark a ticket priority as high', function () {
304+
$ticket = Ticket::factory()->create([
305+
'priority' => 'low',
306+
]);
307+
308+
$ticket->makePriorityAsHigh();
309+
310+
$this->assertEquals($ticket->priority, 'high');
311+
});

0 commit comments

Comments
 (0)