assertSame('proactive_investment_20261027_test', $target->name); $this->assertSame(55441, (int) $target->port); config(['investor-path.enabled' => true, 'suitecrm.enabled' => false]); $this->actingAs(User::findOrFail(1021)); $id = null; $etag = null; foreach (['ordinary' => 138, 'rounded' => 138, 'zero' => 138, 'unknown' => 138, 'other_period' => 138] as $name => $balance) { $snapshot = json_decode(file_get_contents(base_path('outputs/irpc-ppc-obligation-20261111/'.$name.'.json')), true, flags: JSON_THROW_ON_ERROR); $personal = ['person_type' => $snapshot['person_type']]; unset($snapshot['person_type']); $payload = ['personal_snapshot' => $personal, 'economic_snapshot' => $snapshot]; if ($id === null) { $id = $this->postJson('/api/v1/simulation-drafts', $payload, ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json('data.id'); } else { $this->putJson('/api/v1/simulation-drafts/'.$id, $payload, ['If-Match' => $etag])->assertOk(); } $response = $this->getJson('/api/v1/simulation-drafts/'.$id)->assertOk(); $etag = $response->headers->get('ETag'); $back = $response->json('data.economic_snapshot'); $this->assertSame($snapshot['modelo_a_snapshot'], $back['modelo_a_snapshot']); $book = json_decode($back['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR)['irpcAnnual'][$snapshot['context_opportunity']]; $this->assertCount(1, $book['history']); $this->assertSame(['numerator' => '138', 'denominator' => '1'], $book['history'][0]['model']['arithmeticBalance']); $this->assertSame($balance === null ? null : ['numerator' => (string) $balance, 'denominator' => '1'], $book['result']['model']['arithmeticBalance']); $this->assertSame($book['ppcObligation'], $book['result']['model']['input']['ppcObligation']); $this->assertSame('2025', $book['ppcObligation']['previousYear']); $this->assertSame('SYNTHETIC prior assessment21(1)', $book['ppcObligation']['assessmentReference']); file_put_contents(base_path('outputs/irpc-ppc-obligation-20261111/recovered-'.$name.'.json'), json_encode($back, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE)); } } }