diff options
Diffstat (limited to 'tests/languages/fr')
-rw-r--r-- | tests/languages/fr/UtilsFrTest.php | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/languages/fr/UtilsFrTest.php b/tests/languages/fr/UtilsFrTest.php index 890308d3..45996ee2 100644 --- a/tests/languages/fr/UtilsFrTest.php +++ b/tests/languages/fr/UtilsFrTest.php | |||
@@ -22,4 +22,80 @@ class UtilsFrTest extends UtilsTest | |||
22 | $date = DateTime::createFromFormat('Ymd_His', '20170101_101112'); | 22 | $date = DateTime::createFromFormat('Ymd_His', '20170101_101112'); |
23 | $this->assertEquals('dim. 01 janv. 2017 10:11:12 EAT', format_date($date, false)); | 23 | $this->assertEquals('dim. 01 janv. 2017 10:11:12 EAT', format_date($date, false)); |
24 | } | 24 | } |
25 | |||
26 | /** | ||
27 | * Test autoLocale with a simple value | ||
28 | */ | ||
29 | public function testAutoLocaleValid() | ||
30 | { | ||
31 | $current = setlocale(LC_ALL, 0); | ||
32 | $header = 'de-de'; | ||
33 | autoLocale($header); | ||
34 | $this->assertEquals('de_DE.utf8', setlocale(LC_ALL, 0)); | ||
35 | |||
36 | setlocale(LC_ALL, $current); | ||
37 | } | ||
38 | |||
39 | /** | ||
40 | * Test autoLocale with an alternative locale value | ||
41 | */ | ||
42 | public function testAutoLocaleValidAlternative() | ||
43 | { | ||
44 | $current = setlocale(LC_ALL, 0); | ||
45 | $header = 'de_de.UTF8'; | ||
46 | autoLocale($header); | ||
47 | $this->assertEquals('de_DE.utf8', setlocale(LC_ALL, 0)); | ||
48 | |||
49 | setlocale(LC_ALL, $current); | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * Test autoLocale with multiples value, the first one is valid | ||
54 | */ | ||
55 | public function testAutoLocaleMultipleFirstValid() | ||
56 | { | ||
57 | $current = setlocale(LC_ALL, 0); | ||
58 | $header = 'de-de;en-us'; | ||
59 | autoLocale($header); | ||
60 | $this->assertEquals('de_DE.utf8', setlocale(LC_ALL, 0)); | ||
61 | |||
62 | setlocale(LC_ALL, $current); | ||
63 | } | ||
64 | |||
65 | /** | ||
66 | * Test autoLocale with multiples value, the second one is valid | ||
67 | */ | ||
68 | public function testAutoLocaleMultipleSecondValid() | ||
69 | { | ||
70 | $current = setlocale(LC_ALL, 0); | ||
71 | $header = 'pt_BR,de-de'; | ||
72 | autoLocale($header); | ||
73 | $this->assertEquals('de_DE.utf8', setlocale(LC_ALL, 0)); | ||
74 | |||
75 | setlocale(LC_ALL, $current); | ||
76 | } | ||
77 | |||
78 | /** | ||
79 | * Test autoLocale without value: defaults to en_US. | ||
80 | */ | ||
81 | public function testAutoLocaleBlank() | ||
82 | { | ||
83 | $current = setlocale(LC_ALL, 0); | ||
84 | autoLocale(''); | ||
85 | $this->assertEquals('en_US.utf8', setlocale(LC_ALL, 0)); | ||
86 | |||
87 | setlocale(LC_ALL, $current); | ||
88 | } | ||
89 | |||
90 | /** | ||
91 | * Test autoLocale with an invalid value: defaults to en_US. | ||
92 | */ | ||
93 | public function testAutoLocaleInvalid() | ||
94 | { | ||
95 | $current = setlocale(LC_ALL, 0); | ||
96 | autoLocale('pt_BR'); | ||
97 | $this->assertEquals('en_US.utf8', setlocale(LC_ALL, 0)); | ||
98 | |||
99 | setlocale(LC_ALL, $current); | ||
100 | } | ||
25 | } | 101 | } |