Add HR resource labels and helper methods for various resources; update locale handling in user model and department factory
This commit is contained in:
@@ -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']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user