Add scoped private business verification evidence and expiry
This commit is contained in:
@@ -64,6 +64,36 @@ class ExistingBusinessIntakeTest extends TestCase
|
||||
$this->assertStringNotContainsString('Please clarify', DB::table('existing_business_reviews')->where('action', 'needs_information')->value('note'));
|
||||
}
|
||||
|
||||
public function test_granular_verification_requires_independent_review_and_invalidates_after_changes(): void
|
||||
{
|
||||
$owner = User::factory()->create();
|
||||
$reviewer = $this->reviewer();
|
||||
$this->actingAs($owner);
|
||||
$id = $this->postJson($this->base, $this->draft())->assertCreated()->json('id');
|
||||
$url = $this->base.'/'.$id;
|
||||
$finding = ['version_no' => 3, 'check' => 'identity', 'outcome' => 'confirmed',
|
||||
'evidence_reference' => 'Synthetic identity evidence', 'note' => 'Synthetic independent review',
|
||||
'valid_until' => today()->addDay()->toDateString()];
|
||||
$this->postJson($url.'/transitions', ['version_no' => 1, 'action' => 'submitted', 'note' => 'Synthetic review requested', 'review_consent' => true])->assertOk();
|
||||
$this->postJson($url.'/verifications', $finding)->assertForbidden();
|
||||
$this->actingAs($reviewer)->postJson($url.'/verifications', [...$finding, 'version_no' => 2])->assertConflict();
|
||||
$this->postJson($url.'/transitions', ['version_no' => 2, 'action' => 'in_review', 'note' => 'Synthetic review started'])->assertOk();
|
||||
$this->postJson($url.'/verifications', [...$finding, 'valid_until' => null])->assertUnprocessable();
|
||||
$this->postJson($url.'/verifications', [...$finding, 'object_id' => '00000000-0000-4000-8000-000000000001'])->assertNotFound();
|
||||
$this->postJson($url.'/verifications', $finding)->assertOk()->assertJsonPath('version_no', 4);
|
||||
$this->postJson($url.'/verifications', $finding)->assertConflict();
|
||||
$this->getJson($url)->assertOk()->assertJsonPath('verifications.0.effective_outcome', 'confirmed');
|
||||
$raw = DB::table('existing_business_revisions')->where('business_id', $id)->where('action', 'verification')->value('snapshot');
|
||||
$this->assertStringNotContainsString('Synthetic identity evidence', $raw);
|
||||
$this->travel(2)->days();
|
||||
$this->getJson($url)->assertOk()->assertJsonPath('verifications.0.effective_outcome', 'expired');
|
||||
$this->travelBack();
|
||||
$this->postJson($url.'/transitions', ['version_no' => 4, 'action' => 'needs_information', 'note' => 'Synthetic clarification requested'])->assertOk();
|
||||
$this->actingAs($owner)->putJson($url, [...$this->draft(), 'version_no' => 5])->assertOk();
|
||||
$this->getJson($url)->assertJsonPath('verifications.0.effective_outcome', 'stale');
|
||||
$this->actingAs(User::factory()->create())->getJson($url)->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_flag_mfa_and_current_designation_are_required(): void
|
||||
{
|
||||
$this->getJson($this->base)->assertUnauthorized();
|
||||
|
||||
Reference in New Issue
Block a user