diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index e8e403330c49544bb70c0f61bf29d972fdfb2dd7..cc4606951c290b45726ed1ed2a658d1d8d4708c5 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -2298,6 +2298,12 @@ class FormatDateUnitTest extends DrupalWebTestCase { $edit = array('date_format' => $admin_date_format); $this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format')); + // Add a new date format which just differs in the case. + $admin_date_format_uppercase = 'j M Y'; + $edit = array('date_format' => $admin_date_format_uppercase); + $this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format')); + $this->assertText(t('Custom date format added.')); + // Add new date type. $edit = array( 'date_type' => 'Example Style', @@ -2306,8 +2312,18 @@ class FormatDateUnitTest extends DrupalWebTestCase { ); $this->drupalPost('admin/config/regional/date-time/types/add', $edit, t('Add date type')); + // Add a second date format with a different case than the first. + $edit = array( + 'machine_name' => 'example_style_uppercase', + 'date_type' => 'Example Style Uppercase', + 'date_format' => $admin_date_format_uppercase, + ); + $this->drupalPost('admin/config/regional/date-time/types/add', $edit, t('Add date type')); + $this->assertText(t('New date type added successfully.')); + $timestamp = strtotime('2007-03-10T00:00:00+00:00'); $this->assertIdentical(format_date($timestamp, 'example_style', '', 'America/Los_Angeles'), '9 Mar 07', t('Test format_date() using an admin-defined date type.')); + $this->assertIdentical(format_date($timestamp, 'example_style_uppercase', '', 'America/Los_Angeles'), '9 Mar 2007', 'Test format_date() using an admin-defined date type with different case.'); $this->assertIdentical(format_date($timestamp, 'undefined_style'), format_date($timestamp, 'medium'), t('Test format_date() defaulting to medium when $type not found.')); } diff --git a/modules/simpletest/tests/upgrade/upgrade.test b/modules/simpletest/tests/upgrade/upgrade.test index 9df8ec77934cfe1ec7920e4ca65643e3dd57d1e2..cc849aa794eb00d4b42915938a4532add65e337e 100644 --- a/modules/simpletest/tests/upgrade/upgrade.test +++ b/modules/simpletest/tests/upgrade/upgrade.test @@ -566,6 +566,20 @@ class BasicMinimalUpdatePath extends UpdatePathTestCase { // Confirm that no {menu_links} entry exists for user/autocomplete. $result = db_query('SELECT COUNT(*) FROM {menu_links} WHERE link_path = :user_autocomplete', array(':user_autocomplete' => 'user/autocomplete'))->fetchField(); $this->assertFalse($result, t('No {menu_links} entry exists for user/autocomplete')); + + // Confirm that a date format that just differs in the case can be added. + $admin_date_format = 'j M y'; + $edit = array('date_format' => $admin_date_format); + $this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format')); + + // Add a new date format which just differs in the case. + $admin_date_format_uppercase = 'j M Y'; + $edit = array('date_format' => $admin_date_format_uppercase); + $this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format')); + $this->assertText(t('Custom date format added.')); + + // Verify that the unique key on {date_formats}.format still exists. + $this->assertTrue(db_index_exists('date_formats', 'formats'), 'Unique key on {date_formats} exists'); } } diff --git a/modules/system/system.install b/modules/system/system.install index 338e73a211537787075868c729d32b8ce7028cbf..59bb2f14a6aef54f4b1769452fc189329484443f 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -744,6 +744,7 @@ function system_schema() { 'type' => 'varchar', 'length' => 100, 'not null' => TRUE, + 'binary' => TRUE, ), 'type' => array( 'description' => 'The date format type, e.g. medium.', @@ -3088,6 +3089,21 @@ function system_update_7077() { )); } + +/** + * Add binary to {date_formats}.format. + */ +function system_update_7078() { + db_drop_unique_key('date_formats', 'formats'); + db_change_field('date_formats', 'format', 'format', array( + 'description' => 'The date format string.', + 'type' => 'varchar', + 'length' => 100, + 'not null' => TRUE, + 'binary' => TRUE, + ), array('unique keys' => array('formats' => array('format', 'type')))); +} + /** * @} End of "defgroup updates-7.x-extra". * The next series of updates should start at 8000.