Clean up all temporary session info in Session/Scratch.t
Add a preliminary run of DeleteExpiredSessions to DeleteExpiredSessions.t to clean up any old, funky sessions which might just be lying around and interfering with the test.
This commit is contained in:
parent
047b0c5d3e
commit
b309d108dc
2 changed files with 9 additions and 4 deletions
|
|
@ -119,9 +119,11 @@ is($sessionBank[2]->scratch->deleteNameByValue('falseValue',''), 1, "deleteNameB
|
|||
|
||||
END {
|
||||
$session->scratch->deleteAll;
|
||||
foreach my $wgSess ($newSession, @sessionBank, $session) {
|
||||
foreach my $wgSess ($newSession, @sessionBank) {
|
||||
if (defined $wgSess and ref $wgSess eq 'WebGUI::Session') {
|
||||
diag "Closing session";
|
||||
$wgSess->scratch->deleteAll;
|
||||
$wgSess->var->end;
|
||||
$wgSess->close;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,10 +19,13 @@ use WebGUI::Workflow::Activity::DeleteExpiredSessions;
|
|||
|
||||
use Test::More;
|
||||
|
||||
plan tests => 4; # increment this value for each test you create
|
||||
plan tests => 5; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $activity = WebGUI::Workflow::Activity::DeleteExpiredSessions->create($session);
|
||||
$activity->execute(); ##Clear out any old sessions that might interfere with this test;
|
||||
|
||||
my $origSessionTimeout = $session->setting->get('sessionTimeout');
|
||||
|
||||
my $sessionCount = $session->db->quickScalar('select count(*) from userSession');
|
||||
|
|
@ -52,8 +55,8 @@ my $newScratchCount = $session->db->quickScalar('select count(*) from userSessio
|
|||
is ($newSessionCount, $sessionCount+4, 'all new sessions created correctly');
|
||||
is ($newScratchCount, $scratchCount+2, 'two of the new sessions have scratch entries');
|
||||
|
||||
my $activity = WebGUI::Workflow::Activity::DeleteExpiredSessions->create($session);
|
||||
$activity->execute();
|
||||
my $returnValue = $activity->execute();
|
||||
is ($returnValue, 'complete', 'DeleteExpiredSessions completed');
|
||||
|
||||
$newSessionCount = $session->db->quickScalar('select count(*) from userSession');
|
||||
$newScratchCount = $session->db->quickScalar('select count(*) from userSessionScratch');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue