seed(RoleSeeder::class); } public function test_household_verification_writes_activity_log(): void { $admin = User::factory()->create(['role' => User::ROLE_ADMIN, 'status' => 'active']); $h = Household::factory()->create(['verification_status' => 'pending', 'proof_of_residency_path' => 'p.jpg']); $h->markVerified($admin); HouseholdVerified::dispatch($h->fresh(), $admin); $log = Activity::where('log_name', 'household') ->where('event', 'updated') ->where('subject_id', $h->id) ->orderByDesc('id') ->first(); $this->assertNotNull($log); $this->assertSame(Household::class, $log->subject_type); $this->assertEquals('approved', $log->properties['attributes']['verification_status']); } public function test_qr_code_void_writes_activity_log(): void { $batch = app(BatchGenerator::class)->generate(1, QrCodeBatch::PURPOSE_FREE); $code = $batch->codes()->first(); $code->status->transitionTo(Voided::class); $log = Activity::where('log_name', 'qr_code')->latest()->first(); $this->assertNotNull($log); $this->assertSame('voided', $log->properties['attributes']['status']); } }