Flush cache for User and Group tests to pass.
Add group cache clear to Group.pm templateId clash due fixed
This commit is contained in:
parent
799eb114eb
commit
1c6fec6695
4 changed files with 20 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#PBtmpl0000000000000054
|
||||
#PBtmpl000000000table54
|
||||
<div><a name="id<tmpl_var assetId>" id="id<tmpl_var assetId>"></a></div>
|
||||
|
||||
<tmpl_if showAdmin>
|
||||
|
|
|
|||
|
|
@ -151,8 +151,7 @@ An override for the default offset of the grouping. Specified in seconds.
|
|||
sub addUsers {
|
||||
my $self = shift;
|
||||
my $users = shift;
|
||||
WebGUI::Cache->new($self->session, $self->getId)->delete;
|
||||
$self->session->stow->delete("isInGroup");
|
||||
$self->clearCaches();
|
||||
my $expireOffset = shift || $self->get("expireOffset");
|
||||
foreach my $uid (@{$users}) {
|
||||
next if ($uid eq '1' and !isIn($self->getId, 1, 7));
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use WebGUI::Utility;
|
|||
|
||||
use WebGUI::User;
|
||||
use WebGUI::Group;
|
||||
use WebGUI::Cache;
|
||||
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
|
|
@ -77,6 +78,7 @@ my @ipTests = (
|
|||
plan tests => (88 + scalar(@scratchTests) + scalar(@ipTests)); # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
WebGUI::Cache->new($session, 'myKey')->flush();
|
||||
|
||||
my $g = WebGUI::Group->new($session, "new");
|
||||
|
||||
|
|
|
|||
22
t/User.t
22
t/User.t
|
|
@ -15,12 +15,15 @@ use lib "$FindBin::Bin/lib";
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Cache;
|
||||
|
||||
use WebGUI::User;
|
||||
use Test::More tests => 81; # increment this value for each test you create
|
||||
use Test::More tests => 85; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
WebGUI::Cache->new($session, 'myKey')->flush();
|
||||
|
||||
my $user;
|
||||
my $lastUpdate;
|
||||
|
||||
|
|
@ -247,7 +250,7 @@ ok ($visitor->isInGroup($cm->getId), "Visitor is allowed in via IP");
|
|||
|
||||
$session->db->write('update userSession set lastIP=? where sessionId=?',['193.168.0.101', $session->getId]);
|
||||
|
||||
$session->stow->delete('isInGroup');
|
||||
$cm->clearCaches;
|
||||
|
||||
ok (!$visitor->isInGroup($cm->getId), "Visitor is not allowed in via IP");
|
||||
|
||||
|
|
@ -259,6 +262,7 @@ $user = WebGUI::User->new($session, "new");
|
|||
|
||||
$user->addToGroups([3]);
|
||||
|
||||
$session->errorHandler->warn('userId: '. $user->userId);
|
||||
ok($user->isInGroup(3), "addToGroups: New user is in group 3(Admin)");
|
||||
ok($user->isInGroup(11), "New user is in group 11(Secondary Admins)");
|
||||
ok($user->isInGroup(12), "New user is in group 12(Turn On Admin)");
|
||||
|
|
@ -267,10 +271,16 @@ ok($user->isInGroup(14), "New user is in group 14(Product Managers)");
|
|||
|
||||
$user->deleteFromGroups([3]);
|
||||
ok(!$user->isInGroup(3), "deleteFromGroups: New user is not in group 3(Admin)");
|
||||
ok(!$user->isInGroup(11), "New user is not in group 11(Secondary Admins)");
|
||||
ok(!$user->isInGroup(12), "New user is not in group 12(Turn On Admin)");
|
||||
ok(!$user->isInGroup(13), "New user is not in group 13(Export Managers)");
|
||||
ok(!$user->isInGroup(14), "New user is not in group 14(Product Managers)");
|
||||
ok($user->isInGroup(11), "New user still in group 11 due to caching (Secondary Admins)");
|
||||
ok($user->isInGroup(12), "New user still in group 12 due to caching (Turn On Admin)");
|
||||
ok($user->isInGroup(13), "New user still in group 13 due to caching (Export Managers)");
|
||||
ok($user->isInGroup(14), "New user still in group 14 due to caching (Product Managers)");
|
||||
|
||||
WebGUI::Cache->new($session, 'myKey')->flush();
|
||||
ok($user->isInGroup(11), "Flush cache, new user not in group 11 (Secondary Admins)");
|
||||
ok($user->isInGroup(12), "Flush cache, new user not in group 12 (Turn On Admin)");
|
||||
ok($user->isInGroup(13), "Flush cache, new user not in group 13 (Export Managers)");
|
||||
ok($user->isInGroup(14), "Flush cache, new user not in group 14 (Product Managers)");
|
||||
|
||||
$user->delete;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue