MyShaarli/tests/languages/fr/UtilsFrTest.php
ArthurHoaro 52b503105d Improve datetime display
Use php-intl extension to display datetimes a bit more nicely, depending on the locale.

What changes:

  * the day is no longer displayed
  * day number and month are ordered according to the locale
  * the timezone is more readable (UTC+1 instead of CET)
2017-03-06 21:11:12 +01:00

25 lines
651 B
PHP

<?php
require_once 'tests/UtilsTest.php';
class UtilsFrTest extends UtilsTest
{
/**
* Test date_format().
*/
public function testDateFormat()
{
$date = DateTime::createFromFormat('Ymd_His', '20170101_101112');
$this->assertRegExp('/1 janvier 2017 (à )?10:11:12 UTC\+0?3(:00)?/', format_date($date));
}
/**
* Test date_format() using builtin PHP function strftime.
*/
public function testDateFormatDefault()
{
$date = DateTime::createFromFormat('Ymd_His', '20170101_101112');
$this->assertEquals('dim. 01 janv. 2017 10:11:12 EAT', format_date($date, false));
}
}