[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-552-gb98423c
Shawn Moore
sartak at bestpractical.com
Tue Aug 24 20:59:45 EDT 2010
The branch, 3.9-trunk has been updated
via b98423ccade1167d14fba6efa59a32c0bb8bdb12 (commit)
via 6cc0f9760a95af45c729e08388416e332c909476 (commit)
from 965cdb0ea3c865673f5bdf0925123309d5e9d128 (commit)
Summary of changes:
lib/RT/Date.pm | 5 +++++
t/api/date.t | 7 +------
2 files changed, 6 insertions(+), 6 deletions(-)
- Log -----------------------------------------------------------------
commit 6cc0f9760a95af45c729e08388416e332c909476
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Aug 24 21:00:11 2010 -0400
RT::Date->Timezone is a setter only
diff --git a/t/api/date.t b/t/api/date.t
index 8a7e9e5..ce51465 100644
--- a/t/api/date.t
+++ b/t/api/date.t
@@ -7,7 +7,7 @@ my $tests;
my $localized_datetime_tests;
BEGIN {
- $tests = 170;
+ $tests = 165;
$localized_datetime_tests =
eval { require DateTime; 1; } && eval { require DateTime::Locale; 1; } &&
DateTime->can('format_cldr') && DateTime::Locale::root->can('date_format_full');
@@ -53,7 +53,6 @@ my $current_user;
{
my $date = RT::Date->new( $current_user );
- is($date->Timezone, 'UTC', "dropped all timzones to UTC");
is($date->Timezone('user'), 'UTC', "dropped all timzones to UTC");
is($date->Timezone('server'), 'UTC', "dropped all timzones to UTC");
is($date->Timezone('unknown'), 'UTC', "with wrong context returns UTC");
@@ -65,7 +64,6 @@ my $current_user;
is($date->Timezone('user'),
'Europe/Moscow',
"in user context returns user's timezone");
- is($date->Timezone, 'UTC', "the deafult value is always UTC");
is($date->Timezone('server'), 'UTC', "wasn't changed");
RT->Config->Set( Timezone => 'Africa/Ouagadougou' );
@@ -75,7 +73,6 @@ my $current_user;
is($date->Timezone('user'),
'Europe/Moscow',
"in user context still returns user's timezone");
- is($date->Timezone, 'UTC', "the deafult value is always UTC");
$current_user->UserObj->__Set( Field => 'Timezone', Value => '');
is_empty($current_user->UserObj->Timezone,
@@ -83,7 +80,6 @@ my $current_user;
is($date->Timezone('user'),
'Africa/Ouagadougou',
"in user context returns timezone of the server if user's one is not defined");
- is($date->Timezone, 'UTC', "the deafult value is always UTC");
RT->Config->Set( Timezone => 'GMT' );
is($date->Timezone('server'),
@@ -91,7 +87,6 @@ my $current_user;
"timezone is GMT which one is alias for UTC");
RT->Config->Set( Timezone => '' );
- is($date->Timezone, 'UTC', "dropped all timzones to UTC");
is($date->Timezone('user'),
'UTC',
"user's and server's timzones are not defined, so UTC");
commit b98423ccade1167d14fba6efa59a32c0bb8bdb12
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Aug 24 21:01:53 2010 -0400
Complain about RT::Date->Timezone() without args
diff --git a/lib/RT/Date.pm b/lib/RT/Date.pm
index c3890f9..17be020 100755
--- a/lib/RT/Date.pm
+++ b/lib/RT/Date.pm
@@ -1024,6 +1024,11 @@ If both server's and user's timezone names are undefined returns 'UTC'.
sub Timezone {
my $self = shift;
+
+ if (@_ == 0) {
+ Carp::croak "RT::Date->Timezone is a setter only";
+ }
+
my $context = lc(shift);
$context = 'utc' unless $context =~ /^(?:utc|server|user)$/i;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list