createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); }); test('resource deleted sends discord notification', function (): void { $resource = ExternalResource::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(ExternalResourceDeleted::class); $resource->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); }); test('resource restored sends discord notification', function (): void { $resource = ExternalResource::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(ExternalResourceRestored::class); $resource->restore(); Bus::assertDispatched(SendDiscordNotificationJob::class); }); test('resource updated sends discord notification', function (): void { $resource = ExternalResource::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(ExternalResourceUpdated::class); $changes = ExternalResource::factory()->makeOne(); $resource->fill($changes->getAttributes()); $resource->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); });