Issue #1817748 by markpavlitski, hgoto, wavesailor, Sophie.SK: /admin/config/regional/date-time does not show the correct default format for short and medium format

merge-requests/26/head
David Rothstein 2017-01-29 11:50:56 -05:00
parent 00b0726076
commit 8ad071fa68
3 changed files with 66 additions and 10 deletions

View File

@ -7,6 +7,8 @@ Drupal 7.54, xxxx-xx-xx (development version)
- Numerous API documentation improvements.
- Logging of searches can now be disabled.
- Added menu tree render structure to (pre-)process hooks for theme_menu_tree().
- Fixed incorrect default value for short and medium date formats on the date
type configuration page.
Drupal 7.53, 2016-12-07
-----------------------

View File

@ -12,11 +12,6 @@ function system_default_date_formats() {
$formats = array();
// Short date formats.
$formats[] = array(
'type' => 'short',
'format' => 'Y-m-d H:i',
'locales' => array(),
);
$formats[] = array(
'type' => 'short',
'format' => 'm/d/Y - H:i',
@ -37,6 +32,11 @@ function system_default_date_formats() {
'format' => 'd.m.Y - H:i',
'locales' => array('de-ch', 'de-de', 'de-lu', 'fi-fi', 'fr-ch', 'is-is', 'pl-pl', 'ro-ro', 'ru-ru'),
);
$formats[] = array(
'type' => 'short',
'format' => 'Y-m-d H:i',
'locales' => array(),
);
$formats[] = array(
'type' => 'short',
'format' => 'm/d/Y - g:ia',
@ -84,11 +84,6 @@ function system_default_date_formats() {
);
// Medium date formats.
$formats[] = array(
'type' => 'medium',
'format' => 'D, Y-m-d H:i',
'locales' => array(),
);
$formats[] = array(
'type' => 'medium',
'format' => 'D, m/d/Y - H:i',
@ -104,6 +99,11 @@ function system_default_date_formats() {
'format' => 'D, Y/m/d - H:i',
'locales' => array('en-ca', 'fr-ca', 'no-no', 'sv-se'),
);
$formats[] = array(
'type' => 'medium',
'format' => 'D, Y-m-d H:i',
'locales' => array(),
);
$formats[] = array(
'type' => 'medium',
'format' => 'F j, Y - H:i',

View File

@ -1461,6 +1461,60 @@ class DateTimeFunctionalTest extends DrupalWebTestCase {
}
}
/**
* Tests date format configuration.
*/
class DateFormatTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Date format',
'description' => 'Test date format configuration and defaults.',
'group' => 'System',
);
}
function setUp() {
parent::setUp();
// Create admin user and log in admin user.
$this->admin_user = $this->drupalCreateUser(array('administer site configuration'));
$this->drupalLogin($this->admin_user);
}
/**
* Test the default date type formats are consistent.
*/
function testDefaultDateFormats() {
// These are the default format values from format_date().
$default_formats = array(
'short' => 'm/d/Y - H:i',
'medium' => 'D, m/d/Y - H:i',
'long' => 'l, F j, Y - H:i',
);
// Clear the date format variables.
variable_del('date_format_short');
variable_del('date_format_medium');
variable_del('date_format_long');
$this->drupalGet('admin/config/regional/date-time');
foreach ($default_formats as $format_name => $format_value) {
$id = 'edit-date-format-' . $format_name;
// Check that the configuration fields match the default format.
$this->assertOptionSelected(
$id,
$format_value,
format_string('The @type format type matches the expected format @format.',
array(
'@type' => $format_name,
'@format' => $format_value,
)
));
}
}
}
class PageTitleFiltering extends DrupalWebTestCase {
protected $content_user;
protected $saved_title;