This commit is contained in:
2026-10-29 18:43:29 +02:00
parent f77900e198
commit 78e89a51d2
75 changed files with 2881 additions and 14 deletions
@@ -0,0 +1,15 @@
<?php
namespace Tests\Support;
use App\Modules\Workshop\WorkshopBilling;
use App\Shared\Context\CompanyContext;
use Illuminate\Support\Str;
final class WorkshopCorrectionFixture {
public static function create(?array $base=null): array {
$f=WorkshopBillingFixture::create($base);$w=app(WorkshopBilling::class);$key=fn()=>(string)Str::uuid();
$p=$w->prepare($f['order'],$f['manager']->id,WorkshopBillingFixture::proposal($f),$key());
app(CompanyContext::class)->selectFor($f['reader']->id,$f['tenant'],$f['company'],$f['unit']);$w->review($f['order'],$f['reader']->id,['id'=>$p['id'],'version'=>1,'decision'=>'approved','reason'=>'Proposta comercial sintética conferida.'],$key());
app(CompanyContext::class)->selectFor($f['manager']->id,$f['tenant'],$f['company'],$f['unit']);$g=$w->generate($f['order'],$f['manager']->id,['id'=>$p['id'],'version'=>1],$key());
foreach(['manager'=>['view','request','apply'],'reader'=>['view','review']] as $who=>$rights)foreach($rights as $r)IdentityFixture::grant($f[$who]->id,$f['tenant'],$f['company'],'workshop_corrections.'.$r,$f['unit']);
return $f+['generation'=>$g['id'],'service_draft'=>$g['service_draft_id'],'billing_draft'=>$g['billing_draft_id']];
}
}