File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed
Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 2424});
2525
2626it ('gets categories by visibility status ' , function () {
27- $ categories = Category::factory ()->times (10 )->create ([
27+ Category::factory ()->times (10 )->create ([
2828 'is_visible ' => true ,
2929 ]);
3030
Original file line number Diff line number Diff line change 11<?php
2+
3+ use Coderflex \LaravelTicket \Models \Label ;
4+ use Coderflex \LaravelTicket \Models \Ticket ;
5+
6+ it ('can attach category to a ticket ' , function () {
7+ $ label = Label::factory ()->create ();
8+ $ ticket = Ticket::factory ()->create ();
9+
10+ $ label ->tickets ()->attach ($ ticket );
11+
12+ $ this ->assertEquals ($ label ->tickets ->count (), 1 );
13+ });
14+
15+ it ('can deattach category to a ticket ' , function () {
16+ $ label = Label::factory ()->create ();
17+ $ ticket = Ticket::factory ()->create ();
18+
19+ $ ticket ->attachLabels ($ label );
20+
21+ $ label ->tickets ()->detach ($ ticket );
22+
23+ $ this ->assertEquals ($ label ->tickets ->count (), 0 );
24+ });
25+
26+ it ('gets categories by visibility status ' , function () {
27+ Label::factory ()->times (7 )->create ([
28+ 'is_visible ' => true ,
29+ ]);
30+
31+ Label::factory ()->times (6 )->create ([
32+ 'is_visible ' => false ,
33+ ]);
34+
35+ $ this ->assertEquals (Label::count (), 13 );
36+ $ this ->assertEquals (Label::visible ()->count (), 7 );
37+ $ this ->assertEquals (Label::hidden ()->count (), 6 );
38+ });
You can’t perform that action at this time.
0 commit comments