createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a video is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testVideoDeletedSendsDiscordNotification(): void { $video = Video::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(VideoDeleted::class); $video->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a video is restored, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testVideoRestoredSendsDiscordNotification(): void { $video = Video::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(VideoRestored::class); $video->restore(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a video is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testVideoUpdatedSendsDiscordNotification(): void { $video = Video::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(VideoUpdated::class); $changes = Video::factory()->makeOne(); $video->fill($changes->getAttributes()); $video->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); } }