mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-05-03 16:24:55 +00:00
27 lines
839 B
PHP
27 lines
839 B
PHP
<?php
|
|
|
|
use App\Models\Meetup;
|
|
use App\Models\User;
|
|
use App\Notifications\ModelCreatedNotification;
|
|
use Illuminate\Support\Facades\Notification;
|
|
|
|
it('sends a queued mail notification for a created model', function () {
|
|
Notification::fake();
|
|
|
|
$user = User::factory()->create();
|
|
$meetup = Meetup::factory()->create();
|
|
|
|
$user->notify(new ModelCreatedNotification($meetup, 'meetups'));
|
|
|
|
Notification::assertSentTo($user, ModelCreatedNotification::class, function ($notification) use ($meetup) {
|
|
return $notification->model->is($meetup) && $notification->resource === 'meetups';
|
|
});
|
|
});
|
|
|
|
it('uses the mail channel', function () {
|
|
$user = User::factory()->create();
|
|
$notification = new ModelCreatedNotification(User::factory()->make(), 'users');
|
|
|
|
expect($notification->via($user))->toBe(['mail']);
|
|
});
|