summaryrefslogtreecommitdiff
path: root/modules/system/system.test
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2008-11-20 06:56:17 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2008-11-20 06:56:17 +0000
commit53f53b6db5949c7d8e6b57253987a4eddf7a26ca (patch)
treead8ad53d7d351d6dbcf10e9a2f53a53cd6e40850 /modules/system/system.test
parent07211d4019373820abe9e429ff81656105dcbb9d (diff)
downloadbrdo-53f53b6db5949c7d8e6b57253987a4eddf7a26ca.tar.gz
brdo-53f53b6db5949c7d8e6b57253987a4eddf7a26ca.tar.bz2
#11077 by mfb, KarenS, macgirvin, and jjkd: Can you say Daylight Savings Time? I bet you didn't think Drupal ever would! :)
Diffstat (limited to 'modules/system/system.test')
-rw-r--r--modules/system/system.test45
1 files changed, 44 insertions, 1 deletions
diff --git a/modules/system/system.test b/modules/system/system.test
index 8db303a06..756b6c196 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -469,6 +469,50 @@ class PageNotFoundTestCase extends DrupalWebTestCase {
}
}
+/**
+ * Tests generic date and time handling capabilities of Drupal.
+ */
+class DateTimeFunctionalTest extends DrupalWebTestCase {
+ function getInfo() {
+ return array(
+ 'name' => t('Date and time'),
+ 'description' => t('Configure date and time settings. Test date formatting and time zone handling, including daylight saving time.'),
+ 'group' => t('System'),
+ );
+ }
+
+ /**
+ * Test time zones and DST handling.
+ */
+ function testTimeZoneHandling() {
+ // Setup date/time settings for Honolulu time.
+ variable_set('date_default_timezone', 'Pacific/Honolulu');
+ variable_set('configurable_timezones', 0);
+ variable_set('date_format_medium', 'Y-m-d H:i:s O');
+
+ // Create some nodes with different authored-on dates.
+ $date1 = '2007-01-31 21:00:00 -1000';
+ $date2 = '2007-07-31 21:00:00 -1000';
+ $node1 = $this->drupalCreateNode(array('created' => strtotime($date1), 'type' => 'article'));
+ $node2 = $this->drupalCreateNode(array('created' => strtotime($date2), 'type' => 'article'));
+
+ // Confirm date format and time zone.
+ $this->drupalGet("node/$node1->nid");
+ $this->assertText('2007-01-31 21:00:00 -1000', t('Date should be identical, with GMT offset of -10 hours.'));
+ $this->drupalGet("node/$node2->nid");
+ $this->assertText('2007-07-31 21:00:00 -1000', t('Date should be identical, with GMT offset of -10 hours.'));
+
+ // Set time zone to Los Angeles time.
+ variable_set('date_default_timezone', 'America/Los_Angeles');
+
+ // Confirm date format and time zone.
+ $this->drupalGet("node/$node1->nid");
+ $this->assertText('2007-01-31 23:00:00 -0800', t('Date should be two hours ahead, with GMT offset of -8 hours.'));
+ $this->drupalGet("node/$node2->nid");
+ $this->assertText('2007-08-01 00:00:00 -0700', t('Date should be three hours ahead, with GMT offset of -7 hours.'));
+ }
+}
+
class PageTitleFiltering extends DrupalWebTestCase {
protected $content_user;
protected $saved_title;
@@ -532,4 +576,3 @@ class PageTitleFiltering extends DrupalWebTestCase {
$this->assertText(check_plain($edit['title']), 'Check to make sure tags in the node title are converted.');
}
}
-