createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a setting is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testSettingDeletedSendsDiscordNotification(): void { $setting = Setting::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(SettingDeleted::class); $setting->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a setting is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testSettingUpdatedSendsDiscordNotification(): void { $setting = Setting::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(SettingUpdated::class); $changes = Setting::factory()->makeOne(); $setting->fill($changes->getAttributes()); $setting->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); } }