actingAs($user); Filament::setTenant($tenant, true); $profile = BaselineProfile::factory()->active()->create([ 'workspace_id' => (int) $tenant->workspace_id, 'name' => 'Security Baseline', ]); $snapshot = BaselineSnapshot::factory()->create([ 'workspace_id' => (int) $tenant->workspace_id, 'baseline_profile_id' => (int) $profile->getKey(), ]); $policy = Policy::factory()->for($tenant)->create([ 'display_name' => 'Windows Lockdown', ]); $version = PolicyVersion::factory()->for($tenant)->create([ 'policy_id' => (int) $policy->getKey(), 'version_number' => 3, ]); $run = OperationRun::factory()->for($tenant)->create([ 'workspace_id' => (int) $tenant->workspace_id, 'type' => 'baseline_compare', ]); $finding = Finding::factory()->for($tenant)->create([ 'current_operation_run_id' => (int) $run->getKey(), 'evidence_jsonb' => [ 'current' => [ 'policy_version_id' => (int) $version->getKey(), ], 'provenance' => [ 'baseline_profile_id' => (int) $profile->getKey(), 'baseline_snapshot_id' => (int) $snapshot->getKey(), 'compare_operation_run_id' => (int) $run->getKey(), ], ], ]); $this->get(FindingResource::getUrl('view', ['record' => $finding], tenant: $tenant)) ->assertOk() ->assertSee('Security Baseline') ->assertSee('Baseline snapshot #'.$snapshot->getKey()) ->assertSee('Windows Lockdown') ->assertSee('Version 3') ->assertSee('Baseline compare') ->assertSee('Run #'.$run->getKey()); });