assertSame('simulator_fiscal_delta_20261021_test', $target->name); $this->assertSame(55441, (int) $target->port); config(['investor-path.enabled' => true, 'suitecrm.enabled' => false]); $this->actingAs(User::factory()->create(['email_verified_at' => now()])); $draft = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g7g-bases.json')), true, flags: JSON_THROW_ON_ERROR); $id = $this->postJson('/api/v1/simulation-drafts', ['personal_snapshot' => [], 'economic_snapshot' => $draft], ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json('data.id'); $recovered = $this->getJson('/api/v1/simulation-drafts/'.$id)->assertOk()->json('data.economic_snapshot'); $this->assertSame($draft['modelo_a_snapshot'], $recovered['modelo_a_snapshot']); $this->assertSame('opportunity:345', $recovered['context_opportunity']); $this->assertSame('Manica', $recovered['selection_labels']['province_id']); $store = json_decode($recovered['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR); $book = $store['considerationExclusions']['opportunity:345']; $this->assertCount(1, $book['rows']); $this->assertCount(4, $book['rows'][0]['parts']); $this->assertSame(['judicial_indemnity', 'granted_discount', 'third_party_payment', 'returnable_packaging'], array_column($book['rows'][0]['parts'], 'treatment')); $this->assertSame(['799.70'], array_column($book['result']['rows'], 'baseAmount')); $this->assertSame(['determined'], array_column($book['result']['rows'], 'status')); $this->assertSame([null], array_column($book['result']['rows'], 'vat')); $this->assertSame([null], array_column($book['result']['rows'], 'rate')); $this->assertSame('1000.25', $book['rows'][0]['initialAmount']); $this->assertSame(['100.10', '50.25', '30.15', '20.05'], array_column($book['rows'][0]['parts'], 'amount')); $this->assertSame(['yes', 'yes', 'yes', 'yes'], array_column($book['rows'][0]['parts'], 'included')); $this->assertSame('yes', $book['rows'][0]['parts'][0]['conditions']['judicialDeclaration']); $this->assertSame('yes', $book['rows'][0]['parts'][1]['conditions']['granted']); $this->assertSame('yes', $book['rows'][0]['parts'][2]['conditions']['thirdPartyAccounts']); $this->assertSame('yes', $book['rows'][0]['parts'][3]['conditions']['returnMention']); $this->assertStringContainsString('contas de terceiros A', $book['rows'][0]['parts'][2]['accountRef']); $this->assertStringContainsString('adquirente B', $book['rows'][0]['parts'][2]['beneficiaryRef']); $this->assertStringContainsString('devolução acordada', $book['rows'][0]['parts'][3]['documentExcerpt']); $this->assertStringContainsString('declaração judicial', $book['rows'][0]['parts'][0]['reference']); $this->assertStringContainsString('15(6)', $book['result']['source']); $this->assertSame($book['rows'], $book['result']['inputs']); $this->assertCount(2, $book['history']); $this->assertNull($book['history'][0]['rows'][0]['baseAmount']); $frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g7g-preserved-inputs.json')), true, flags: JSON_THROW_ON_ERROR); $prior = json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR); $this->assertSame($prior, array_diff_key($store, ['considerationExclusions' => true])); $this->assertSame('1250.30', $store['publicAuthorityBases']['opportunity:339']['result']['rows'][1]['baseAmount']); $this->assertNull($store['publicAuthorityBases']['opportunity:339']['result']['rows'][1]['vat']); $this->assertSame('400.00', $store['importExemptions']['opportunity:338']['result']['rows'][1]['importVat']); $this->assertNull($store['books']['opportunity:329']['result']['periods'][0]['fields']['11']); file_put_contents(base_path('outputs/iva-l1-g7g-exclusions-20261024/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE)); } }