]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - tests/languages/de/UtilsDeTest.php
3 require_once 'tests/UtilsTest.php';
6 class UtilsDeTest
extends UtilsTest
11 public function testDateFormat()
13 $date = DateTime
::createFromFormat('Ymd_His', '20170101_101112');
14 $this->assertRegExp('/1. Januar 2017 (um )?10:11:12 GMT\+0?3(:00)?/', format_date($date, true));
18 * Test date_format() using builtin PHP function strftime.
20 public function testDateFormatDefault()
22 $date = DateTime
::createFromFormat('Ymd_His', '20170101_101112');
23 $this->assertEquals('So 01 Jan 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('en_US.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 = 'en_us.UTF8';
47 $this->assertEquals('en_US.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 = 'en-us,de-de';
60 $this->assertEquals('en_US.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,fr-fr';
73 $this->assertEquals('fr_FR.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);