[pLog-svn] r5899 - plog/branches/lifetype-1.2/class/test/tests/locale

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Mon Sep 3 22:36:26 EDT 2007


Author: jondaley
Date: 2007-09-03 22:36:26 -0400 (Mon, 03 Sep 2007)
New Revision: 5899

Modified:
   plog/branches/lifetype-1.2/class/test/tests/locale/locale_test.class.php
Log:
something is funny here.  This test failed for me when the hour was 23 because I am in EDT, so the day is different than what was expected.  I changed it to 12 to avoid those sorts of problems, but PHP is not calculating the time correctly.  In my case, $diff is set to -4 (which is correct).  However, gmdate() is returning a number that is 5 hours off.  I am not sure what needs to happen to make this test pass.  I suspect it only works if the machine is set to GMT or something

Modified: plog/branches/lifetype-1.2/class/test/tests/locale/locale_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/locale/locale_test.class.php	2007-09-04 02:14:20 UTC (rev 5898)
+++ plog/branches/lifetype-1.2/class/test/tests/locale/locale_test.class.php	2007-09-04 02:36:26 UTC (rev 5899)
@@ -81,16 +81,19 @@
 		 */
 		function testFormatDateGMT()
 		{
-			$d = new Timestamp( "20070205230000" );			
+			$d = new Timestamp( "20070205120000" );
 			
+			$diff = $this->l->formatDate( new Timestamp(), "%O" );
+            $diff = $diff / 100;
+
 			$this->assertEquals( "Mon", $this->l->formatDateGMT( $d, "%a" ));
 			$this->assertEquals( "Monday", $this->l->formatDateGMT( $d, "%A" ));
 			$this->assertEquals( "Feb", $this->l->formatDateGMT( $d, "%b" ));
 			$this->assertEquals( "February", $this->l->formatDateGMT( $d, "%B" ));
 			$this->assertEquals( "05", $this->l->formatDateGMT( $d, "%d" ));
 			$this->assertEquals( "5", $this->l->formatDateGMT( $d, "%j" ));
-			$this->assertEquals( "21", $this->l->formatDateGMT( $d, "%H" ));
-			$this->assertEquals( "9", $this->l->formatDateGMT( $d, "%I" ));
+			$this->assertEquals( 12-$diff, $this->l->formatDateGMT( $d, "%H" ));
+			$this->assertEquals( "5", $this->l->formatDateGMT( $d, "%I" ));
 			$this->assertEquals( "pm", $this->l->formatDateGMT( $d, "%p" ));			
 			$this->assertEquals( "PM", $this->l->formatDateGMT( $d, "%P" ));						
 			$this->assertEquals( "00", $this->l->formatDateGMT( $d, "%M" ));			
@@ -106,7 +109,7 @@
 			$this->assertEquals( "Feb ", $this->l->formatDateGMT( $d, "%b " ));
 			$this->assertEquals( "Feb 5", $this->l->formatDateGMT( $d, "%b %j" ));
 			$this->assertEquals( "05/02/2007", $this->l->formatDateGMT( $d, "%d/%m/%Y" ));
-			$this->assertEquals( "05 February, 2007 21:00", $this->l->formatDateGMT( $d, "%d %B, %Y %H:%M" ));								
+			$this->assertEquals( "05 February, 2007 ".(12-$diff).":00", $this->l->formatDateGMT( $d, "%d %B, %Y %H:%M" ));								
 		}		
 	}
 ?>
\ No newline at end of file



More information about the pLog-svn mailing list