commit de compras
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\DB;
|
||||
$s=json_decode(file_get_contents(getenv('RECEIPT_COMPOSITION_STATE')),true);$out=$s['root'].'/receipt-documents-guards.json';if(!($s['receiptDocuments']??false)||is_file($out))throw new LogicException('New document fixture required');require $s['app'].'/vendor/autoload.php';$app=require $s['app'].'/bootstrap/app.php';$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();$queries=0;$checks=[];DB::listen(function()use(&$queries){$queries++;});$c=new App\Modules\Purchasing\ReceiptDocumentsController;$runtime=new App\Modules\Purchasing\ReceiptRuntime;
|
||||
$check=function($fn,$status,$name)use(&$checks){try{$fn();throw new RuntimeException('Unexpected acceptance');}catch(Symfony\Component\HttpKernel\Exception\HttpException $e){if($e->getStatusCode()!==$status)throw $e;}$checks[]=$name;};config(['receipt_qa.receipt_documents_enabled'=>false]);$check(fn()=>$c->index(1,new Illuminate\Http\Request,$runtime),404,'disabled document metadata refuses before SQL');$check(fn()=>$c->preview(1,new Illuminate\Http\Request,$runtime),404,'disabled upload refuses before validation storage and SQL');config(['receipt_qa.receipt_documents_enabled'=>true]);$app->instance('env','production');$check(fn()=>$c->index(1,new Illuminate\Http\Request,$runtime),403,'production refuses synthetic document adapter before SQL');if($queries!==0||App\Shared\Context\ModuleNavigation::owner('api/purchasing-receipts/history/1/documents/1/download')!=='purchasing')throw new RuntimeException('Document guard scope');$checks[]='document route belongs to purchasing and guard probes issue zero SQL';file_put_contents($out,json_encode(['passed'=>true,'checks'=>$checks,'database_queries'=>0],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo count($checks)." document guard checks passed.\n";
|
||||
Reference in New Issue
Block a user