<?php

use App\Models\AuditLog;
use App\Models\ManagedEnvironment;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(RefreshDatabase::class);

it('does not allow legacy platform-superadmin break-glass recovery flow', function () {
    $user = User::factory()->create();
    $this->actingAs($user);

    $tenant = ManagedEnvironment::factory()->create();

    $this->get('/admin/break-glass-recovery')->assertNotFound();

    expect(AuditLog::query()->where('managed_environment_id', $tenant->getKey())->where('action', 'tenant_membership.bootstrap_recover')->exists())
        ->toBeFalse();
});
