diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-30 06:30:21 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-30 06:30:21 +0000 |
commit | 35d221ea41921ec7be1a1a0523166b3947329074 (patch) | |
tree | 918ecba43eebe3ad17fd09ab89b71352e6833b7f /modules/simpletest | |
parent | 6c881d9c5a379ea6b94b07f5b17613940ebbcc50 (diff) | |
download | brdo-35d221ea41921ec7be1a1a0523166b3947329074.tar.gz brdo-35d221ea41921ec7be1a1a0523166b3947329074.tar.bz2 |
#826486 by kscheirer, drunken monkey, tstoeckler, jhodgdon, sun: Fixed format_date() does not respect admin-defined date formats
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/tests/common.test | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 793770521..9bbbeabfa 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -2091,6 +2091,32 @@ class FormatDateUnitTest extends DrupalWebTestCase { } /** + * Test admin-defined formats in format_date(). + */ + function testAdminDefinedFormatDate() { + // Create an admin user. + $this->admin_user = $this->drupalCreateUser(array('administer site configuration')); + $this->drupalLogin($this->admin_user); + + // Add new date format. + $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 new date type. + $edit = array( + 'date_type' => 'Example Style', + 'machine_name' => 'example_style', + 'date_format' => $admin_date_format, + ); + $this->drupalPost('admin/config/regional/date-time/types/add', $edit, t('Add date type')); + + $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, 'undefined_style'), format_date($timestamp, 'medium'), t('Test format_date() defaulting to medium when $type not found.')); + } + + /** * Tests for the format_date() function. */ function testFormatDate() { |