create(); $mentionedUser = User::factory()->create(['name' => 'john']); $post = Post::factory()->create(); $comment = Comment::factory()->create([ 'commentable_id' => $post->id, 'commentable_type' => $post->getMorphClass(), 'commenter_id' => $user->getKey(), 'commenter_type' => $user->getMorphClass(), 'body' => '
@john
', ]); $event = new UserMentioned($comment, $mentionedUser); expect($event->comment)->toBe($comment) ->and($event->mentionedUser)->toBe($mentionedUser); });