createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a feature is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testFeatureDeletedSendsDiscordNotification(): void { $feature = FeatureModel::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(FeatureDeleted::class); $feature->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a feature is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testFeatureUpdatedSendsDiscordNotification(): void { $feature = FeatureModel::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(FeatureUpdated::class); $feature->update([ FeatureModel::ATTRIBUTE_VALUE => ! $feature->value, ]); Bus::assertDispatched(SendDiscordNotificationJob::class); } }