2024-02-27 18:01:08 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Support;
|
|
|
|
|
|
|
|
use App\Models\Setting;
|
|
|
|
use Illuminate\Notifications\AnonymousNotifiable;
|
|
|
|
use Illuminate\Support\Facades\Notification;
|
|
|
|
|
|
|
|
trait AssertsAgainstSlackNotifications
|
|
|
|
{
|
|
|
|
public function assertSlackNotificationSent(string $notificationClass)
|
|
|
|
{
|
|
|
|
Notification::assertSentTo(
|
|
|
|
new AnonymousNotifiable,
|
|
|
|
$notificationClass,
|
|
|
|
function ($notification, $channels, $notifiable) {
|
2024-10-17 14:56:58 -07:00
|
|
|
dd($notification);
|
2024-02-27 18:01:08 -08:00
|
|
|
return $notifiable->routes['slack'] === Setting::getSettings()->webhook_endpoint;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function assertNoSlackNotificationSent(string $notificationClass)
|
|
|
|
{
|
|
|
|
Notification::assertNotSentTo(new AnonymousNotifiable, $notificationClass);
|
|
|
|
}
|
|
|
|
}
|