Added a test to see if clone would duplicate the session. It does.

Subclassed DateTime's from_object method, which was secretely deleting
the internal session variable.  There is probably a more robust way to
do this, such as by "...implementing the utc_rd_values() method as the
from_object docs suggest.
Finished fixing the bug with time zone errors in editing an event.
This commit is contained in:
Colin Kuskie 2007-01-19 06:25:43 +00:00
parent 17fac4a7cb
commit 2180b9bf91
4 changed files with 27 additions and 11 deletions

View file

@ -23,7 +23,7 @@ my $session = WebGUI::Test->session;
# put your tests here
my $numTests = 1 + 12;
my $numTests = 1 + 13;
plan tests => $numTests;
my $loaded = use_ok("WebGUI::DateTime");
@ -46,7 +46,8 @@ is($dt->toDatabaseTime, "21:12:45", "toDatabaseTime returns the ident
$session->user({user => $timeZoneUser});
my $copiedDt = $dt->cloneToUserTimeZone;
isa_ok($copiedDt, "WebGUI::DateTime", "cloneToUserTimeZone");
isa_ok($copiedDt, "WebGUI::DateTime", "cloneToUserTimeZone");
isa_ok($copiedDt->session, "WebGUI::Session", "cloneToUserTimeZone also copies over the session object");
is($copiedDt->time_zone()->name, "America/Hermosillo", "cloned object has correct time zone");
is($dt->time_zone()->name, "UTC", "original object is still UTC");