createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a playlist is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testPlaylistDeletedSendsDiscordNotification(): void { $playlist = Playlist::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(PlaylistDeleted::class); $playlist->delete(); Bus::assertNotDispatched(SendDiscordNotificationJob::class); } /** * When a playlist is restored, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testPlaylistRestoredSendsDiscordNotification(): void { $playlist = Playlist::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(PlaylistRestored::class); $playlist->restore(); Bus::assertNotDispatched(SendDiscordNotificationJob::class); } /** * When a playlist is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testPlaylistUpdatedSendsDiscordNotification(): void { $playlist = Playlist::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(PlaylistUpdated::class); $changes = Playlist::factory()->makeOne(); $playlist->fill($changes->getAttributes()); $playlist->save(); Bus::assertNotDispatched(SendDiscordNotificationJob::class); } }