createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a group is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testGroupDeletedSendsDiscordNotification(): void { $group = Group::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(GroupDeleted::class); $group->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a group is restored, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testGroupRestoredSendsDiscordNotification(): void { $group = Group::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(GroupRestored::class); $group->restore(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a group is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testGroupUpdatedSendsDiscordNotification(): void { $group = Group::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(GroupUpdated::class); $changes = Group::factory()->makeOne(); $group->fill($changes->getAttributes()); $group->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); } }