oportunidades 4
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-10 07:03:59 +02:00
parent e662230df7
commit 6ddafc95ba
179 changed files with 22750 additions and 933 deletions
+28 -9
View File
@@ -10,24 +10,34 @@ use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Vite;
$root = dirname(__DIR__);
require_once $root.'/tools/portal-qa-environment.php';
$dir = $root.'/storage/app/private/investmoz-v2';
$backup = json_decode(file_get_contents($dir.'/opportunity-resources-backup-proof.json'), true, 512, JSON_THROW_ON_ERROR);
$target = $backup['restored_target'];
if (! $backup['restore_verified'] || ! preg_match('/^desk_restore_\d{8}_\d{6}_test$/', $target['database']) || (int) $target['port'] !== 55441) {
throw new RuntimeException('QA target required');
}
foreach (['APP_ENV' => 'testing', 'APP_DEBUG' => 'true', 'APP_URL' => 'http://127.0.0.1:18096', 'APP_KEY' => 'base64:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=', 'DB_CONNECTION' => 'pgsql', 'DB_HOST' => '127.0.0.1', 'DB_PORT' => '55441', 'DB_DATABASE' => $target['database'], 'DB_USERNAME' => 'postgres', 'DB_PASSWORD' => '', 'DB_URL' => '', 'SESSION_DRIVER' => 'file', 'SESSION_COOKIE' => 'opportunity_resources_qa', 'CACHE_STORE' => 'array', 'QUEUE_CONNECTION' => 'sync'] as $key => $value) {
putenv($key.'='.$value);
$_ENV[$key] = $_SERVER[$key] = $value;
}
$target = portalQaEnvironment('file');
require $root.'/vendor/autoload.php';
$app = require $root.'/bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
$identity = DB::selectOne('SELECT current_database() AS database,inet_server_port() AS port');
if ($identity->database !== $target['database'] || (int) $identity->port !== 55441) {
throw new RuntimeException('Refusing non-QA target');
}
config(['portal.managers' => ['opportunity-manager@example.invalid'], 'suitecrm.enabled' => false, 'investmoz_ai.enabled' => false]);
config(['investor-path.enabled' => true]);
config(['geometry-import.enabled' => true]);
$identity = portalQaAssertTarget($target);
config(['portal.qa_synthetic_accounts_only' => true]);
require_once $root.'/tools/portal-qa-account-selection.php';
// Only expose the non-secret identity; passwords, TOTP secrets and recovery codes remain private.
\Laravel\Fortify\Fortify::loginView(fn (Request $request) => \Inertia\Inertia::render('auth/login', [
'canResetPassword' => \Laravel\Fortify\Features::enabled(\Laravel\Fortify\Features::resetPasswords()),
'status' => $request->session()->get('status'),
'qaAccount' => ['id' => 18, 'email' => User::findOrFail(18)->email],
]));
\Laravel\Fortify\Fortify::twoFactorChallengeView(function (Request $request) {
$actor = User::findOrFail($request->session()->get('login.id'));
return \Inertia\Inertia::render('auth/two-factor-challenge', ['qaAccount' => ['id' => $actor->id, 'email' => $actor->email]]);
});
config(['portal.managers' => ['opportunity-manager@example.invalid', 'geo-manager-qa@example.invalid'], 'suitecrm.enabled' => false, 'investmoz_ai.enabled' => false]);
$sessions = $dir.'/qa-opportunity-resources-sessions';
if (! is_dir($sessions)) {
mkdir($sessions, 0700, true);
@@ -99,4 +109,13 @@ if ($path !== '/' && $asset && $public && str_starts_with($asset, $public.DIRECT
return false;
}
header('X-Investmoz-QA-Target: '.$identity->database.':'.$identity->port);
header('X-Investmoz-QA-Key-Fingerprint: '.hash('sha256', app('encrypter')->getKey()));
header('X-Investmoz-QA-Config-Cache: bypassed');
require_once $root.'/tools/portal-qa-auth-trace.php';
$httpKernel = $app->make(\Illuminate\Contracts\Http\Kernel::class);
$httpKernel->prependMiddleware(PortalQaAuthTrace::class);
$httpKernel->appendMiddlewareToGroup('web', PortalQaSessionTrace::class);
$httpKernel->addToMiddlewarePriorityAfter(\Illuminate\Session\Middleware\StartSession::class, PortalQaSessionTrace::class);
$httpKernel->appendMiddlewareToGroup('web', PortalQaAccountSelection::class);
$httpKernel->addToMiddlewarePriorityAfter(PortalQaSessionTrace::class, PortalQaAccountSelection::class);
$app->handleRequest(Request::capture());