assertSame('simulator_fiscal_delta_20261021_test', $t->name); $this->assertSame(55441, (int) $t->port); config(['investor-path.enabled' => true, 'suitecrm.enabled' => false]); $this->actingAs(User::factory()->create(['email_verified_at' => now()])); $d = json_decode(file_get_contents(base_path('tests/frontend/fixtures/ispc-residual-preserved.json')), true, flags: JSON_THROW_ON_ERROR); $personal = ['person_type' => $d['person_type']]; unset($d['person_type']); $id = $this->postJson('/api/v1/simulation-drafts', ['personal_snapshot' => $personal, 'economic_snapshot' => $d], ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json('data.id'); $recovered = $this->getJson('/api/v1/simulation-drafts/'.$id)->assertOk()->json('data.economic_snapshot'); $this->assertSame($d['modelo_a_snapshot'], $recovered['modelo_a_snapshot']); $s = json_decode($recovered['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR); $own = $s['ispcResiduals']['opportunity:376']['occasional']['result']; $this->assertSame('calculated', $own['status']); $this->assertSame(['numerator' => '3000', 'denominator' => '1'], $own['amounts']['tax']); $this->assertSame('singular', $own['input']['personType']); $a = $s['ispcResiduals']['opportunity:375']['acquisitions']['result']; $this->assertSame('calculated', $a['status']); $this->assertSame(['numerator' => '5000', 'denominator' => '1'], $a['amounts']['coveredTax']); $this->assertSame(['numerator' => '20000', 'denominator' => '1'], $a['amounts']['excessTax']); $this->assertSame(['numerator' => '25000', 'denominator' => '1'], $a['amounts']['total']); $this->assertSame('partial', $s['ispcResiduals']['opportunity:375']['formalities']['result']['status']); $this->assertStringContainsString('Indeterminado', $s['ispcResiduals']['opportunity:375']['formalities']['result']['details']['formPeriod']); $old = json_decode(file_get_contents(base_path('tests/frontend/fixtures/ispc-quarter-preserved.json')), true, flags: JSON_THROW_ON_ERROR); foreach (json_decode($old['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR) as $key => $value) { if ($key === 'ispcWithholdings') { continue; }if ($key === 'ispcEligibility') { foreach ($value as $ctx => $book) { $this->assertSame($book, $s[$key][$ctx]); } } else { $this->assertSame($value, $s[$key]); } } if (is_dir(base_path('outputs/ispc-residuals-20261025'))) { file_put_contents(base_path('outputs/ispc-residuals-20261025/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE)); } } }