mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-16 02:24:09 -08:00
28 lines
783 B
PHP
28 lines
783 B
PHP
<?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) {
|
|
dd($notification);
|
|
return $notifiable->routes['slack'] === Setting::getSettings()->webhook_endpoint;
|
|
}
|
|
);
|
|
}
|
|
|
|
public function assertNoSlackNotificationSent(string $notificationClass)
|
|
{
|
|
Notification::assertNotSentTo(new AnonymousNotifiable, $notificationClass);
|
|
}
|
|
}
|