Fixes bug in ExpireIncompleteSurveyResponses

Use a left outer join on userProfileData so that the workflow processes
responses for users that have been deleted
This commit is contained in:
Patrick Donelan 2009-10-20 16:50:00 +11:00
parent c8542cc5d0
commit e4b18757d8
3 changed files with 11 additions and 3 deletions

View file

@ -13,7 +13,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
plan tests => 25;
plan tests => 26;
use_ok('WebGUI::Workflow::Activity::ExpireIncompleteSurveyResponses');
@ -127,6 +127,13 @@ $session->db->write('update Survey_response set endDate = 0, isComplete = 0 wher
# Make sure SQL only returns 1 incomplete response
is( scalar $session->db->buildArray($SQL), 1, 'Make sure SQL only returns 1 incomplete response');
##
# Make sure workflow handles responses for deleted users
#
$session->db->write('update Survey_response set userId = ? where Survey_responseId = ?', ['not-a-user-id', $responseId]);
is( scalar $session->db->buildArray($SQL), 1, 'Still returns 1 row, even though user does not exist (sql left outer join)');
$session->db->write('update Survey_response set userId = ? where Survey_responseId = ?', [$user->getId, $responseId]);
##
# Delete Expired
##