withWebhookEnabled()->create(); event(new CheckoutableCheckedOut( Consumable::factory()->cardstock()->create(), User::factory()->create(), User::factory()->superuser()->create(), '' )); Notification::assertSentTo( new AnonymousNotifiable, CheckoutConsumableNotification::class, function ($notification, $channels, $notifiable) { return $notifiable->routes['slack'] === Setting::getSettings()->webhook_endpoint; } ); } public function testWebhookNotificationsAreNotSentOnConsumableCheckoutWhenWebhookSettingNotEnabled() { Notification::fake(); Setting::factory()->withWebhookDisabled()->create(); event(new CheckoutableCheckedOut( Consumable::factory()->cardstock()->create(), User::factory()->create(), User::factory()->superuser()->create(), '' )); Notification::assertNotSentTo(new AnonymousNotifiable, CheckoutConsumableNotification::class); } }