fix nasty data sync bug in WebGUI::User::friends that was causing the friendsGroup assigned to a user t

o immediately be lost and replaced a different one in a call to WebGUI::Friends->add, which creates sep
erate instances of users
This commit is contained in:
Scott Walters 2012-06-19 18:04:12 -04:00
parent eaa29c5f44
commit 3fe8f9a080
3 changed files with 30 additions and 3 deletions

View file

@ -22,7 +22,7 @@ use WebGUI::User;
use WebGUI::ProfileField;
use WebGUI::Shop::AddressBook;
use Test::More tests => 235; # increment this value for each test you create
use Test::More tests => 237; # increment this value for each test you create
use Test::Deep;
use Data::Dumper;
@ -753,6 +753,24 @@ undef $friendsGroup2;
undef $friendsGroup3;
undef $neighborClone;
################################################################
#
# friend reciprication
#
################################################################
#
my $buddy1 = WebGUI::User->new($session, 'new');
WebGUI::Test->addToCleanup($buddy1);
my $buddy2 = WebGUI::User->new($session, 'new');
WebGUI::Test->addToCleanup($buddy2);
WebGUI::Friends->new( $session, $buddy1 )->add( [ $buddy2->userId ] );
ok( exists $buddy1->friends->getUserList->{ $buddy2->userId }, 'buddy1 has buddy2 in his friends list' );
ok( exists $buddy2->friends->getUserList->{ $buddy1->userId }, 'buddy2 has buddy1 in his friends list' );
################################################################
#
# acceptsPrivateMessages