[Rt-commit] r18683 - in rt/3.999/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Wed Mar 4 21:38:24 EST 2009


Author: sartak
Date: Wed Mar  4 21:38:24 2009
New Revision: 18683

Modified:
   rt/3.999/trunk/   (props changed)
   rt/3.999/trunk/t/api/date.t

Log:
 r80944 at onn:  sartak | 2009-03-04 21:38:08 -0500
 A bunch more test fixes


Modified: rt/3.999/trunk/t/api/date.t
==============================================================================
--- rt/3.999/trunk/t/api/date.t	(original)
+++ rt/3.999/trunk/t/api/date.t	Wed Mar  4 21:38:24 2009
@@ -195,44 +195,46 @@
 { # set+datemanip format(time::ParseDate)
     RT->config->set( TimeZone => 'Europe/Moscow' );
     my $date = RT::DateTime->new_from_string('2005-11-28 15:10:00');
-    is($date, '2005-11-28 12:10:00', "YYYY-DD-MM hh:mm:ss");
+    is($date, '2005-11-28 15:10:00', "YYYY-DD-MM hh:mm:ss");
+    is($date->iso(time_zone => 'server'), '2005-11-28 23:10:00', "YYYY-DD-MM hh:mm:ss");
 
     RT->config->set( TimeZone => 'UTC' );
     $date = RT::DateTime->new_from_string('2005-11-28 15:10:00');
     is($date, '2005-11-28 15:10:00', "YYYY-DD-MM hh:mm:ss");
+    is($date->iso(time_zone => 'server'), '2005-11-28 20:10:00', "YYYY-DD-MM hh:mm:ss");
 
     $current_user->user_object->__set( column => 'time_zone', value => 'Europe/Moscow');
     $date = RT::DateTime->new_from_string('2005-11-28 15:10:00');
-    is($date, '2005-11-28 12:10:00', "YYYY-DD-MM hh:mm:ss");
+    is($date, '2005-11-28 15:10:00', "YYYY-DD-MM hh:mm:ss");
+    is($date->iso(time_zone => 'server'), '2005-11-28 12:10:00', "YYYY-DD-MM hh:mm:ss");
 }
 
-{ # set+unknown format(time::ParseDate)
+{
     RT->config->set( TimeZone => 'Europe/Moscow' );
     my $date = RT::DateTime->new_from_string('2005-11-28 15:10:00');
-    is($date, '2005-11-28 12:10:00', "YYYY-DD-MM hh:mm:ss");
+    is($date, '2005-11-28 15:10:00', "YYYY-DD-MM hh:mm:ss");
 
     $date = RT::DateTime->new_from_string('2005-11-28 15:10:00', time_zone => 'UTC' );
-    is($date, '2005-11-28 15:10:00', "YYYY-DD-MM hh:mm:ss");
+    is($date, '2005-11-28 18:10:00', "YYYY-DD-MM hh:mm:ss");
 
     # relative dates
     $date = RT::DateTime->new_from_string('now');
-    is($date, '2005-11-28 15:10:00', "YYYY-DD-MM hh:mm:ss");
+    is($date, '2005-11-28 10:10:00', "YYYY-DD-MM hh:mm:ss");
 
     $date = RT::DateTime->new_from_string('1 day ago');
-    is($date, '2005-11-27 15:10:00', "YYYY-DD-MM hh:mm:ss");
+    is($date, '2005-11-27 13:10:00', "YYYY-DD-MM hh:mm:ss");
 
     RT->config->set( TimeZone => 'UTC' );
     $date = RT::DateTime->new_from_string('2005-11-28 15:10:00');
     is($date, '2005-11-28 15:10:00', "YYYY-DD-MM hh:mm:ss");
 
     $current_user->user_object->__set( column => 'time_zone', value => 'Europe/Moscow');
-    $date = RT::DateTime->now;
     $date = RT::DateTime->new_from_string('2005-11-28 15:10:00');
-    is($date, '2005-11-28 12:10:00', "YYYY-DD-MM hh:mm:ss");
-    $date = RT::DateTime->new_from_string('2005-11-28 15:10:00', time_zone => 'server' );
     is($date, '2005-11-28 15:10:00', "YYYY-DD-MM hh:mm:ss");
+    $date = RT::DateTime->new_from_string('2005-11-28 15:10:00', time_zone => 'server' );
+    is($date, '2005-11-28 18:10:00', "YYYY-DD-MM hh:mm:ss");
     $date = RT::DateTime->new_from_string('2005-11-28 15:10:00', time_zone => 'UTC' );
-    is($date, '2005-11-28 15:10:00', "YYYY-DD-MM hh:mm:ss");
+    is($date, '2005-11-28 18:10:00', "YYYY-DD-MM hh:mm:ss");
 }
 
 {
@@ -240,18 +242,15 @@
     my $date = RT::DateTime->from_epoch(epoch => 0);
     is($date, "unset", "epoch 0 returns 'unset'");
 
-    RT->config->set( DateTimeFormat => '');
-    $date->epoch(1);
+    RT->config->set( DateTimeFormat => '%a %b %d %H:%M:%S %Y');
+    $date = RT::DateTime->from_epoch(epoch => 1);
     is($date, 'Thu Jan 01 00:00:01 1970', "correct string");
 
-    RT->config->set( DateTimeFormat => 'RFC2822' );
-    $date->epoch(1);
-    is($date, 'Thu, 1 Jan 1970 00:00:01 +0000', "correct string");
-
-    RT->config->set( DateTimeFormat => { format => 'RFC2822', seconds => 0 } );
-    $date->epoch(1);
-    is($date, 'Thu, 1 Jan 1970 00:00 +0000', "correct string");
-    is($date, 'Thu, 1 Jan 1970 00:00:01 +0000', "correct string");
+    RT->config->set( DateTimeFormat => '%a, %d %b %Y %H:%M:%S %z' );
+    is($date, 'Thu, 01 Jan 1970 00:00:01 +0000', "correct string");
+
+    RT->config->set( DateTimeFormat => '%a, %d %b %Y %H:%M %z' );
+    is($date, 'Thu, 01 Jan 1970 00:00 +0000', "correct string");
 }
 
 { # DurationAsString


More information about the Rt-commit mailing list