snipe-it/tests/Feature/Notifications/ComponentWebhookTest.php
2024-02-14 18:17:34 -08:00

51 lines
1.2 KiB
PHP

<?php
namespace Tests\Feature\Notifications;
use App\Events\CheckoutableCheckedIn;
use App\Events\CheckoutableCheckedOut;
use App\Models\Asset;
use App\Models\Component;
use App\Models\User;
use Illuminate\Support\Facades\Notification;
use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
class ComponentWebhookTest extends TestCase
{
use InteractsWithSettings;
public function testComponentCheckoutDoesNotSendWebhookNotification()
{
Notification::fake();
$this->settings->enableSlackWebhook();
event(new CheckoutableCheckedOut(
Component::factory()->ramCrucial8()->create(),
Asset::factory()->laptopMbp()->create(),
User::factory()->superuser()->create(),
''
));
Notification::assertNothingSent();
}
public function testComponentCheckinDoesNotSendWebhookNotification()
{
Notification::fake();
$this->settings->enableSlackWebhook();
event(new CheckoutableCheckedIn(
Component::factory()->ramCrucial8()->create(),
Asset::factory()->laptopMbp()->create(),
User::factory()->superuser()->create(),
''
));
Notification::assertNothingSent();
}
}