assertSame('simulator_fiscal_delta_20261021_test', $target->name); $this->assertSame(55441, (int) $target->port); $this->withoutVite(); config(['portal.profile_access_enabled' => true, 'portal.opportunity_specialized_drafts_enabled' => true, 'investor-path.enabled' => true, 'suitecrm.enabled' => false, 'investmoz_ai.enabled' => false]); $actor = User::findOrFail(295); $this->actingAs($actor)->withSession(['portal.mfa_actor' => $actor->id, 'portal.mfa_at' => time(), 'portal.access_revision' => (int) $actor->portal_access_revision]); $entry = app(CorridorAgribusinessOpportunities::class)->entries()[0]; $record = Opportunity::where('management_creation_key', $entry['key'])->firstOrFail(); $base = '/minhas-oportunidades/'.$record->id.'/divulgacao'; $preview = $this->postJson($base.'/previa', [...$record->workflow_context['promotional_summary']['input'], 'action' => 'disclose', 'etag' => app(OpportunityManagement::class)->etag($record)])->assertOk()->json(); $this->postJson($base.'/confirmar', ['token' => $preview['token'], 'operation_key' => (string) Str::uuid(), 'confirm' => true, 'reason' => 'QA: conferir o roteiro de um interessado sem atribuir qualquer autorização.'])->assertOk(); $investor = User::factory()->create(); $this->actingAs($investor); $this->get('/oportunidades/'.$record->slug)->assertOk(); $id = $this->postJson('/investimentos', ['title' => 'QA: investimento a partir de agronegócio', 'client_key' => (string) Str::uuid(), 'reuse_consent' => true])->assertCreated()->json('id'); $view = $this->getJson('/investimentos/'.$id.'/contexto')->assertOk()->json(); $body = ['version' => $view['case']['version'], 'selection' => ['opportunity' => 'opportunity:'.$record->id]]; $plan = $this->postJson('/investimentos/'.$id.'/contexto/previa', $body)->assertOk()->json(); $this->postJson('/investimentos/'.$id.'/contexto/confirmar', [...$body, 'preview_hash' => $plan['preview_hash'], 'operation_key' => (string) Str::uuid(), 'confirm' => true])->assertOk(); $this->getJson('/investimentos/'.$id.'/contexto')->assertOk() ->assertJsonPath('context.selection.opportunity.key', 'opportunity:'.$record->id) ->assertJsonPath('context.fields.project_title', 'QA: investimento a partir de agronegócio') ->assertJsonPath('context.fields.project_summary', $record->summary) ->assertJsonPath('context.fields.sector_id', '1'); $this->get('/investimentos/'.$id)->assertOk(); $interestId = $this->postJson('/investidor/manifestacoes', ['opportunity_id' => $record->id])->assertCreated()->json('id'); $this->getJson('/investidor/manifestacoes/'.$interestId)->assertOk(); $this->assertSame(1, DB::table('desk_cases')->where('id', $id)->count()); $this->assertSame('opportunity:'.$record->id, app(\App\Services\InvestorContext::class)->view($investor, $id)['context']['selection']['opportunity']['key']); // All synthetic investor/path/disclosure writes roll back with this test. } }