createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a dump is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testDumpDeletedSendsDiscordNotification(): void { $dump = Dump::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(DumpDeleted::class); $dump->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a dump is restored, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testDumpRestoredSendsDiscordNotification(): void { $dump = Dump::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(DumpRestored::class); $dump->restore(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a dump is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testDumpUpdatedSendsDiscordNotification(): void { $dump = Dump::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(DumpUpdated::class); $changes = Dump::factory()->makeOne(); $dump->fill($changes->getAttributes()); $dump->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); } }