createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a series is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testSeriesDeletedSendsDiscordNotification(): void { $series = Series::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(SeriesDeleted::class); $series->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a series is restored, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testSeriesRestoredSendsDiscordNotification(): void { $series = Series::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(SeriesRestored::class); $series->restore(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a series is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testSeriesUpdatedSendsDiscordNotification(): void { $series = Series::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(SeriesUpdated::class); $changes = Series::factory()->makeOne(); $series->fill($changes->getAttributes()); $series->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); } }