Accept isolated workshop billing draft trial with documented manual evidence

This commit is contained in:
2026-10-28 19:32:10 +02:00
parent 090b7da336
commit 3932b94a16
30 changed files with 633 additions and 1 deletions
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace Tests\Support;
use App\Modules\Workshop\WorkshopBilling;
use App\Modules\Services\ServiceWorkflow;
use Illuminate\Support\Str;
final class WorkshopBillingFixture {
public static function create(?array $base=null): array {
WorkshopBilling::guard();$f=DirectCostFixture::create($base);
foreach(['manager'=>['view','prepare','generate'],'reader'=>['view','review']] as $who=>$rights){foreach($rights as $right)IdentityFixture::grant($f[$who]->id,$f['tenant'],$f['company'],'workshop_billing.'.$right,$f['unit']);IdentityFixture::grant($f[$who]->id,$f['tenant'],$f['company'],'workshop.view',$f['unit']);}
$service=app(ServiceWorkflow::class)->save('services',null,$f['manager']->id,['name'=>'Serviço comercial exclusivamente sintético'],(string)Str::uuid())['id'];return $f+compact('service');
}
public static function proposal(array $f): array {return ['version'=>1,'previous_id'=>null,'client_id'=>$f['client'],'currency'=>'MZN','evidence'=>'WORKSHOP-SALES-SYNTHETIC-v1: 200/H e 75/UN, revisão comercial distinta.','lines'=>array_map(fn($id,$price)=>['entry_id'=>$id,'entry_version'=>1,'service_id'=>$f['service'],'service_version'=>1,'price'=>$price,'price_source'=>'WORKSHOP-SALES-SYNTHETIC-v1'],[$f['time'],$f['material']],['200','75'])];}
}