Skip to content

Commit

Permalink
Improve tests for #15830
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Feb 12, 2020
1 parent dc69fbf commit 190ad75
Showing 1 changed file with 59 additions and 3 deletions.
62 changes: 59 additions & 3 deletions test/classes/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2057,19 +2057,22 @@ public function providerGetTitleForTarget()
/**
* localised date test, globals are defined
*
* @param string $a Current timestamp
* @param int $a Current timestamp
* @param string $b Format
* @param string $e Expected output
* @param string $tz Timezone to set
* @param string $locale Locale to set
*
* @return void
*
* @covers \PhpMyAdmin\Util::localisedDate
* @dataProvider providerLocalisedDate
*/
public function testLocalisedDate($a, $b, $e): void
public function testLocalisedDate(int $a, string $b, string $e, string $tz, string $locale): void
{
_setlocale(LC_ALL, $locale);
$tmpTimezone = date_default_timezone_get();
date_default_timezone_set('Europe/London');
date_default_timezone_set($tz);

$this->assertEquals(
$e,
Expand All @@ -2091,11 +2094,64 @@ public function providerLocalisedDate()
1227455558,
'',
'Nov 23, 2008 at 03:52 PM',
'Europe/London',
'en',
],
[
1227455558,
'%Y-%m-%d %H:%M:%S %a',
'2008-11-23 15:52:38 Sun',
'Europe/London',
'en',
],
[
1227455558,
'%Y-%m-%d %H:%M:%S %a',
'2008-11-23 16:52:38 Sun',
'Europe/Paris',
'en',
],
[
1227455558,
'%Y-%m-%d %H:%M:%S %a',
'2008-11-24 00:52:38 Mon',
'Asia/Tokyo',
'en',
],
[
1227455558,
'%a %A %b %B',
'Mon Mon Nov Nov',
'Asia/Tokyo',
'en',
],
[
1227455558,
'%Y-%m-%d %H:%M:%S %a',
'2008-11-24 00:52:38 月',
'Asia/Tokyo',
'ja',
],
[
1227455558,
'%a %A %b %B',
'月 月 11 月 11 月',
'Asia/Tokyo',
'ja',
],
[
1227455558,
'月月',
'月月',
'Asia/Tokyo',
'ja',
],
[
1227455558,
'%Y 年 2 月 %d 日 %H:%M',
'2008 年 2 月 24 日 00:52',
'Asia/Tokyo',
'ja',
],
];
}
Expand Down

0 comments on commit 190ad75

Please sign in to comment.