When a Sku is purged, delete it from all carts. Better handling for cartItems whose assets have been deleted. Fixes bug #12213

This commit is contained in:
Colin Kuskie 2011-08-02 09:59:10 -07:00
parent 44f62c9884
commit 3b7dd524db
5 changed files with 32 additions and 4 deletions

View file

@ -18,6 +18,7 @@ use strict;
use lib "$FindBin::Bin/../lib";
use Test::More;
use Test::Deep;
use Test::Exception;
use Scalar::Util qw/refaddr/;
use WebGUI::Test; # Must use this before any other WebGUI modules
use WebGUI::Session;
@ -35,7 +36,7 @@ my $i18n = WebGUI::International->new($session, "Shop");
#----------------------------------------------------------------------------
# Tests
plan tests => 36; # Increment this number for each test you create
plan tests => 38; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
@ -225,3 +226,9 @@ is($cart->delete, undef, "Can destroy cart.");
$product->purge;
my $requiresShipping_ok = lives_ok { $cart->requiresShipping; } 'requiresShipping does not die if the asset in the cart has been deleted';
SKIP: {
skip 1, 'requiresShipping died, so skipping' unless $requiresShipping_ok;
ok !$cart->requiresShipping, 'Shipping no longer required on a cart with missing assets';
}