Cleanup more tests that are leaking carts due to address book useId issues.

This commit is contained in:
Colin Kuskie 2010-05-02 00:17:03 -07:00
parent c6b34385ce
commit dbca5b31d9
2 changed files with 5 additions and 17 deletions

View file

@ -361,6 +361,7 @@ isnt(
my $cart = $driver->getCart; my $cart = $driver->getCart;
isa_ok ($cart, 'WebGUI::Shop::Cart', 'getCart returns an instantiated WebGUI::Shop::Cart object'); isa_ok ($cart, 'WebGUI::Shop::Cart', 'getCart returns an instantiated WebGUI::Shop::Cart object');
WebGUI::Test->addToCleanup($cart);
####################################################################### #######################################################################
# #
@ -587,16 +588,4 @@ is ($count, 0, 'delete deleted the object');
undef $driver; undef $driver;
#----------------------------------------------------------------------------
# Cleanup
}
END {
}
#vim:ft=perl #vim:ft=perl

View file

@ -24,6 +24,7 @@ use Test::Deep;
plan tests => 6; # increment this value for each test you create plan tests => 6; # increment this value for each test you create
my $session = WebGUI::Test->session; my $session = WebGUI::Test->session;
$session->user({userId => 3});
my $root = WebGUI::Asset->getRoot($session); my $root = WebGUI::Asset->getRoot($session);
my $donation = $root->addChild({ my $donation = $root->addChild({
@ -38,6 +39,7 @@ WebGUI::Test->tagsToRollback($tag);
my $cart1 = WebGUI::Shop::Cart->create($session); my $cart1 = WebGUI::Shop::Cart->create($session);
my $session2 = WebGUI::Session->open(WebGUI::Test->root, WebGUI::Test->file); my $session2 = WebGUI::Session->open(WebGUI::Test->root, WebGUI::Test->file);
$session2->user({userId => 3});
WebGUI::Test->sessionsToDelete($session2); WebGUI::Test->sessionsToDelete($session2);
my $cart2 = WebGUI::Shop::Cart->create($session2); my $cart2 = WebGUI::Shop::Cart->create($session2);
$cart2->update({creationDate => time()-10000}); $cart2->update({creationDate => time()-10000});
@ -81,6 +83,7 @@ my $instance1 = WebGUI::Workflow::Instance->create($session,
skipSpectreNotification => 1, skipSpectreNotification => 1,
} }
); );
WebGUI::Test->addToCleanup($instance1);
my $retVal; my $retVal;
@ -88,7 +91,7 @@ $retVal = $instance1->run();
is($retVal, 'complete', 'cleanup: activity complete'); is($retVal, 'complete', 'cleanup: activity complete');
$retVal = $instance1->run(); $retVal = $instance1->run();
is($retVal, 'done', 'cleanup: activity is done'); is($retVal, 'done', 'cleanup: activity is done');
$instance1->delete; $instance1->delete('skipNotify');
@cartIds = $session->db->buildArray('select cartId from cart'); @cartIds = $session->db->buildArray('select cartId from cart');
cmp_bag( cmp_bag(
@ -103,7 +106,3 @@ cmp_bag(
[ $item1->getId, ], [ $item1->getId, ],
'Deleted 1 item, the correct one' 'Deleted 1 item, the correct one'
); );
END {
$instance1->delete('skipNotify');
}