make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); App\Shared\Testing\TestingDatabaseGuard::assertSafe(); $p = json_decode(file_get_contents($argv[1]), true, 512, JSON_THROW_ON_ERROR); $db = Illuminate\Support\Facades\DB::connection(); $cluster = $db->selectOne("SELECT current_setting('cluster_name') AS name")->name; if ($cluster !== 'sgf_modular_regression_'.getenv('SGF_ISOLATED_REGRESSION_RUN')) throw new RuntimeException('Wrong test cluster'); $db->statement("SET application_name = 'sgf_association_worker'"); $context = app(App\Shared\Context\CompanyContext::class); $context->selectFor($p['actor'], $p['tenant'], $p['company'], $p['unit']); $r = Illuminate\Http\Request::create('/api/module-records', 'POST', ['review_token' => $p['review_token']]); $r->headers->set('X-SGF-Context', $p['context']); file_put_contents($argv[1].'.ready', 'ready'); try { $result = app(App\Modules\Identity\Services\ModuleAssociationReview::class)->confirm($r); echo json_encode(['status' => 200, ...$result], JSON_THROW_ON_ERROR); } catch (Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e) { echo json_encode(['status' => $e->getStatusCode()], JSON_THROW_ON_ERROR); }