createOne(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a page is deleted, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testPageDeletedSendsDiscordNotification(): void { $page = Page::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(PageDeleted::class); $page->delete(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a page is restored, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testPageRestoredSendsDiscordNotification(): void { $page = Page::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(PageRestored::class); $page->restore(); Bus::assertDispatched(SendDiscordNotificationJob::class); } /** * When a page is updated, a SendDiscordNotification job shall be dispatched. * * @return void */ public function testPageUpdatedSendsDiscordNotification(): void { $page = Page::factory()->createOne(); Feature::activate(FeatureConstants::ALLOW_DISCORD_NOTIFICATIONS); Bus::fake(SendDiscordNotificationJob::class); Event::fakeExcept(PageUpdated::class); $changes = Page::factory()->makeOne(); $page->fill($changes->getAttributes()); $page->save(); Bus::assertDispatched(SendDiscordNotificationJob::class); } }