More END block cleanups.
This commit is contained in:
parent
8a62abc3ef
commit
7034e2cf57
10 changed files with 25 additions and 64 deletions
|
|
@ -31,36 +31,29 @@ my $macro = 'WebGUI::Macro::CartItemCount';
|
|||
my $loaded = use_ok($macro);
|
||||
|
||||
my $cart = WebGUI::Shop::Cart->newBySession($session);
|
||||
WebGUI::Test->addToCleanup($cart);
|
||||
my $donation = WebGUI::Asset->getRoot($session)->addChild({
|
||||
className => 'WebGUI::Asset::Sku::Donation',
|
||||
title => 'Charitable donation',
|
||||
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);
|
||||
is ($output, '0', 'Empty cart returns 0 items');
|
||||
my $item2 = $cart->addItem($donation);
|
||||
$output = WebGUI::Macro::CartItemCount::process($session);
|
||||
is ($output, '2', 'Cart contains 2 items, 1 each');
|
||||
|
||||
my $item1 = $cart->addItem($donation);
|
||||
$output = WebGUI::Macro::CartItemCount::process($session);
|
||||
is ($output, '1', 'Cart contains 1 item');
|
||||
$item2->setQuantity(10);
|
||||
$output = WebGUI::Macro::CartItemCount::process($session);
|
||||
is ($output, '11', 'Cart contains 11 items, 1 and 10');
|
||||
|
||||
my $item2 = $cart->addItem($donation);
|
||||
$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;
|
||||
}
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -113,11 +113,5 @@ is(
|
|||
'... check illegal file type access returns empty string'
|
||||
);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
END {
|
||||
|
||||
$bundle->delete;
|
||||
|
||||
}
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use Test::More; # increment this value for each test you create
|
|||
my $session = WebGUI::Test->session;
|
||||
|
||||
my ($versionTag, $template) = addTemplate();
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
|
||||
my $homeAsset = WebGUI::Asset->getDefault($session);
|
||||
|
||||
|
|
@ -126,9 +127,4 @@ sub simpleTextParser {
|
|||
|
||||
return ($url, $label);
|
||||
}
|
||||
|
||||
END {
|
||||
if (defined $versionTag and ref $versionTag eq 'WebGUI::VersionTag') {
|
||||
$versionTag->rollback;
|
||||
}
|
||||
}
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue