aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-08-27 07:32:11 +0000
committerlpsolit%gmail.com <>2008-08-27 07:32:11 +0000
commit615cfb88c1aae1f8372b323e9c53a84d8c9146fe (patch)
treed41bf992b9de42c29141e41714b6108866a39204 /t
parent68c8ee64ec7dc985931f17f98cb83ee153dcd25c (diff)
downloadbugs-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.tar
bugs-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.tar.gz
bugs-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.tar.bz2
bugs-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.tar.xz
bugs-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.zip
Bug 182238: Allow users to choose what time zone to display times in - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 't')
-rw-r--r--t/007util.t18
1 files changed, 10 insertions, 8 deletions
diff --git a/t/007util.t b/t/007util.t
index 18d58148b..5fc02d52c 100644
--- a/t/007util.t
+++ b/t/007util.t
@@ -33,11 +33,13 @@ BEGIN {
use_ok(Bugzilla::Util);
}
-# We need to override Bugzilla->params so we can get an expected value when
-# Bugzilla::Util::format_time() calls ask for the 'timezone' parameter.
-# This will also prevent the tests from failing on site that do not have a
-# data/params file containing 'timezone' yet.
-Bugzilla->params->{'timezone'} = "TEST";
+# We need to override user preferences so we can get an expected value when
+# Bugzilla::Util::format_time() calls ask for the 'timezone' user preference.
+Bugzilla->user->settings->{'timezone'}->{'value'} = "local";
+
+# We need to know the local timezone for the date chosen in our tests.
+# Below, tests are run against Nov. 24, 2002.
+my $tz = Bugzilla->local_timezone->short_name_for_datetime(DateTime->new(year => 2002, month => 11, day => 24));
# we don't test the taint functions since that's going to take some more work.
# XXX: test taint functions
@@ -58,7 +60,7 @@ is(lsearch(\@list,'kiwi'),-1,'lsearch 3 (missing item)');
is(trim(" fg<*\$%>+=~~ "),'fg<*$%>+=~~','trim()');
#format_time();
-is(format_time("2002.11.24 00:05"),'2002-11-24 00:05 TEST','format_time("2002.11.24 00:05")');
-is(format_time("2002.11.24 00:05:56"),'2002-11-24 00:05:56 TEST','format_time("2002.11.24 00:05:56")');
+is(format_time("2002.11.24 00:05"), "2002-11-24 00:05 $tz",'format_time("2002.11.24 00:05") is ' . format_time("2002.11.24 00:05"));
+is(format_time("2002.11.24 00:05:56"), "2002-11-24 00:05:56 $tz",'format_time("2002.11.24 00:05:56")');
is(format_time("2002.11.24 00:05:56", "%Y-%m-%d %R"), '2002-11-24 00:05', 'format_time("2002.11.24 00:05:56", "%Y-%m-%d %R") (with no timezone)');
-is(format_time("2002.11.24 00:05:56", "%Y-%m-%d %R %Z"), '2002-11-24 00:05 TEST', 'format_time("2002.11.24 00:05:56", "%Y-%m-%d %R %Z") (with timezone)');
+is(format_time("2002.11.24 00:05:56", "%Y-%m-%d %R %Z"), "2002-11-24 00:05 $tz", 'format_time("2002.11.24 00:05:56", "%Y-%m-%d %R %Z") (with timezone)');