diff --git a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php index adaede07ec..b2fb4b3828 100644 --- a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php +++ b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckinTest.php @@ -2,6 +2,8 @@ namespace Tests\Feature\Notifications\Webhooks; +use App\Models\AssetModel; +use App\Models\Category; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; use App\Events\CheckoutableCheckedIn; @@ -95,6 +97,22 @@ class SlackNotificationsUponCheckinTest extends TestCase $this->assertNoSlackNotificationSent(CheckinAssetNotification::class); } + public function testSlackNotificationIsStillSentWhenCategoryEmailIsNotSetToSendEmails() + { + $this->settings->enableSlackWebhook(); + + $category = Category::factory()->create(['checkin_email' => false]); + $assetModel = AssetModel::factory()->create(['category_id' => $category->id]); + $asset = Asset::factory()->assignedToUser()->create(['model_id' => $assetModel->id]); + + $this->fireCheckInEvent( + $asset, + User::factory()->create(), + ); + + $this->assertSlackNotificationSent(CheckinAssetNotification::class); + } + public function testComponentCheckinDoesNotSendSlackNotification() { $this->settings->enableSlackWebhook(); diff --git a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php index 4f34da2857..b9f8fb6523 100644 --- a/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php +++ b/tests/Feature/Notifications/Webhooks/SlackNotificationsUponCheckoutTest.php @@ -2,6 +2,8 @@ namespace Tests\Feature\Notifications\Webhooks; +use App\Models\AssetModel; +use App\Models\Category; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; use App\Events\CheckoutableCheckedOut; @@ -97,6 +99,22 @@ class SlackNotificationsUponCheckoutTest extends TestCase $this->assertNoSlackNotificationSent(CheckoutAssetNotification::class); } + public function testSlackNotificationIsStillSentWhenCategoryEmailIsNotSetToSendEmails() + { + $this->settings->enableSlackWebhook(); + + $category = Category::factory()->create(['checkin_email' => false]); + $assetModel = AssetModel::factory()->create(['category_id' => $category->id]); + $asset = Asset::factory()->create(['model_id' => $assetModel->id]); + + $this->fireCheckOutEvent( + $asset, + User::factory()->create(), + ); + + $this->assertSlackNotificationSent(CheckoutAssetNotification::class); + } + public function testComponentCheckoutDoesNotSendSlackNotification() { $this->settings->enableSlackWebhook();