seed(TemplateSeeder::class); Role::firstOrCreate(['name' => 'Full Administrator', 'guard_name' => 'admin']); $admin = User::factory()->create(); $admin->assignRole('Full Administrator'); Setting::updateOrCreate(['key' => 'email_settings'], ['value' => json_encode(['auto_disabled' => ['service_expiry', 'auto_renew_failed']])]); $rows = collect($this->actingAs($admin, 'admin')->getJson('/api/v1/administrator/email-templates/health') ->assertOk() ->json('data.scenarios'))->keyBy('key'); $this->assertFalse($rows['service_expiry']['auto_enabled']); $this->assertFalse($rows['service_expiry']['ready']); $this->assertTrue($rows['invoice_notification']['has_template']); $this->assertSame(EmailHealth::LIFECYCLE_SCENARIOS, $rows->keys()->all()); Setting::updateOrCreate(['key' => 'email_settings'], ['value' => json_encode(['auto_disabled' => []])]); $rows = collect(EmailHealth::report()['scenarios'])->keyBy('key'); $this->assertTrue($rows['service_expiry']['ready']); } }