Don't let the cart crash on invalid addressIds

This commit is contained in:
Martin Kamerbeek 2010-12-22 13:31:16 +00:00
parent f748aa1b83
commit 10ea82d6ec
3 changed files with 27 additions and 3 deletions

View file

@ -35,7 +35,7 @@ my $i18n = WebGUI::International->new($session, "Shop");
#----------------------------------------------------------------------------
# Tests
plan tests => 34; # Increment this number for each test you create
plan tests => 36; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
@ -207,5 +207,21 @@ is($cart->delete, undef, "Can destroy cart.");
$cart->update( { shippingAddressId => $shipper->getId } );
}
# Test (part of) www_view
{
my $shippingAddressId = $cart->get( 'shippingAddressId' );
my $billingAddressId = $cart->get( 'billingAddressId' );
$cart->update( { shippingAddressId => 'NoWayDude' } );
eval { $cart->www_view };
is( $@, '', 'Invalid shippingAddressId doesn\'t make www_view crash' );
$cart->update( { billingAddressId => 'WRONG!!!!', shippingAddressId => $shippingAddressId } );
eval { $cart->www_view };
is( $@, '', 'Invalid billingAddressId doesn\'t make www_view crash' );
$cart->update( { billingAddressId => $billingAddressId } );
}
$product->purge;