createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When an audio is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testAudioDeletedSendsDiscordNotification(): void { $audio = Audio::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(AudioDeleted::class); $audio->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When an audio is restored, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testAudioRestoredSendsDiscordNotification(): void { $audio = Audio::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(AudioRestored::class); $audio->restore(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When an audio is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testAudioUpdatedSendsDiscordNotification(): void { $audio = Audio::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(AudioUpdated::class); $changes = Audio::factory()->makeOne(); $audio->fill($changes->getAttributes()); $audio->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); } }