mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 14:09:43 -08:00
27 lines
748 B
PHP
27 lines
748 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) {
|
|
return $notifiable->routes['slack'] === Setting::getSettings()->webhook_endpoint;
|
|
}
|
|
);
|
|
}
|
|
|
|
public function assertNoSlackNotificationSent(string $notificationClass)
|
|
{
|
|
Notification::assertNotSentTo(new AnonymousNotifiable, $notificationClass);
|
|
}
|
|
}
|