File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
tests/Feature/Livewire/Pages/Discussion Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 2
2
3
3
declare (strict_types=1 );
4
4
5
+ use App \Actions \Discussion \CreateDiscussionAction ;
6
+ use App \Data \CreateDiscussionData ;
5
7
use App \Gamify \Points \DiscussionCreated ;
6
8
use App \Livewire \Pages \Discussions \SingleDiscussion ;
7
9
use App \Models \Discussion ;
8
10
use App \Models \Tag ;
11
+ use Illuminate \Support \Facades \Notification ;
9
12
use Livewire \Livewire ;
10
13
14
+
15
+ beforeEach (function (): void {
16
+ Notification::fake ();
17
+ });
18
+
19
+
11
20
it ('delete user action can remove discussion point ' , function (): void {
12
21
$ user = $ this ->login ();
13
- $ discussion = Discussion::factory ()->create (['user_id ' => $ user ->id ]);
14
- $ tags = Tag::factory ()->count (3 )->create ();
15
-
16
- $ discussion ->tags ()->attach ($ tags ->modelKeys ());
22
+ $ discussionData = CreateDiscussionData::from ([
23
+ 'title ' => 'Discussion title ' ,
24
+ 'body ' => 'Discussion body ' ,
25
+ 'tags ' => [],
26
+ ]);
17
27
18
- givePoint ( new DiscussionCreated ( $ discussion) );
28
+ $ discussion = app (CreateDiscussionAction::class)-> execute ( $ discussionData );
19
29
20
30
Livewire::test (SingleDiscussion::class, ['discussion ' => $ discussion ])
21
31
->callAction ('deleteAction ' )
You can’t perform that action at this time.
0 commit comments