From b309d108dc4c11bd7a6b295f17a037e7d92cde4f Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 3 Jan 2008 18:37:34 +0000 Subject: [PATCH] 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. --- t/Session/Scratch.t | 4 +++- t/Workflow/Activity/DeleteExpiredSessions.t | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/t/Session/Scratch.t b/t/Session/Scratch.t index cf8c228d2..a82ee51c8 100644 --- a/t/Session/Scratch.t +++ b/t/Session/Scratch.t @@ -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; } } diff --git a/t/Workflow/Activity/DeleteExpiredSessions.t b/t/Workflow/Activity/DeleteExpiredSessions.t index f6bef7ecd..aaac04e61 100644 --- a/t/Workflow/Activity/DeleteExpiredSessions.t +++ b/t/Workflow/Activity/DeleteExpiredSessions.t @@ -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');