Complete durable private Education review preparation and recovery
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-11 08:21:56 +02:00
parent bbc3c1c9bc
commit 6805b606a1
14 changed files with 1092 additions and 49 deletions
@@ -0,0 +1,17 @@
import fs from 'node:fs';
import assert from 'node:assert/strict';
import { harness,props,text } from '../tests/frontend/helpers/education-review.mjs';
const out=new URL('../outputs/education-review-preparation-20261111/',import.meta.url);
const source=JSON.parse(fs.readFileSync(new URL('recovered-page.json',out),'utf8'));
assert.equal(source.synthetic,true);
const h=harness(props(source.props));
assert.equal(h.sent.length,0);
h.click('Recuperar preparação guardada');
await h.preparationResponse(source.props.preparation);
assert.equal(h.sent.length,0);
assert.match(text(h.tree),/Revisão registada/);
assert.match(h.field('education-review','Justificação e evidência da revisão').props.value,/later edit retained/);
const escape = value => String(value).replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
fs.writeFileSync(new URL('recovered-review.html',out), '<!doctype html><meta charset="utf-8"><title>Prova de recuperação QA</title><h1>Recuperação sintética em QA</h1><p>Transcrição do componente no harness; não constitui conferência visual no navegador.</p><pre>' + escape(text(h.tree)) + '</pre>');
fs.writeFileSync(new URL('verification.json',out),JSON.stringify({synthetic:true,nativeRecoveredPage:true,actualComponent:true,privateActorBound:true,recordId:source.props.declaration.id,kind:source.props.kind,acknowledgedVersion:source.props.declaration.version_no,retainedLaterEdit:true,additionalBusinessPosts:h.sent.length,visualBrowserReview:false,activeDataChanged:false},null,2));
console.log('Native QA page recovered through actual review component; later edits retained, no duplicate decision.');
+34
View File
@@ -0,0 +1,34 @@
<?php
$root = dirname(__DIR__);
if (! in_array(($argv[1] ?? ''), ['test', 'analyse'], true) || basename($root) !== 'portal-investidor') {
throw new RuntimeException('Explicit local test operation required.');
}
foreach (['APP_ENV' => 'testing', 'APP_KEY' => 'base64:'.base64_encode(str_repeat('Q', 32)),
'APP_CONFIG_CACHE' => $root.'/outputs/education-review-preparation-20261111/no-config.php',
'DB_CONNECTION' => 'pgsql', 'DB_HOST' => '127.0.0.1', 'DB_PORT' => '55441',
'DB_DATABASE' => 'simulator_fiscal_delta_20261021_test', 'DB_USERNAME' => 'investmoz_test', 'DB_PASSWORD' => '',
'DB_URL' => '', 'DATABASE_URL' => '', 'CACHE_STORE' => 'array', 'SESSION_DRIVER' => 'array',
'QUEUE_CONNECTION' => 'sync', 'MAIL_MAILER' => 'array', 'SUITECRM_ENABLED' => 'false'] as $key => $value) {
putenv($key.'='.$value);
$_ENV[$key] = $_SERVER[$key] = $value;
}
$pdo = new PDO('pgsql:host=127.0.0.1;port=55441;dbname=simulator_fiscal_delta_20261021_test', 'investmoz_test', '');
$identity = $pdo->query('select current_database() as name,inet_server_port() as port')->fetch(PDO::FETCH_ASSOC);
if ($identity['name'] !== 'simulator_fiscal_delta_20261021_test' || (int) $identity['port'] !== 55441) {
throw new RuntimeException('Isolated QA identity required.');
}
if (($argv[1] ?? '') === 'analyse') {
$argv = ['phpstan', 'analyse', '--no-progress', '--memory-limit=512M', '--configuration='.$root.'/outputs/funding-directory-20261110/phpstan.neon', 'app/Services/EducationReviews.php', 'app/Http/Controllers/EducationController.php'];
$_SERVER['argv'] = $argv;
$_SERVER['argc'] = count($argv);
require $root.'/vendor/autoload.php';
require $root.'/vendor/phpstan/phpstan/phpstan';
exit;
}
$argv = ['phpunit', '-c', 'phpunit.investmoz.xml', '--do-not-cache-result', 'tests/Feature/EducationReviewPreparationTest.php'];
$argc = count($argv);
$_SERVER['argv'] = $argv;
$_SERVER['argc'] = $argc;
require $root.'/vendor/autoload.php';
require $root.'/vendor/phpunit/phpunit/phpunit';