2023-04-18 13:07:55 -07:00
|
|
|
<?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;
|
|
|
|
|
2024-02-27 16:48:17 -08:00
|
|
|
class ComponentSlackTest extends TestCase
|
2023-04-18 13:07:55 -07:00
|
|
|
{
|
|
|
|
|
|
|
|
use InteractsWithSettings;
|
|
|
|
|
2024-02-27 16:48:17 -08:00
|
|
|
public function testComponentCheckoutDoesNotSendSlackNotification()
|
2023-04-18 13:07:55 -07:00
|
|
|
{
|
|
|
|
Notification::fake();
|
|
|
|
|
2024-02-14 18:17:34 -08:00
|
|
|
$this->settings->enableSlackWebhook();
|
2023-04-18 13:07:55 -07:00
|
|
|
|
|
|
|
event(new CheckoutableCheckedOut(
|
|
|
|
Component::factory()->ramCrucial8()->create(),
|
|
|
|
Asset::factory()->laptopMbp()->create(),
|
|
|
|
User::factory()->superuser()->create(),
|
|
|
|
''
|
|
|
|
));
|
|
|
|
|
|
|
|
Notification::assertNothingSent();
|
|
|
|
}
|
|
|
|
|
2024-02-27 16:48:17 -08:00
|
|
|
public function testComponentCheckinDoesNotSendSlackNotification()
|
2023-04-18 13:07:55 -07:00
|
|
|
{
|
|
|
|
Notification::fake();
|
|
|
|
|
2024-02-14 18:17:34 -08:00
|
|
|
$this->settings->enableSlackWebhook();
|
2023-04-18 13:07:55 -07:00
|
|
|
|
|
|
|
event(new CheckoutableCheckedIn(
|
|
|
|
Component::factory()->ramCrucial8()->create(),
|
|
|
|
Asset::factory()->laptopMbp()->create(),
|
|
|
|
User::factory()->superuser()->create(),
|
|
|
|
''
|
|
|
|
));
|
|
|
|
|
|
|
|
Notification::assertNothingSent();
|
|
|
|
}
|
|
|
|
}
|