Remove debug code from Group.t

Force uniqueness check inside isInGroups to prevent multiple group
definitions from being returned.  This should cut the size of
the in-memory Group cache by 50%, since group id #3 is returned for _every_
group.
This commit is contained in:
Colin Kuskie 2006-03-14 05:54:42 +00:00
parent 7f7347faa9
commit c6b0d9b8d5
2 changed files with 2 additions and 9 deletions

View file

@ -494,7 +494,6 @@ not ever manually set this.
=cut
sub getGroupsIn {
my $self = shift;
my $isRecursive = shift;
@ -516,6 +515,8 @@ sub getGroupsIn {
my $gog = WebGUI::Group->new($self->session,$group)->getGroupsIn(1,$loopCount);
push(@groupsOfGroups, @$gog);
}
my %unique = map { $_ => 1 } @groupsOfGroups;
@groupsOfGroups = keys %unique;
$gotGroupsInGroup->{recursive}{$self->getId} = \@groupsOfGroups;
return \@groupsOfGroups;
}

View file

@ -80,11 +80,8 @@ ok( ($gA->name eq 'Group A' and $gB->name eq 'Group B'), 'object name assignment
$gB->addGroups([$gA->getId]);
$session->errorHandler->warn('A, B recursive groupsIn');
cmp_bag([$gA->getId, 3], $gB->getGroupsIn(1) ,'Group A is in Group B, recursively');
$session->errorHandler->warn('A, B regular groupsIn');
cmp_bag([$gA->getId, 3], $gB->getGroupsIn() ,'Group A is in Group B');
$session->errorHandler->warn('A, B regular groupsFor');
cmp_bag([$gB->getId], $gA->getGroupsFor() ,'Group B contains Group A');
cmp_bag([3], $gA->getGroupsIn() ,'Admin added to group A automatically');
@ -106,11 +103,6 @@ cmp_bag([3], $gA->getGroupsIn() ,'Group C is a member of Group A, cached');
cmp_bag([$gA->getId, 3], $gB->getGroupsIn() ,'Group A is in Group B, cached result');
cmp_bag([$gA->getId, 3], $gB->getGroupsIn(1) ,'Group C is in Group B, recursively, cached result');
use Data::Dumper;
diag("direct: ".Dumper $gB->getGroupsIn());
diag("recursive: ".Dumper $gB->getGroupsIn(1));
END {
(defined $gA and ref $gA eq 'WebGUI::Group') and $gA->delete;
(defined $gB and ref $gB eq 'WebGUI::Group') and $gB->delete;