feat(offers): implement phase four private details and confidentiality in QA

This commit is contained in:
2026-11-14 17:28:12 +02:00
parent 7691cab3bc
commit e431de8b42
29 changed files with 2356 additions and 12 deletions
+21 -2
View File
@@ -9,6 +9,7 @@ use App\Models\User;
use App\Services\InvestmentGeography;
use App\Services\OpportunityMaturity;
use App\Support\IsolatedQaDatabase;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
final class OpportunitySearchFixture
@@ -20,9 +21,27 @@ final class OpportunitySearchFixture
}
$province = app(InvestmentGeography::class)->publicReferences()->where('location_type', 'province')->where('name', 'Inhambane')->first();
if (! $province) {
throw new \LogicException('QA requires the existing public Inhambane reference');
// Tests must not depend on an operational import. These placeholders exist
// only in the already isolated test database and caller's rollback transaction.
if (DB::transactionLevel() < 1) {
throw new \LogicException('Synthetic references require test rollback');
}
$country = (string) Str::uuid();
$id = (string) Str::uuid();
foreach ([[$country, 'country', null, 'Synthetic QA country'], [$id, 'province', $country, 'Inhambane']] as [$key, $type, $parent, $name]) {
DB::table('geo_locations')->insert(['id' => $key, 'code' => 'SYNTHETIC-QA-'.$key, 'name' => $name,
'location_type' => $type, 'parent_id' => $parent, 'data_classification' => 'public', 'source_system' => 'cartografia-workbook',
'external_id' => '964a187ad32ea553b9e112cd159caa90b900050c42b7329594a75bcd798a96ff:'.$key]);
}
$province = app(InvestmentGeography::class)->publicReferences()->where('id', $id)->first();
}
$sector = Sector::where('slug', 'turismo')->first();
if (! $sector) {
if (DB::transactionLevel() < 1) {
throw new \LogicException('Synthetic sector requires test rollback');
}
$sector = Sector::create(['slug' => 'turismo', 'name' => 'Synthetic QA tourism', 'is_active' => true]);
}
$sector = Sector::where('slug', 'turismo')->firstOrFail();
$editor = User::factory()->create();
$reviewer = User::factory()->create();
$zone = InvestmentZone::query()->create(['id' => (string) Str::uuid(), 'code' => 'SINT-QA-'.Str::random(8),