11 lines
1.9 KiB
PHP
11 lines
1.9 KiB
PHP
<?php
|
|
use Illuminate\Support\Facades\DB;
|
|
$s=json_decode(file_get_contents(getenv('RECEIPT_COMPOSITION_STATE')),true);$out=$s['root'].'/integrated-navigation-guard.json';if(!($s['integrated']??false)||is_file($out))throw new LogicException('New integrated proof required');require $s['app'].'/vendor/autoload.php';$app=require $s['app'].'/bootstrap/app.php';$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();$queries=0;DB::listen(function()use(&$queries){$queries++;});$checks=[];
|
|
$nav=new App\Modules\Purchasing\WorkspaceNavigation;
|
|
config(['receipt_qa.enabled'=>false]);if($nav->links()!==[])throw new RuntimeException('Disabled links');$checks[]='disabled composition exposes no navigation';
|
|
try{$nav->screen(new Illuminate\Http\Request,new App\Modules\Purchasing\ReceiptRuntime);throw new RuntimeException('Disabled hub accepted');}catch(Symfony\Component\HttpKernel\Exception\HttpException $e){if($e->getStatusCode()!==404)throw $e;}$checks[]='disabled hub returns404 before any database read';
|
|
config(['receipt_qa.enabled'=>true]);$app->instance('env','production');if($nav->links()!==[])throw new RuntimeException('Production links');$checks[]='production cannot discover synthetic navigation';
|
|
try{$nav->screen(new Illuminate\Http\Request,new App\Modules\Purchasing\ReceiptRuntime);throw new RuntimeException('Production accepted');}catch(Symfony\Component\HttpKernel\Exception\HttpException $e){if($e->getStatusCode()!==403)throw $e;}$checks[]='production hub refuses without SQL';
|
|
if($queries!==0||App\Shared\Context\ModuleNavigation::owner('purchasing/workspace')!=='purchasing')throw new RuntimeException('Guard isolation');$checks[]='hub belongs to purchasing and guard probes issue zero SQL';
|
|
file_put_contents($out,json_encode(['passed'=>true,'checks'=>$checks,'database_queries'=>$queries],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo count($checks)." navigation guard checks passed.\n";
|