createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a featured theme is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testFeaturedThemeDeletedSendsDiscordNotification(): void { $featuredTheme = FeaturedTheme::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(FeaturedThemeDeleted::class); $featuredTheme->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a featured theme is restored, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testFeaturedThemeRestoredSendsDiscordNotification(): void { $featuredTheme = FeaturedTheme::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(FeaturedThemeRestored::class); $featuredTheme->restore(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a featured theme is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testFeaturedThemeUpdatedSendsDiscordNotification(): void { $featuredTheme = FeaturedTheme::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(FeaturedThemeUpdated::class); $changes = FeaturedTheme::factory()->makeOne(); $featuredTheme->fill($changes->getAttributes()); $featuredTheme->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); } }