mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
Merge branch 'MDL-62049_master' of git://github.com/markn86/moodle
This commit is contained in:
commit
c8619b28a3
@ -64,7 +64,7 @@ class transform {
|
||||
* @return string The translated string.
|
||||
*/
|
||||
public static function date($date) {
|
||||
return userdate($date, get_string('strftimetime', 'langconfig'));
|
||||
return userdate($date, get_string('strftimedate', 'langconfig'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,14 +53,37 @@ class request_transform_test extends advanced_testcase {
|
||||
* Test that the datetime is translated into a string.
|
||||
*/
|
||||
public function test_datetime() {
|
||||
$this->assertInternalType('string', transform::datetime(1));
|
||||
$time = 1;
|
||||
|
||||
$datestr = transform::datetime($time);
|
||||
|
||||
// Assert it is a string.
|
||||
$this->assertInternalType('string', $datestr);
|
||||
|
||||
// To prevent failures on MAC where we are returned with a lower-case 'am' we want to convert this to 'AM'.
|
||||
$datestr = str_replace('am', 'AM', $datestr);
|
||||
|
||||
// Assert the formatted date is correct.
|
||||
$dateobj = new DateTime();
|
||||
$dateobj->setTimestamp($time);
|
||||
$this->assertEquals($dateobj->format('l, j F Y, g:i A'), $datestr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the date is translated into a string.
|
||||
*/
|
||||
public function test_date() {
|
||||
$this->assertInternalType('string', transform::date(1));
|
||||
$time = 1;
|
||||
|
||||
$datestr = transform::date($time);
|
||||
|
||||
// Assert it is a string.
|
||||
$this->assertInternalType('string', $datestr);
|
||||
|
||||
// Assert the formatted date is correct.
|
||||
$dateobj = new DateTime();
|
||||
$dateobj->setTimestamp($time);
|
||||
$this->assertEquals($dateobj->format('j F Y'), $datestr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user