*/ private const LOCALES = ['pt_BR', 'en', 'es']; /** * Sign label keys rendered by the 3D letreiros. * * @var list */ private const KEYS = [ 'city.sign_plaza', 'city.sign_beach', 'city.sign_food', 'city.sign_hospital', 'city.sign_school', 'city.sign_cityhall', ]; /** * Every sign label exists (non-empty) in all three languages. */ public function test_sign_labels_exist_in_all_locales(): void { foreach (self::LOCALES as $locale) { $path = base_path("lang/{$locale}.json"); $this->assertFileExists($path); $labels = json_decode((string) file_get_contents($path), true); $this->assertIsArray($labels); foreach (self::KEYS as $key) { $this->assertArrayHasKey($key, $labels, "Missing {$key} in {$locale}"); $this->assertNotSame('', trim((string) $labels[$key]), "Empty {$key} in {$locale}"); } } } /** * The labels reach the viewer page for the active locale. */ public function test_viewer_page_carries_sign_labels(): void { $this->seed(CityWorldSeeder::class); $user = User::factory()->create([ 'status' => User::STATUS_ACTIVE, 'is_active' => true, ]); $this->actingAs($user); $html = $this->get('/city')->assertOk()->getContent(); foreach (['signPlaza', 'signBeach', 'signFood', 'signHospital', 'signSchool', 'signCityhall'] as $jsKey) { $this->assertStringContainsString($jsKey.':', $html, "Missing i18n entry {$jsKey}"); } } }