make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap(); \App\Shared\Testing\TestingDatabaseGuard::assertSafe(); $file='C:/laragon/data/sgf-tempo/secrets/browser-fixture.json'; $f=json_decode(file_get_contents($file),true,32,JSON_THROW_ON_ERROR); app(\App\Shared\Context\CompanyContext::class)->selectFor($f['manager_id'],$f['tenant'],$f['company'],$f['unit']); $ids=DB::transaction(function () use ($f) { $workflow=app(\App\Modules\Services\ServiceWorkflow::class); $actor=$f['manager_id']; $client=$workflow->save('clients',null,$actor,['name'=>'Cliente sintético de cálculo'],(string)Str::uuid())['id']; $service=$workflow->save('services',null,$actor,['name'=>'Serviço sintético de cálculo'],(string)Str::uuid())['id']; $profile=DB::table('service_calculation_profiles')->insertGetId(['tenant_id'=>$f['tenant'],'company_id'=>$f['company'],'unit_id'=>$f['unit'],'identifier'=>'ENSAIO-MZN-16','version'=>1,'definition'=>json_encode(['kind'=>'synthetic','currency'=>'MZN','rate_percent'=>'16','policy'=>ServiceCalculation::POLICY,'sources'=>ServiceCalculation::SOURCES]),'created_at'=>now()]); $drafts=[]; foreach (['100','1000.03','0.03','0.0001'] as $price) { $source=$workflow->save('service_drafts',null,$actor,['name'=>'Ensaio base '.$price,'client_id'=>$client,'currency'=>'MZN','lines'=>[['service_id'=>$service,'quantity'=>'1','unit_price'=>$price]]],(string)Str::uuid())['id']; $draft=$workflow->save('billing_drafts',null,$actor,['source_id'=>$source,'name'=>'Ensaio base '.$price],(string)Str::uuid())['id']; app(\App\Modules\Services\DocumentPreparation::class)->save('billing_drafts',$draft,$actor,['version'=>0,'draft_version'=>1,'currency'=>'MZN','price_mode'=>'added','units'=>['UN'],'payment_instruction_ids'=>[]]); $drafts[]=$draft; } return ['calculation_profile'=>$profile,'calculation_drafts'=>$drafts]; }); file_put_contents($file,json_encode($f+$ids,JSON_THROW_ON_ERROR)); echo "Four synthetic calculation drafts and profile created only in sgf_tempo_test. No results precomputed.\n";