Skip to content

MAGIK-933: Integration Testing — Multi-Locale End-to-End #112

@MAGIKBIT

Description

@MAGIKBIT

Story 12 — Integration Testing: Multi-Locale End-to-End

Epic: EPIC-010 — Global Internationalization & Multi-Language Support (GitHub #100)
Priority: P2

User Story

As a developer, I want comprehensive integration tests covering all 5 locales across critical user paths, so I can be confident that internationalization works correctly end-to-end.

Requirements

Test Categories

1. Locale Detection & Switching Tests
# Test Validates
1 testDefaultLocaleIsEnglish New session defaults to en
2 testQueryParamSwitchesLocale ?lang=es sets Spanish
3 testSessionPersistsLocale Locale persists across requests
4 testCookieFallback Cookie used when no session
5 testAcceptLanguageHeader Browser header detected correctly
6 testInvalidLocaleFallsBack ?lang=xx falls back to en
2. Translation Rendering Tests
# Test Validates
7 testEnglishDashboardRendersCorrectly EN translations render
8 testSpanishDashboardRendersCorrectly ES translations render
9 testArabicDashboardRendersCorrectly AR translations render
10 testAmharicDashboardRendersCorrectly AM translations render
11 testTigrignaRendersCorrectly TI translations render
12 testMissingKeyFallsBackToEnglish Missing key → English fallback
13 testParameterizedTranslation {0} placeholders resolved
3. RTL Layout Tests
# Test Validates
14 testArabicSetsRtlDirection dir="rtl" on <html>
15 testEnglishSetsLtrDirection dir="ltr" on <html>
16 testRtlStylesheetLoaded rtl.css included for Arabic
17 testRtlStylesheetNotLoadedForLtr rtl.css absent for English
4. Currency Formatting Tests
# Test Validates
18 testUsdFormatting $1,234.56
19 testEurFormatting €1.234,56 (European)
20 testEtbFormatting Br 1,234.56
21 testCurrencyConversion USD → ETB at stored rate
22 testInvalidCurrencyFallsBack Unknown code → USD
5. Phone Number Tests
# Test Validates
23 testUsPhoneValidation Valid US number passes
24 testEthiopianPhoneValidation Valid ET number passes
25 testInvalidPhoneRejected Invalid number fails
26 testE164Storage Phone stored as +XXXXXXXXXXX
27 testPhoneDisplayFormatting Display format matches locale
6. Address Format Tests
# Test Validates
28 testUsAddressFormat US format with ZIP
29 testEthiopianAddressFormat Ethiopia format without ZIP
30 testCountryChangesFieldRequirements Dynamic field validation
7. Board Rendering Tests (All Locales)
# Test Validates
31-35 test{Board}RendersInAllLocales Each board × 5 locales
36 testLanguageSwitcherPresent Switcher in nav bar
37 testLanguageSwitcherChangesLanguage Click switches locale
8. vCard International Tests
# Test Validates
38 testVcardUtf8Encoding Ge'ez characters in vCard
39 testVcardInternationalPhone E.164 TEL property
40 testVcardInternationalAddress Country-formatted address

Test Infrastructure

  • Test trait: LocaleTestTrait — helpers for setting locale in test requests
  • Test fixture: i18n_test_data.sql — test users with various locales/currencies
  • All tests in tests/integration/I18nTest.php

Acceptance Criteria

# Criteria Priority
1 40+ integration tests covering all i18n features P0
2 All 5 locales tested for critical paths P0
3 RTL rendering validated P1
4 Currency/phone/address formatting tested P1
5 All tests pass in CI pipeline P0
6 Test coverage > 80% for i18n code P2

Files to Create

  • app/app.portalv2/tests/integration/I18nTest.php
  • app/app.portalv2/tests/_support/Traits/LocaleTestTrait.php
  • app/app.portalv2/tests/_support/Fixtures/i18n_test_data.sql

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions