## Summary - restore broad full-suite green-signal coverage across platform governance, operations, onboarding, dashboard/productization, and customer review flows - align related platform tests and supporting behavior with the current expected state for this restoration pass - update the spec-candidates queue as part of the same suite-restoration sweep ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Browser/Dashboard/TenantDashboardProductizationSmokeTest.php tests/Browser/Reviews/CustomerReviewWorkspaceSmokeTest.php tests/Browser/Spec194GovernanceFrictionSmokeTest.php tests/Browser/Spec265DecisionRegisterSmokeTest.php` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #351
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
use App\Models\ManagedEnvironment;
|
|
use App\Services\Auth\CapabilityResolver;
|
|
use App\Support\Auth\Capabilities;
|
|
use App\Support\TenantRole;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('does not execute additional managed_environment_memberships queries after first resolve within a request', function () {
|
|
$tenant = ManagedEnvironment::factory()->create();
|
|
|
|
[$user] = createUserWithTenant($tenant, role: TenantRole::Owner->value);
|
|
|
|
$resolver = app(CapabilityResolver::class);
|
|
|
|
$membershipSelects = 0;
|
|
|
|
DB::listen(function ($query) use (&$membershipSelects): void {
|
|
if (str_contains($query->sql, 'managed_environment_memberships')) {
|
|
$membershipSelects++;
|
|
}
|
|
});
|
|
|
|
expect($resolver->can($user, $tenant, Capabilities::TENANT_VIEW))->toBeTrue();
|
|
|
|
for ($i = 0; $i < 10; $i++) {
|
|
expect($resolver->can($user, $tenant, Capabilities::TENANT_VIEW))->toBeTrue();
|
|
expect($resolver->can($user, $tenant, Capabilities::PROVIDER_VIEW))->toBeTrue();
|
|
}
|
|
|
|
expect($membershipSelects)->toBe(1);
|
|
});
|