More END block cleanups.
This commit is contained in:
parent
8a62abc3ef
commit
7034e2cf57
10 changed files with 25 additions and 64 deletions
|
|
@ -48,6 +48,7 @@ my $dummy = WebGUI::Asset->getDefault($session)->addChild({
|
||||||
synopsis => 'Dummy Synopsis',
|
synopsis => 'Dummy Synopsis',
|
||||||
description => 'Dummy Description',
|
description => 'Dummy Description',
|
||||||
});
|
});
|
||||||
|
WebGUI::Test->addToCleanup($dummy);
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
#
|
#
|
||||||
|
|
@ -191,11 +192,4 @@ cmp_bag(
|
||||||
#
|
#
|
||||||
#####################################################
|
#####################################################
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Cleanup
|
|
||||||
END {
|
|
||||||
$dummy->purge;
|
|
||||||
my $tag = WebGUI::VersionTag->getWorking($session, 'noCreate');
|
|
||||||
$tag->rollback if $tag;
|
|
||||||
}
|
|
||||||
#vim:ft=perl
|
#vim:ft=perl
|
||||||
|
|
|
||||||
|
|
@ -31,36 +31,29 @@ my $macro = 'WebGUI::Macro::CartItemCount';
|
||||||
my $loaded = use_ok($macro);
|
my $loaded = use_ok($macro);
|
||||||
|
|
||||||
my $cart = WebGUI::Shop::Cart->newBySession($session);
|
my $cart = WebGUI::Shop::Cart->newBySession($session);
|
||||||
|
WebGUI::Test->addToCleanup($cart);
|
||||||
my $donation = WebGUI::Asset->getRoot($session)->addChild({
|
my $donation = WebGUI::Asset->getRoot($session)->addChild({
|
||||||
className => 'WebGUI::Asset::Sku::Donation',
|
className => 'WebGUI::Asset::Sku::Donation',
|
||||||
title => 'Charitable donation',
|
title => 'Charitable donation',
|
||||||
defaultPrice => 10.00,
|
defaultPrice => 10.00,
|
||||||
});
|
});
|
||||||
|
WebGUI::Test->addToCleanup($donation);
|
||||||
|
|
||||||
SKIP: {
|
my $output;
|
||||||
|
|
||||||
skip "Unable to load $macro", $numTests-1 unless $loaded;
|
$output = WebGUI::Macro::CartItemCount::process($session);
|
||||||
|
is ($output, '0', 'Empty cart returns 0 items');
|
||||||
|
|
||||||
my $output;
|
my $item1 = $cart->addItem($donation);
|
||||||
|
$output = WebGUI::Macro::CartItemCount::process($session);
|
||||||
|
is ($output, '1', 'Cart contains 1 item');
|
||||||
|
|
||||||
$output = WebGUI::Macro::CartItemCount::process($session);
|
my $item2 = $cart->addItem($donation);
|
||||||
is ($output, '0', 'Empty cart returns 0 items');
|
$output = WebGUI::Macro::CartItemCount::process($session);
|
||||||
|
is ($output, '2', 'Cart contains 2 items, 1 each');
|
||||||
|
|
||||||
my $item1 = $cart->addItem($donation);
|
$item2->setQuantity(10);
|
||||||
$output = WebGUI::Macro::CartItemCount::process($session);
|
$output = WebGUI::Macro::CartItemCount::process($session);
|
||||||
is ($output, '1', 'Cart contains 1 item');
|
is ($output, '11', 'Cart contains 11 items, 1 and 10');
|
||||||
|
|
||||||
my $item2 = $cart->addItem($donation);
|
#vim:ft=perl
|
||||||
$output = WebGUI::Macro::CartItemCount::process($session);
|
|
||||||
is ($output, '2', 'Cart contains 2 items, 1 each');
|
|
||||||
|
|
||||||
$item2->setQuantity(10);
|
|
||||||
$output = WebGUI::Macro::CartItemCount::process($session);
|
|
||||||
is ($output, '11', 'Cart contains 11 items, 1 and 10');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
END {
|
|
||||||
$cart->delete;
|
|
||||||
$donation->purge;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -113,11 +113,5 @@ is(
|
||||||
'... check illegal file type access returns empty string'
|
'... check illegal file type access returns empty string'
|
||||||
);
|
);
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Cleanup
|
|
||||||
END {
|
|
||||||
|
|
||||||
$bundle->delete;
|
|
||||||
|
|
||||||
}
|
|
||||||
#vim:ft=perl
|
#vim:ft=perl
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ use Test::More; # increment this value for each test you create
|
||||||
my $session = WebGUI::Test->session;
|
my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
my ($versionTag, $template) = addTemplate();
|
my ($versionTag, $template) = addTemplate();
|
||||||
|
WebGUI::Test->addToCleanup($versionTag);
|
||||||
|
|
||||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||||
|
|
||||||
|
|
@ -126,9 +127,4 @@ sub simpleTextParser {
|
||||||
|
|
||||||
return ($url, $label);
|
return ($url, $label);
|
||||||
}
|
}
|
||||||
|
#vim:ft=perl
|
||||||
END {
|
|
||||||
if (defined $versionTag and ref $versionTag eq 'WebGUI::VersionTag') {
|
|
||||||
$versionTag->rollback;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ my $workflow = WebGUI::Workflow->create($session,
|
||||||
mode => 'realtime',
|
mode => 'realtime',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
WebGUI::Test->addToCleanup($workflow);
|
||||||
my $icalFetch = $workflow->addActivity('WebGUI::Workflow::Activity::CalendarUpdateFeeds');
|
my $icalFetch = $workflow->addActivity('WebGUI::Workflow::Activity::CalendarUpdateFeeds');
|
||||||
|
|
||||||
my $instance1 = WebGUI::Workflow::Instance->create($session,
|
my $instance1 = WebGUI::Workflow::Instance->create($session,
|
||||||
|
|
@ -127,8 +128,4 @@ is(scalar @{ $newEvents }, 1, 'reimport does not create new children');
|
||||||
$anniversary = pop @{ $newEvents };
|
$anniversary = pop @{ $newEvents };
|
||||||
is($anniversary->get('description'), $party->get('description'), '... description, checks for line unwrapping');
|
is($anniversary->get('description'), $party->get('description'), '... description, checks for line unwrapping');
|
||||||
|
|
||||||
END {
|
#vim:ft=perl
|
||||||
$instance1 && $instance1->delete('skipNotify');
|
|
||||||
$instance2 && $instance2->delete('skipNotify');
|
|
||||||
$workflow && $workflow->delete;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ my $workflow = WebGUI::Workflow->create($session,
|
||||||
mode => 'realtime',
|
mode => 'realtime',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
WebGUI::Test->addToCleanup($workflow);
|
||||||
my $activity = $workflow->addActivity('WebGUI::Workflow::Activity::DeleteExpiredSessions');
|
my $activity = $workflow->addActivity('WebGUI::Workflow::Activity::DeleteExpiredSessions');
|
||||||
|
|
||||||
my $instance1 = WebGUI::Workflow::Instance->create($session,
|
my $instance1 = WebGUI::Workflow::Instance->create($session,
|
||||||
|
|
@ -113,6 +114,4 @@ foreach my $testSession (@sessions) {
|
||||||
## Make sure that one scratch session was deleted and the other kept.
|
## Make sure that one scratch session was deleted and the other kept.
|
||||||
## Close and end all four sessions
|
## Close and end all four sessions
|
||||||
|
|
||||||
END {
|
#vim:ft=perl
|
||||||
$workflow->delete;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,4 @@ is($session->db->quickScalar('select count(*) from Survey_response where Survey_
|
||||||
# Afterwards, back to no incomplete responses
|
# Afterwards, back to no incomplete responses
|
||||||
is( scalar $session->db->buildArray($SQL), 0, 'Afterwards, back to no incomplete responses');
|
is( scalar $session->db->buildArray($SQL), 0, 'Afterwards, back to no incomplete responses');
|
||||||
|
|
||||||
END {
|
#vim:ft=perl
|
||||||
$session->db->write('delete from Survey_response where userId = ?', [$user->userId]) if $user;
|
|
||||||
$survey->purge if $survey;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -143,9 +143,4 @@ $post2mock->set_always('getId', $post2_id);
|
||||||
WebGUI::Test->unmockAssetId($post_id);
|
WebGUI::Test->unmockAssetId($post_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Cleanup
|
|
||||||
END {
|
|
||||||
|
|
||||||
}
|
|
||||||
#vim:ft=perl
|
#vim:ft=perl
|
||||||
|
|
|
||||||
|
|
@ -112,9 +112,4 @@ sub createInstance {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Cleanup
|
|
||||||
END {
|
|
||||||
|
|
||||||
}
|
|
||||||
#vim:ft=perl
|
#vim:ft=perl
|
||||||
|
|
|
||||||
|
|
@ -895,9 +895,10 @@ Example call:
|
||||||
'WebGUI::Shop::Vendor' => 'delete',
|
'WebGUI::Shop::Vendor' => 'delete',
|
||||||
'WebGUI::Inbox::Message' => 'purge',
|
'WebGUI::Inbox::Message' => 'purge',
|
||||||
'WebGUI::AdSpace' => 'delete',
|
'WebGUI::AdSpace' => 'delete',
|
||||||
|
'WebGUI::FilePump::Bundle' => 'delete',
|
||||||
'WebGUI::Shop::Cart' => sub {
|
'WebGUI::Shop::Cart' => sub {
|
||||||
my $cart = shift;
|
my $cart = shift;
|
||||||
my $addressBook = $cart->getAddressBook();
|
my $addressBook = eval { $cart->getAddressBook(); };
|
||||||
$addressBook->delete if $addressBook; ##Should we call cleanupGuard instead???
|
$addressBook->delete if $addressBook; ##Should we call cleanupGuard instead???
|
||||||
$cart->delete;
|
$cart->delete;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue