This commit is contained in:
Godfrey M 2024-10-17 14:56:58 -07:00
parent 7ae76e7db9
commit ff113ef523
3 changed files with 4 additions and 2 deletions

View file

@ -6,6 +6,7 @@ use App\Models\LicenseSeat;
use App\Models\Setting; use App\Models\Setting;
use App\Models\User; use App\Models\User;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Channels\SlackWebhookChannel;
use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification; use Illuminate\Notifications\Notification;
@ -58,7 +59,7 @@ class CheckinLicenseSeatNotification extends Notification
} }
if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) { if (Setting::getSettings()->webhook_selected == 'slack' || Setting::getSettings()->webhook_selected == 'general' ) {
$notifyBy[] = 'slack'; $notifyBy[] = SlackWebhookChannel::class;
} }
return $notifyBy; return $notifyBy;

View file

@ -170,7 +170,7 @@ class AccessoryCheckoutTest extends TestCase
'checkout_to_type' => 'user', 'checkout_to_type' => 'user',
]); ]);
Mail::assertNotSent(CheckoutAccessoryMail::class, function ($mail) use ($user) { Mail::assertSent(CheckoutAccessoryMail::class, function ($mail) use ($user) {
return $mail->hasTo($user->email); return $mail->hasTo($user->email);
}); });
} }

View file

@ -14,6 +14,7 @@ trait AssertsAgainstSlackNotifications
new AnonymousNotifiable, new AnonymousNotifiable,
$notificationClass, $notificationClass,
function ($notification, $channels, $notifiable) { function ($notification, $channels, $notifiable) {
dd($notification);
return $notifiable->routes['slack'] === Setting::getSettings()->webhook_endpoint; return $notifiable->routes['slack'] === Setting::getSettings()->webhook_endpoint;
} }
); );