3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-02-05 23:35:54 +00:00

Add failing tests

This commit is contained in:
Marcus Moore
2025-05-13 14:12:51 -07:00
parent ac6d964e28
commit e4bfabfabe
2 changed files with 36 additions and 0 deletions

View File

@ -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();

View File

@ -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();