## Summary - add the tenant review domain with tenant-scoped review library, canonical workspace review register, lifecycle actions, and review-derived executive pack export - extend review pack, operations, audit, capability, and badge infrastructure to support review composition, publication, export, and recurring review cycles - add product backlog and audit documentation updates for tenant review and semantic-clarity follow-up candidates ## Testing - `vendor/bin/sail bin pint --dirty --format agent` - `vendor/bin/sail artisan test --compact --filter="TenantReview"` - `CI=1 vendor/bin/sail artisan test --compact` ## Notes - Livewire v4+ compliant via existing Filament v5 stack - panel providers remain in `bootstrap/providers.php` via existing Laravel 12 structure; no provider registration moved to `bootstrap/app.php` - `TenantReviewResource` is not globally searchable, so the Filament edit/view global-search constraint does not apply - destructive review actions use action handlers with confirmation and policy enforcement Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #185
51 lines
2.0 KiB
PHP
51 lines
2.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\Finding;
|
|
use App\Services\Evidence\EvidenceSnapshotService;
|
|
use App\Support\TenantReviewCompletenessState;
|
|
use App\Support\TenantReviewStatus;
|
|
|
|
it('creates an anchored tenant review from a chosen evidence snapshot and keeps that basis stable after live data changes', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
$snapshot = seedTenantReviewEvidence($tenant);
|
|
|
|
$review = composeTenantReviewForTest($tenant, $user, $snapshot);
|
|
|
|
expect($review->evidence_snapshot_id)->toBe((int) $snapshot->getKey())
|
|
->and($review->sections)->toHaveCount(6)
|
|
->and($review->summary['evidence_basis']['snapshot_id'])->toBe((int) $snapshot->getKey());
|
|
|
|
Finding::factory()->create([
|
|
'tenant_id' => (int) $tenant->getKey(),
|
|
'workspace_id' => (int) $tenant->workspace_id,
|
|
'severity' => Finding::SEVERITY_CRITICAL,
|
|
]);
|
|
|
|
$newSnapshotPayload = app(EvidenceSnapshotService::class)->buildSnapshotPayload($tenant);
|
|
|
|
expect($review->fresh()->evidence_snapshot_id)->toBe((int) $snapshot->getKey())
|
|
->and($review->fresh()->summary['evidence_basis']['snapshot_fingerprint'])->toBe((string) $snapshot->fingerprint)
|
|
->and($newSnapshotPayload['fingerprint'])->not->toBe((string) $snapshot->fingerprint);
|
|
});
|
|
|
|
it('records completeness and publish blockers when the evidence basis is partial or missing', function (): void {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$snapshot = seedTenantReviewEvidence(
|
|
tenant: $tenant,
|
|
permissionPayload: [
|
|
'required_count' => 10,
|
|
'granted_count' => 7,
|
|
],
|
|
operationRunCount: 0,
|
|
);
|
|
|
|
$review = composeTenantReviewForTest($tenant, $user, $snapshot);
|
|
|
|
expect($review->completeness_state)->toBe(TenantReviewCompletenessState::Missing->value)
|
|
->and($review->status)->toBe(TenantReviewStatus::Draft->value)
|
|
->and($review->publishBlockers())->not->toBeEmpty();
|
|
});
|