]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - UtilsFrTest.php
45996ee27318c37c6e0e3db2ef76d58ca990a636
3 require_once 'tests/UtilsTest.php';
6 class UtilsFrTest
extends UtilsTest
11 public function testDateFormat()
13 $date = DateTime
::createFromFormat('Ymd_His', '20170101_101112');
14 $this->assertRegExp('/1 janvier 2017 (à )?10:11:12 UTC\+0?3(:00)?/', format_date($date));
18 * Test date_format() using builtin PHP function strftime.
20 public function testDateFormatDefault()
22 $date = DateTime
::createFromFormat('Ymd_His', '20170101_101112');
23 $this->assertEquals('dim. 01 janv. 2017 10:11:12 EAT', format_date($date, false));
27 * Test autoLocale with a simple value
29 public function testAutoLocaleValid()
31 $current = setlocale(LC_ALL
, 0);
34 $this->assertEquals('de_DE.utf8', setlocale(LC_ALL
, 0));
36 setlocale(LC_ALL
, $current);
40 * Test autoLocale with an alternative locale value
42 public function testAutoLocaleValidAlternative()
44 $current = setlocale(LC_ALL
, 0);
45 $header = 'de_de.UTF8';
47 $this->assertEquals('de_DE.utf8', setlocale(LC_ALL
, 0));
49 setlocale(LC_ALL
, $current);
53 * Test autoLocale with multiples value, the first one is valid
55 public function testAutoLocaleMultipleFirstValid()
57 $current = setlocale(LC_ALL
, 0);
58 $header = 'de-de;en-us';
60 $this->assertEquals('de_DE.utf8', setlocale(LC_ALL
, 0));
62 setlocale(LC_ALL
, $current);
66 * Test autoLocale with multiples value, the second one is valid
68 public function testAutoLocaleMultipleSecondValid()
70 $current = setlocale(LC_ALL
, 0);
71 $header = 'pt_BR,de-de';
73 $this->assertEquals('de_DE.utf8', setlocale(LC_ALL
, 0));
75 setlocale(LC_ALL
, $current);
79 * Test autoLocale without value: defaults to en_US.
81 public function testAutoLocaleBlank()
83 $current = setlocale(LC_ALL
, 0);
85 $this->assertEquals('en_US.utf8', setlocale(LC_ALL
, 0));
87 setlocale(LC_ALL
, $current);
91 * Test autoLocale with an invalid value: defaults to en_US.
93 public function testAutoLocaleInvalid()
95 $current = setlocale(LC_ALL
, 0);
97 $this->assertEquals('en_US.utf8', setlocale(LC_ALL
, 0));
99 setlocale(LC_ALL
, $current);