Index: project_usage.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/usage/project_usage.module,v
retrieving revision 1.6.2.11
diff -u -p -r1.6.2.11 project_usage.module
--- project_usage.module	4 Dec 2008 05:48:28 -0000	1.6.2.11
+++ project_usage.module	11 Dec 2008 20:50:25 -0000
@@ -466,7 +466,6 @@ function project_usage_gmgetdate($timest
  * @param $days_ago
  *   An integer specifying a number of days previous. A value of 0 indicates
  *   the current day.
- *
  * @return
  *   GMT UNIX timestamp.
  */
@@ -483,8 +482,8 @@ function project_usage_daily_timestamp($
  *   Mixed. Integer timestamp or an array returned by project_usage_gmgetdate().
  * @param $weeks_ago
  *   An integer specifying a number of weeks previous. A value of 0 indicates
- *   the current week.
- *
+ *   the current week. Negative values result in past timestamps while positive
+ *   values result in future timestamps.
  * @return
  *   GMT UNIX timestamp.
  */
Index: tests/date_rounding.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/usage/tests/date_rounding.test,v
retrieving revision 1.1
diff -u -p -r1.1 date_rounding.test
--- tests/date_rounding.test	14 Sep 2007 16:17:55 -0000	1.1
+++ tests/date_rounding.test	11 Dec 2008 20:50:25 -0000
@@ -13,10 +13,10 @@ class ProjectUsageGetDateTests extends D
   function test_timestamp_param() {
     $time = time();
     $parts = project_usage_gmgetdate($time);
-    
-    // PHP's getdate() takes the timezone into account. project_usage_gmgetdate() 
+
+    // PHP's getdate() takes the timezone into account. project_usage_gmgetdate()
     // should subtract the timezone from the timestamp to cancel it out. We
-    // can compare the input to the timestamp in the returned array and make 
+    // can compare the input to the timestamp in the returned array and make
     // sure they differ by the timezone offset.
     $offset = date('Z', $time);
     $expected = $time - $offset;
@@ -30,10 +30,10 @@ class ProjectUsageGetDateTests extends D
     // will be executed in the same second.
     $time = time();
     $parts = project_usage_gmgetdate();
-    
-    // PHP's getdate() takes the timezone into account. project_usage_gmgetdate() 
+
+    // PHP's getdate() takes the timezone into account. project_usage_gmgetdate()
     // should subtract the timezone from the timestamp to cancel it out. We
-    // can compare the input to the timestamp in the returned array and make 
+    // can compare the input to the timestamp in the returned array and make
     // sure they differ by the timezone offset.
     $offset = date('Z', $time);
     $expected = $time - $offset;
@@ -57,14 +57,14 @@ class ProjectUsageUsageDailyTimestampTes
   function format_date($timestamp) {
     return format_date($timestamp, 'short', NULL, 0);
   }
-  
+
   function test_default_param() {
     $time = time();
     $expected = project_usage_daily_timestamp($time);
     $actual = project_usage_daily_timestamp();
 
     $this->assertEqual($expected, $actual, $this->format_date($time) .' should round to '. $this->format_date($expected) .' got '. $this->format_date($actual));
-  }  
+  }
   function test_timestamp_param() {
     $time = 1189700682;
     $expected = 1189641600;
@@ -91,11 +91,16 @@ class ProjectUsageUsageWeeklyTimestampTe
     );
   }
 
+  function setUp() {
+    parent::setUp();
+    $this->timestamp = 1189700682; // 09/13/2007 - 16:24
+  }
+
   function format_date($timestamp) {
     return format_date($timestamp, 'short', NULL, 0);
   }
 
-  function test_default_param() {
+  function test_default_params() {
     $time = time();
     $expected = project_usage_weekly_timestamp($time);
     $actual = project_usage_weekly_timestamp();
@@ -103,18 +108,35 @@ class ProjectUsageUsageWeeklyTimestampTe
     $this->assertEqual($expected, $actual, $this->format_date($time) .' should round to '. $this->format_date($expected) .' got '. $this->format_date($actual));
   }
   function test_timestamp_param() {
-    $time = 1189700682;
-    $expected = 1189296000;
-    $actual = project_usage_weekly_timestamp($time);
+    $expected = 1189296000; // Sun, 09/09/2007 - 00:00
+    $actual = project_usage_weekly_timestamp($this->timestamp);
 
-    $this->assertEqual($expected, $actual, $this->format_date($time) .' should round to '. $this->format_date($expected) .' got '. $this->format_date($actual));
+    $this->assertEqual($expected, $actual, $this->format_date($this->timestamp) .' should round to '. $this->format_date($expected) .' got '. $this->format_date($actual));
   }
   function test_array_param() {
-    $time = 1189700682;
-    $expected = 1189296000;
-    $actual = project_usage_weekly_timestamp(project_usage_gmgetdate($time));
+    $expected = 1189296000; // Sun, 09/09/2007 - 00:00
+    $actual = project_usage_weekly_timestamp(project_usage_gmgetdate($this->timestamp));
 
-    $this->assertEqual($expected, $actual, $this->format_date($time) .' should round to '. $this->format_date($expected) .' got '. $this->format_date($actual));
+    $this->assertEqual($expected, $actual, $this->format_date($this->timestamp) .' should round to '. $this->format_date($expected) .' got '. $this->format_date($actual));
+  }
+
+  function test_weeks_default() {
+    $expected = 1189296000; // Sun, 09/09/2007 - 00:00
+    $actual = project_usage_weekly_timestamp($this->timestamp, 0);
+
+    $this->assertEqual($expected, $actual, "exp: $expected act: $actual ". $this->format_date($this->timestamp) .' should round to '. $this->format_date($expected) .' got '. $this->format_date($actual));
+  }
+  function test_weeks_future() {
+    $expected = 1189900800; // 09/16/2007 - 00:00
+    $actual = project_usage_weekly_timestamp($this->timestamp, 1);
+
+    $this->assertEqual($expected, $actual, "exp: $expected act: $actual ". $this->format_date($this->timestamp) .' should round to '. $this->format_date($expected) .' got '. $this->format_date($actual));
+  }
+  function test_weeks_past() {
+    $expected = 1188691200; // Sun, 09/02/2007 - 00:00
+    $actual = project_usage_weekly_timestamp($this->timestamp, -1);
+
+    $this->assertEqual($expected, $actual, "exp: $expected act: $actual ". $this->format_date($this->timestamp) .' should round to '. $this->format_date($expected) .' got '. $this->format_date($actual));
   }
 }
 
