Files
relaticle-comments/tests/Feature/UserMentionedEventTest.php
manukminasyan 29fcbd8aec feat: initial release of relaticle/comments
Filament comments package with:
- Polymorphic commenting on any Eloquent model
- Threaded replies with configurable depth
- @mentions with autocomplete and user search
- Emoji reactions with toggle and who-reacted tooltips
- File attachments via Livewire uploads
- Reply and mention notifications via Filament notification system
- Thread subscriptions for notification control
- Real-time broadcasting (opt-in Echo) with polling fallback
- Dark mode support
- CommentsAction, CommentsTableAction, CommentsEntry for Filament integration
- 204 tests, 421 assertions
2026-03-26 23:02:56 +04:00

26 lines
820 B
PHP

<?php
use Relaticle\Comments\Comment;
use Relaticle\Comments\Events\UserMentioned;
use Relaticle\Comments\Tests\Models\Post;
use Relaticle\Comments\Tests\Models\User;
it('carries correct comment and mentioned user in payload', function () {
$user = User::factory()->create();
$mentionedUser = User::factory()->create(['name' => 'john']);
$post = Post::factory()->create();
$comment = Comment::factory()->create([
'commentable_id' => $post->id,
'commentable_type' => $post->getMorphClass(),
'user_id' => $user->getKey(),
'user_type' => $user->getMorphClass(),
'body' => '<p>@john</p>',
]);
$event = new UserMentioned($comment, $mentionedUser);
expect($event->comment)->toBe($comment)
->and($event->mentionedUser)->toBe($mentionedUser);
});