createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a studio is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testStudioDeletedSendsDiscordNotification(): void { $studio = Studio::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(StudioDeleted::class); $studio->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a studio is restored, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testStudioRestoredSendsDiscordNotification(): void { $studio = Studio::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(StudioRestored::class); $studio->restore(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a studio is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testStudioUpdatedSendsDiscordNotification(): void { $studio = Studio::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(StudioUpdated::class); $changes = Studio::factory()->makeOne(); $studio->fill($changes->getAttributes()); $studio->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); } }