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