From 6c6aad240d81b24340f35ad031fae1abdfdf34da Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 19 Jan 2007 16:22:24 +0000 Subject: [PATCH] add tests to DateTime to guarantee that add works --- t/DateTime.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/t/DateTime.pm b/t/DateTime.pm index d740e8c7d..9cb884369 100644 --- a/t/DateTime.pm +++ b/t/DateTime.pm @@ -23,7 +23,7 @@ my $session = WebGUI::Test->session; # put your tests here -my $numTests = 1 + 13; +my $numTests = 1 + 17; plan tests => $numTests; my $loaded = use_ok("WebGUI::DateTime"); @@ -56,6 +56,14 @@ is($copiedDt->toUserTimeZone(), "2006-11-06 14:12:45", "toUserTimeZone obeys is($copiedDt->toUserTimeZoneDate(), "2006-11-06", "toUserTimeZoneDate obeys the time zone"); is($copiedDt->toUserTimeZoneTime(), "14:12:45", "toUserTimeZoneTime obeys the time zone"); +$copiedDt->add(hours => 1); + +isa_ok($copiedDt, "WebGUI::DateTime", "add returns itself"); +isa_ok($copiedDt->session, "WebGUI::Session", "add does not nuke $session"); + +is($copiedDt->time_zone()->name, "America/Hermosillo", "add does not change the time zone"); +is($copiedDt->toUserTimeZone(), "2006-11-06 15:12:45", "add returns the correct time"); + my $epochDt = WebGUI::DateTime->new($session, "1169141075"); isa_ok($epochDt, "WebGUI::DateTime", "epochal construction");