? local-time-and-tests.patch
? local_time_1.patch
? local_time_working.patch
Index: clock.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/clock/clock.module,v
retrieving revision 1.9.2.10
diff -u -p -r1.9.2.10 clock.module
--- clock.module	17 May 2010 22:04:18 -0000	1.9.2.10
+++ clock.module	24 May 2010 22:26:51 -0000
@@ -222,7 +222,7 @@ function clock_theme() {
  *   'Local' is returned.
  */
 function clock_get_timezone() {
-  $timezone_type = variable_get('clock_timezone_type', 'site');
+  $timezone_type = variable_get('clock_timezone_type', '1');
 
   switch ($timezone_type) {
     // Site time zone.
@@ -242,7 +242,7 @@ function clock_get_timezone() {
       $timezone = variable_get('clock_custom_timezone', 'UTC');
       break;
   }
-  print_r($timezone);
+
   return $timezone;
 }
 
@@ -299,7 +299,7 @@ function theme_clock($timezone, $date_fo
     // Pass the variables to JavaScript.
     drupal_add_js(array(
       'update' => $js,
-      'local' => $local,
+      'local' => isset($local) ? TRUE : FALSE,
       'time' => $time,
       'offset_seconds' => $offset_seconds,
       'timezone_name' => $timezone,
Index: clock.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/clock/clock.test,v
retrieving revision 1.4.2.2
diff -u -p -r1.4.2.2 clock.test
--- clock.test	3 May 2010 16:39:40 -0000	1.4.2.2
+++ clock.test	24 May 2010 22:26:51 -0000
@@ -32,16 +32,15 @@ class ClockBlockTestCase extends DrupalW
     $this->drupalPost('admin/build/block', $edit, 'Save blocks');
   }
 
-  public function testClockBlockDefault() {
+  public function testClockBlock() {
+    // Test the default display.
     $clock = date_format_date(date_now('UTC'), 'short');
     $this->assertText($clock, t('Ensure that the clock is correctly displayed by default.'));
     $edit['timezone'] = '3';
     $this->drupalPost('admin/build/block/configure/clock/clock', $edit, 'Save block');
     $this->assertText($clock, t('Ensure that the clock falls back to the site time with Local time zone enabled and without JavaScript.'));
-  }
 
-  public function testClockBlockUserTimezone() {
-    // Set the user's time zone to something different from the site default.
+    // Test the user time zone.
     $edit = array();
     $edit['timezone_name'] = 'Pacific/Fiji';
     $this->drupalPost('user/' . variable_get('test_user_id', '1') . '/edit', $edit, 'Save');
@@ -51,51 +50,47 @@ class ClockBlockTestCase extends DrupalW
     $this->drupalPost('admin/build/block/configure/clock/clock', $edit, 'Save block');
     $clock = date_format_date(date_now('Pacific/Fiji'), 'short');
     $this->assertText($clock, t('Ensure that the clock is correctly displayed in the user time zone.'));
-  }
 
-  public function testClockBlockCustomTimezone() {
-    // Set the clock block to display a custom time zone.
+    // Test a custom time zone.
     $edit = array();
     $edit['timezone'] = '4';
-    $edit['custom_timezone'] = 'Africa/Timbuktu';
+    $edit['custom_timezone'] = 'Africa/Lubumbashi';
+    $this->drupalPost('admin/build/block/configure/clock/clock', $edit, 'Save block');
+    $clock = date_format_date(date_now('Africa/Lubumbashi'), 'short');
+    $this->assertText($clock, t('Ensure that the clock is correctly displayed in a custom date format.'));
+    // Reset the time zone.
+    $edit['timezone'] = '1';
     $this->drupalPost('admin/build/block/configure/clock/clock', $edit, 'Save block');
-    $clock = date_format_date(date_now('Africa/Timbuktu'), 'short');
-    $this->assert($clock, t('Ensure that the clock is correctly displayed in a custom date format.'));
-  }
 
-  public function testClockBlockMediumDateFormat() {
-    // Set the clock block to display the medium date format.
+    // Test the medium date format.
     $edit = array();
     $edit['date_format'] = 'medium';
     $this->drupalPost('admin/build/block/configure/clock/clock', $edit, 'Save block');
     $clock = date_format_date(date_now(), 'medium');
-    $this->assert($clock, t('Ensure that the clock is correctly displayed in the medium date format.'));
-  }
+    $this->assertText($clock, t('Ensure that the clock is correctly displayed in the medium date format.'));
 
-  public function testClockBlockLongDateFormat() {
-    // Set the clock block to display the long date format.
+    // Test the long date format.
     $edit = array();
     $edit['date_format'] = 'long';
     $this->drupalPost('admin/build/block/configure/clock/clock', $edit, 'Save block');
     $clock = date_format_date(date_now(), 'long');
-    $this->assert($clock, t('Ensure that the clock is correctly displayed in the long date format.'));
-  }
+    $this->assertText($clock, t('Ensure that the clock is correctly displayed in the long date format.'));
 
-  public function testClockBlockCustomDateFormat() {
+    // Test a custom date format.
     $this->drupalGet('admin/build/block/configure/clock/clock');
     $this->assertNoText('Custom date format', t('Ensure that no custom date formats are displayed if there are none.'));
     // Create a custom date format.
     $edit = array();
-    $edit['add_date_format'] = 'aABcdDeFgGhHiIjlmMnNoOPrsStTuUwWYyzZ';
+    $edit['add_date_format'] = 'aAbBcCdDeEfFgGhHiIjJlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ';
     $this->drupalPost('admin/settings/date-time/formats/add', $edit, 'Save configuration');
     $this->drupalGet('admin/build/block/configure/clock/clock');
     $this->assertText('Custom time zone', t('Ensure that custom date formats displayed.'));
     // Set the clock block to display the custom format.
     $edit = array();
     $edit['date_format'] = 'custom';
-    $edit['custom_date_format'] = 'aABcdDeFgGhHiIjlmMnNoOPrsStTuUwWYyzZ';
+    $edit['custom_date_format'] = 'aAbBcCdDeEfFgGhHiIjJlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ';
     $this->drupalPost('admin/build/block/configure/clock/clock', $edit, 'Save block');
-    $clock = date_format_date(date_now(), 'custom', 'aABcdDFgGhHiIjlmMnOrsStTUwWYyzZ');
+    $clock = date_format_date(date_now(), 'custom', 'aAbBcCdDeEfFgGhHiIjJlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ');
     $this->assertText($clock, t('Ensure that the clock is correctly displayed in a custom format.'));
   }
 
