[limb-svn] r6346 - in 3.x/trunk/limb/datetime: src tests/cases

svn at limb-project.com svn at limb-project.com
Mon Oct 1 13:31:24 MSD 2007


Author: svk
Date: 2007-10-01 13:31:24 +0400 (Mon, 01 Oct 2007)
New Revision: 6346
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6346

Modified:
   3.x/trunk/limb/datetime/src/lmbDate.class.php
   3.x/trunk/limb/datetime/tests/cases/lmbDateTest.class.php
Log:
negative timestamps allowed

Modified: 3.x/trunk/limb/datetime/src/lmbDate.class.php
===================================================================
--- 3.x/trunk/limb/datetime/src/lmbDate.class.php	2007-09-30 21:32:22 UTC (rev 6345)
+++ 3.x/trunk/limb/datetime/src/lmbDate.class.php	2007-10-01 09:31:24 UTC (rev 6346)
@@ -198,7 +198,7 @@
 
   protected function _setByStamp($time)
   {
-    if($time < 0 || !$arr = @getdate($time))
+    if(!$arr = @getdate($time))
       throw new lmbException("Could not setup date using stamp'$time'");
 
     $this->year   = $arr['year'];

Modified: 3.x/trunk/limb/datetime/tests/cases/lmbDateTest.class.php
===================================================================
--- 3.x/trunk/limb/datetime/tests/cases/lmbDateTest.class.php	2007-09-30 21:32:22 UTC (rev 6345)
+++ 3.x/trunk/limb/datetime/tests/cases/lmbDateTest.class.php	2007-10-01 09:31:24 UTC (rev 6346)
@@ -21,14 +21,12 @@
     catch(lmbException $e){}
   }
 
-  function testInvalidStamp()
+  function testNegativeStamp()
   {
-    try
-    {
-      $date = new lmbDate(-1);
-      $this->assertTrue(false);
-    }
-    catch(lmbException $e){}
+  	$date = new lmbDate(-564634800);
+  	$this->assertEqual($date->getDay(), 10);
+  	$this->assertEqual($date->getMonth(), 2);
+  	$this->assertEqual($date->getYear(), 1952);
   }
 
   function testInvalidTimeString()



More information about the limb-svn mailing list