createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When an artist is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testArtistDeletedSendsDiscordNotification(): void { $artist = Artist::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(ArtistDeleted::class); $artist->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When an artist is restored, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testArtistRestoredSendsDiscordNotification(): void { $artist = Artist::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(ArtistRestored::class); $artist->restore(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When an artist is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testArtistUpdatedSendsDiscordNotification(): void { $artist = Artist::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(ArtistUpdated::class); $changes = Artist::factory()->makeOne(); $artist->fill($changes->getAttributes()); $artist->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); } }