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:
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user