Add HR resource labels and helper methods for various resources; update locale handling in user model and department factory

This commit is contained in:
Mekan1206
2026-07-31 23:40:35 +05:00
parent 581cb8241c
commit 20d032c4cc
83 changed files with 4386 additions and 39 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
use App\Enums\Gender;
use App\Enums\NavigationGroup;
use App\Filament\Resources\ActivityLogs\ActivityLogResource;
use App\Filament\Resources\Departments\DepartmentResource;
use App\Models\User;
use BezhanSalleh\LanguageSwitch\Events\LocaleChanged;
use Illuminate\Support\Facades\App;
@@ -44,6 +45,26 @@ it('returns translated filament resource navigation labels', function (): void {
expect(ActivityLogResource::getNavigationLabel())->toBe('Журнал аудита');
});
it('returns translated filament resource model labels', function (): void {
App::setLocale('tk');
expect(DepartmentResource::getPluralModelLabel())->toBe('Bölümler');
expect(DepartmentResource::getModelLabel())->toBe('Bölüm');
App::setLocale('ru');
expect(DepartmentResource::getPluralModelLabel())->toBe('Отделы');
expect(DepartmentResource::getModelLabel())->toBe('Отдел');
});
it('returns translated filament panel strings for turkmen locale', function (): void {
App::setLocale('tk');
expect(__('filament-panels::global-search.field.placeholder'))->toBe('Gözleg');
expect(__('filament-panels::resources/pages/list-records.breadcrumb'))->toBe('Sanaw');
expect(__('filament-actions::create.single.label', ['label' => 'Bölüm']))->toBe('Döret');
});
it('persists locale when locale changed event fires', function (): void {
$user = User::factory()->create(['locale' => 'en']);