Fixed broken friends method caching. The cache was never populated, so it

would fail every time.
Added a missing DESTROY method to Group.pm.  That way it won't puke when trying
to call an undefined method when the User object is cleaned up.
Added coverage tests for friends method in User.pm
This commit is contained in:
Colin Kuskie 2007-10-31 21:00:54 +00:00
parent 886677c8ce
commit 17441c13c2
3 changed files with 38 additions and 5 deletions

View file

@ -358,6 +358,20 @@ sub description {
}
#-------------------------------------------------------------------
=head2 DESTROY
Desconstructor
=cut
sub DESTROY {
my $self = shift;
undef $self;
}
#-------------------------------------------------------------------
=head2 expireNotify ( [ value ] )

View file

@ -276,12 +276,12 @@ sub friends {
$self->{_user}{"lastUpdated"} = $self->session->datetime->time();
$self->session->db->write("update users set friendsGroup=?, lastUpdated=? where userId=?",
[$myFriends->getId, $self->session->datetime->time(), $self->userId]);
return $myFriends;
$self->{_friendsGroup} = $myFriends;
}
elsif (exists $self->{_friendsGroup}) {
return $self->{_friendsGroup};
elsif (! exists $self->{_friendsGroup}) {
$self->{_friendsGroup} = WebGUI::Group->new($self->session, $self->{_user}{"friendsGroup"});
}
return WebGUI::Group->new($self->session, $self->{_user}{"friendsGroup"});
return $self->{_friendsGroup};
}
#-------------------------------------------------------------------