TenantAtlas/apps/platform/tests/Feature/Localization/WorkspaceDefaultLocaleTest.php
ahmido 2fa8fc0f87
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 51s
refactor: remove findings lifecycle backfill runtime surfaces (#294)
## Summary
- decommission the legacy findings lifecycle backfill substrate across command, job, service, and UI layers
- remove related platform capabilities, operation catalog entries, and action surface exemptions
- add regression and removal verification tests to ensure runtime integrity and surface absence
- include spec, plan, tasks, and data-model artifacts for the removal slice

## Scope
- active spec: specs/253-remove-findings-backfill-runtime-surfaces
- target branch: dev

## Validation
- integrated regression and removal verification tests for console, findings, and system ops surfaces
- audit log and capability trace verification for the removal path

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #294
2026-04-28 22:00:51 +00:00

51 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
use App\Filament\Pages\Settings\WorkspaceSettings;
use App\Models\WorkspaceSetting;
use App\Services\Localization\LocaleResolver;
use App\Services\Settings\SettingsResolver;
use Livewire\Livewire;
it('persists workspace default locale through the existing workspace settings page', function (): void {
[$workspace, $user] = localizationWorkspaceMember();
$this->actingAs($user)
->get(WorkspaceSettings::getUrl(panel: 'admin'))
->assertSuccessful();
Livewire::actingAs($user)
->test(WorkspaceSettings::class)
->assertSet('data.localization_default_locale', null)
->set('data.localization_default_locale', 'de')
->callAction('save')
->assertHasNoErrors()
->assertSet('data.localization_default_locale', 'de');
expect(app(SettingsResolver::class)->resolveValue($workspace, LocaleResolver::SETTING_DOMAIN, LocaleResolver::SETTING_DEFAULT_LOCALE))
->toBe('de');
expect(WorkspaceSetting::query()
->where('workspace_id', (int) $workspace->getKey())
->where('domain', LocaleResolver::SETTING_DOMAIN)
->where('key', LocaleResolver::SETTING_DEFAULT_LOCALE)
->exists())->toBeTrue();
});
it('keeps workspace default locale authorization aligned to settings capabilities', function (): void {
[$workspace, $user] = localizationWorkspaceMember('readonly');
$this->actingAs($user)
->get(WorkspaceSettings::getUrl(panel: 'admin'))
->assertSuccessful();
Livewire::actingAs($user)
->test(WorkspaceSettings::class)
->assertSet('data.localization_default_locale', null)
->assertActionVisible('save')
->assertActionDisabled('save')
->call('save')
->assertStatus(403);
});