Fix bug #11286: Tell the difference between end of Workflow, and unable to load WorkflowActivity.
Tests are added for new methods. The changes to Workflow::Instance->run are peripherally tested in Workflow Activity tests.
This commit is contained in:
parent
89ea0e7cea
commit
c845849da0
5 changed files with 105 additions and 19 deletions
24
t/Workflow.t
24
t/Workflow.t
|
|
@ -16,7 +16,7 @@ use WebGUI::Session;
|
|||
use WebGUI::Workflow;
|
||||
use WebGUI::Workflow::Cron;
|
||||
use WebGUI::Utility qw/isIn/;
|
||||
use Test::More tests => 67; # increment this value for each test you create
|
||||
use Test::More tests => 75; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
|
@ -144,6 +144,28 @@ my $decayKarma = $wf3->addActivity('WebGUI::Workflow::Activity::DecayKarma');
|
|||
my $cleanTemp = $wf3->addActivity('WebGUI::Workflow::Activity::CleanTempStorage');
|
||||
my $oldTrash = $wf3->addActivity('WebGUI::Workflow::Activity::PurgeOldTrash');
|
||||
|
||||
#####################################################################
|
||||
#
|
||||
# getNextActivityId
|
||||
#
|
||||
#####################################################################
|
||||
|
||||
is $wf3->getNextActivityId($decayKarma->getId), $cleanTemp->getId, 'getNextActivityId: first activity to second';
|
||||
is $wf3->getNextActivityId($cleanTemp->getId), $oldTrash->getId, '... second activity to third';
|
||||
is $wf3->getNextActivityId($oldTrash->getId), undef, '... last returns undef';
|
||||
is $wf3->getNextActivityId(), $decayKarma->getId, '... with no activityId, returns the first';
|
||||
|
||||
#####################################################################
|
||||
#
|
||||
# hasNextActivity
|
||||
#
|
||||
#####################################################################
|
||||
|
||||
ok $wf3->hasNextActivity($decayKarma->getId), 'hasNextActivityId: first activity to second';
|
||||
ok $wf3->hasNextActivity($cleanTemp->getId), '... second activity to third';
|
||||
ok $wf3->hasNextActivity(), '... with no activityId, returns the first';
|
||||
ok !$wf3->hasNextActivity($oldTrash->getId), '... last returns undef';
|
||||
|
||||
#####################################################################
|
||||
#
|
||||
# Activity tests, promote, demote, reorder, accessing, deleting
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ my $wf = WebGUI::Workflow->create(
|
|||
}
|
||||
);
|
||||
isa_ok($wf, 'WebGUI::Workflow', 'workflow created for test');
|
||||
addToCleanup($wf);
|
||||
|
||||
# create an instance of $wfId
|
||||
my $properties = {
|
||||
|
|
@ -179,6 +180,7 @@ my $wf2 = WebGUI::Workflow->create(
|
|||
type => 'None',
|
||||
}
|
||||
);
|
||||
addToCleanup($wf2);
|
||||
|
||||
my $wf2Instance = WebGUI::Workflow::Instance->create($session, {workflowId => $wf2->getId});
|
||||
cmp_deeply($wf2Instance->get('parameters'), {}, 'get returns {} for parameters when there are no parameters stored');
|
||||
|
|
@ -222,10 +224,3 @@ cmp_deeply($wf2Instance->get('parameters'), {}, 'get returns {} for parameters w
|
|||
is $wf3Instance->getObject, $return;
|
||||
} 'getObject is able to retrieve correct object';
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
END {
|
||||
$wf->delete; ##Deleting a Workflow deletes its instances, too.
|
||||
$wf2->delete;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue