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:
parent
886677c8ce
commit
17441c13c2
3 changed files with 38 additions and 5 deletions
21
t/User.t
21
t/User.t
|
|
@ -20,7 +20,7 @@ use WebGUI::Cache;
|
|||
use WebGUI::User;
|
||||
use WebGUI::ProfileField;
|
||||
|
||||
use Test::More tests => 124; # increment this value for each test you create
|
||||
use Test::More tests => 127; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
|
@ -533,6 +533,25 @@ is($neighbor->identifier, undef, 'identifier: by default, new users have an unde
|
|||
is($neighbor->identifier('neighborhood'), 'neighborhood', 'identifier: setting the identifier returns the new identifier');
|
||||
is($neighbor->identifier, 'neighborhood', 'identifier: testing fetch of newly set password');
|
||||
|
||||
################################################################
|
||||
#
|
||||
# friends
|
||||
#
|
||||
################################################################
|
||||
|
||||
my $friendsGroup = $neighbor->friends();
|
||||
isa_ok($friendsGroup, 'WebGUI::Group', 'friends returns a Group object');
|
||||
my $friendsGroup2 = $neighbor->friends();
|
||||
cmp_deeply($friendsGroup, $friendsGroup2, 'second fetch returns the cached group object from the user object');
|
||||
|
||||
my $neighborClone = WebGUI::User->new($session, $neighbor->userId);
|
||||
my $friendsGroup3 = $neighborClone->friends();
|
||||
is ($friendsGroup->getId, $friendsGroup3->getId, 'friends: fetching group object when group exists but is not cached');
|
||||
|
||||
undef $friendsGroup2;
|
||||
undef $friendsGroup3;
|
||||
undef $neighborClone;
|
||||
|
||||
END {
|
||||
foreach my $account ($user, $dude, $buster, $buster3, $neighbor, $friend) {
|
||||
(defined $account and ref $account eq 'WebGUI::User') and $account->delete;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue