fixed problems with tests
This commit is contained in:
parent
799db1090f
commit
494c8ded0e
5 changed files with 439 additions and 91 deletions
|
|
@ -38,7 +38,7 @@ my $session = WebGUI::Test->session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 52; # Increment this number for each test you create
|
||||
plan tests => 49; # Increment this number for each test you create
|
||||
|
||||
(my $submitGroupA = WebGUI::Group->new($session,'new'))->name('groupA');
|
||||
(my $submitGroupB = WebGUI::Group->new($session,'new'))->name('groupB');
|
||||
|
|
@ -68,13 +68,6 @@ sub logout { $session->user({userId => 1}); }
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
eval {
|
||||
my $use = use_ok( 'WebGUI::Asset::EMSSubmissionForm' )
|
||||
&& use_ok( 'WebGUI::Asset::EMSSubmission' )
|
||||
&& use_ok( 'WebGUI::Workflow::Activity::CleanupEMSSubmissions' )
|
||||
&& use_ok( 'WebGUI::Workflow::Activity::ProcessEMSApprovals' );
|
||||
|
||||
SKIP: { skip 'package compile failed!', 1 unless $use;
|
||||
|
||||
loginAdmin;
|
||||
|
||||
|
|
@ -358,8 +351,11 @@ $sub1 = $sub1->cloneFromDb;
|
|||
is( $sub1->get('submissionStatus'),'created','approval successfull');
|
||||
|
||||
my $ticket = WebGUI::Asset->newByDynamicClass($session, $sub1->get('ticketId'));
|
||||
isa_ok( $ticket, 'WebGUI::Asset::Sku::EMSTicket', 'approval created a ticket');
|
||||
WebGUI::Test->assetsToPurge( $ticket ) if $ticket ;
|
||||
SKIP: {
|
||||
skip 'no ticket created', 1 unless isa_ok( $ticket, 'WebGUI::Asset::Sku::EMSTicket', 'approval created a ticket');
|
||||
is( $ticket->get('title'), $sub1->get('title'), 'Ticket title matches submission title' );
|
||||
}
|
||||
|
||||
my $newDate = time - ( 60 * 60 * 24 * ( $sub2->getParent->get('daysBeforeCleanup') + 1 ) ),
|
||||
$sub2->update({
|
||||
|
|
@ -501,10 +497,6 @@ $sub1->getFormattedComments;
|
|||
|
||||
} [], 'no warnings from calling a bunch of functions';
|
||||
|
||||
} # end of use packages skip
|
||||
}; # end of eval
|
||||
print $@ if $@;
|
||||
|
||||
#done_testing();
|
||||
#print 'press return to complete test' ; <>;
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
package WebGUI::Test::Activity;
|
||||
|
||||
use WebGUI::Workflow;
|
||||
|
||||
my @cleanup; # TODO fix WebGUI::Text::assetsToPurge so that it works with workflows and activities
|
||||
use WebGUI::Test;
|
||||
|
||||
=head Name
|
||||
|
||||
|
|
@ -43,7 +42,7 @@ params -- params to set in the workflow
|
|||
sub create {
|
||||
my $myClass = shift;
|
||||
my $session = shift;
|
||||
my $workflowClass = shift;
|
||||
my $activityClass = shift;
|
||||
my $activityParams;
|
||||
if( exists $_[0] and ref $_[0] eq 'HASH' ) {
|
||||
$activityParams = shift ;
|
||||
|
|
@ -57,10 +56,10 @@ sub create {
|
|||
mode => 'realtime',
|
||||
},
|
||||
);
|
||||
my $activity = $workflow->addActivity($workflowClass);
|
||||
my $activity = $workflow->addActivity($activityClass);
|
||||
if( scalar( keys %$activityParams ) > 0 ) {
|
||||
$activity->set(%$activityParams);
|
||||
}
|
||||
}
|
||||
|
||||
my $instance = WebGUI::Workflow::Instance->create($session,
|
||||
{
|
||||
|
|
@ -69,10 +68,7 @@ sub create {
|
|||
}
|
||||
);
|
||||
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
$tag->commit;
|
||||
WebGUI::Test->tagsToRollback($tag);
|
||||
WebGUI::Test->workflowsToDelete($instance,$workflow);
|
||||
addToCleanup($workflow);
|
||||
|
||||
return bless { instance => $instance,
|
||||
session => $session,
|
||||
|
|
@ -92,20 +88,6 @@ sub rerun {
|
|||
skipSpectreNotification => 1,
|
||||
}
|
||||
);
|
||||
# WebGUI::Test->assetsToPurge($self->{instance}); -- does not work
|
||||
push @cleanup, $self->{instance};
|
||||
my $tag = WebGUI::VersionTag->getWorking($session, 1);
|
||||
if( $tag ) {
|
||||
$tag->commit;
|
||||
WebGUI::Test->tagsToRollback($tag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
END {
|
||||
|
||||
map { $_->delete; } ( @cleanup );
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue