fix: complete InvesteMoz validation and error corrections

This commit is contained in:
2026-10-29 21:47:33 +02:00
parent 63147312e2
commit daf8623441
718 changed files with 127308 additions and 20959 deletions
@@ -1,4 +1,5 @@
<?php
namespace Tests\Feature;
use App\Models\User;
@@ -11,7 +12,7 @@ final class IvaAcquisitionAllocationDraftTest extends TestCase
{
use DatabaseTransactions;
public function test_allocation_recovers_with_exact_fractions_and_preserved_ABC(): void
public function test_allocation_recovers_with_exact_fractions_and_preserved_abc(): void
{
$target = DB::selectOne('select current_database() as name,inet_server_port() as port');
$this->assertSame('simulator_fiscal_delta_20261021_test', $target->name);
@@ -25,23 +26,27 @@ final class IvaAcquisitionAllocationDraftTest extends TestCase
$store = json_decode($recovered['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
$book = $store['books']['opportunity:370'];
$this->assertCount(4, $book['rows']);
$this->assertSame(['eligible','eligible','eligible','eligible'], array_column(array_column($book['result']['rows'], 'eligibility'), 'status'));
$this->assertSame(['eligible', 'eligible', 'eligible', 'eligible'], array_column(array_column($book['result']['rows'], 'eligibility'), 'status'));
$this->assertSame('24.16', $book['result']['periods'][0]['fields']['15']);
$this->assertCount(1, $book['history']);
$this->assertSame('10.72', $book['result']['periods'][0]['fields']['11']);
$this->assertSame('135.84', $book['result']['periods'][0]['fields']['17']);
$this->assertSame('customs', $book['rows'][3]['documentType']);
$this->assertSame('actual', $book['rows'][0]['d']['method']);
$this->assertSame(['numerator'=>'16','denominator'=>'3'], $book['result']['rows'][0]['deductibleExact']);
$this->assertSame(['numerator'=>'17','denominator'=>'50'], $book['result']['rows'][1]['allocationCalculation']['ratio']);
$this->assertSame(['numerator' => '16', 'denominator' => '3'], $book['result']['rows'][0]['deductibleExact']);
$this->assertSame(['numerator' => '17', 'denominator' => '50'], $book['result']['rows'][1]['allocationCalculation']['ratio']);
$this->assertSame('yes', $book['rows'][0]['d']['facts']['communication']);
$this->assertSame('6.40', $store['books']['opportunity:371']['result']['periods'][0]['fields']['15']);
$this->assertNull($store['books']['opportunity:371']['result']['periods'][0]['fields']['16']);
$this->assertSame('public_works', $store['books']['opportunity:371']['rows'][0]['d']['reducedId']);
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-l2d-preserved.json')), true, flags: JSON_THROW_ON_ERROR);
foreach (json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR) as $key => $map) {
if ($key === 'version') continue;
foreach ($map as $context => $original) $this->assertSame($original, $store[$key][$context]);
if ($key === 'version') {
continue;
}
foreach ($map as $context => $original) {
$this->assertSame($original, $store[$key][$context]);
}
}
file_put_contents(base_path('outputs/iva-l2-d-20261025/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE));
}