createOne(); $image = Image::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(StudioImageCreated::class); $studio->images()->attach($image); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a Studio is detached from an Image or vice versa, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testStudioImageDeletedSendsDiscordNotification(): void { $studio = Studio::factory()->createOne(); $image = Image::factory()->createOne(); $studio->images()->attach($image); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(StudioImageDeleted::class); $studio->images()->detach($image); Bus::assertDispatched(SendDiscordNotificationJob::class); } }