for(Anime::factory()) ->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Http::fake(); Event::fakeExcept(DiscordThreadDeleted::class); $thread->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a thread is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testThreadUpdatedSendsDiscordNotification(): void { $thread = DiscordThread::factory() ->for(Anime::factory()) ->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Http::fake(); Event::fakeExcept(DiscordThreadUpdated::class); $changes = DiscordThread::factory() ->for(Anime::factory()) ->makeOne(); $thread->fill($changes->getAttributes()); $thread->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); } }