Fix taxConfiguration property for the Sku asset.

This commit is contained in:
Colin Kuskie 2010-05-23 16:33:30 -07:00
parent a95ebdf5de
commit 89302e9875
2 changed files with 7 additions and 5 deletions

View file

@ -59,7 +59,7 @@ property vendorId => (
property taxConfiguration => ( property taxConfiguration => (
noFormPost => 1, noFormPost => 1,
fieldType => 'hidden', fieldType => 'hidden',
defaultValue => '{}', default => '{}',
); );
property shipsSeparately => ( property shipsSeparately => (
tab => 'shop', tab => 'shop',

View file

@ -30,20 +30,21 @@ my $session = WebGUI::Test->session;
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Tests # Tests
plan tests => 22; # Increment this number for each test you create plan tests => 23; # Increment this number for each test you create
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# put your tests here # put your tests here
my $root = WebGUI::Asset->getRoot($session); my $root = WebGUI::Asset->getRoot($session);
warn "Make sku\n"; note "Make sku\n";
my $sku = $root->addChild({ my $sku = $root->addChild({
className=>"WebGUI::Asset::Sku", className=>"WebGUI::Asset::Sku",
title=>"Test Sku", title=>"Test Sku",
}); });
isa_ok($sku, "WebGUI::Asset::Sku"); isa_ok($sku, "WebGUI::Asset::Sku");
addToCleanup($sku); WebGUI::Test->addToCleanup($sku);
$sku->addToCart; $sku->addToCart;
WebGUI::Test->addToCleanup($sku->getCart);
$sku->applyOptions({ $sku->applyOptions({
test1 => "YY" test1 => "YY"
@ -53,6 +54,7 @@ my $options = $sku->getOptions;
is($options->{test1}, "YY", "Can set and get an option."); is($options->{test1}, "YY", "Can set and get an option.");
is $sku->taxConfiguration, '{}', 'default tax configuration is a string with an empty hashref in it';
is($sku->getMaxAllowedInCart, 99999999, "Got a valid default max in cart."); is($sku->getMaxAllowedInCart, 99999999, "Got a valid default max in cart.");
is($sku->getQuantityAvailable, 99999999, "skus should have an unlimited quantity by default"); is($sku->getQuantityAvailable, 99999999, "skus should have an unlimited quantity by default");
is($sku->getQuantityAvailable, $sku->getMaxAllowedInCart, "quantity available and max allowed in cart should be the same"); is($sku->getQuantityAvailable, $sku->getMaxAllowedInCart, "quantity available and max allowed in cart should be the same");
@ -81,7 +83,7 @@ ok(! $sku->isShippingRequired, 'Making sure that GLOB is no longer in effect');
isa_ok($sku->getCart, "WebGUI::Shop::Cart", "can get a cart object"); isa_ok($sku->getCart, "WebGUI::Shop::Cart", "can get a cart object");
my $item = $sku->addToCart; my $item = $sku->addToCart;
isa_ok($item, "WebGUI::Shop::CartItem", "can add to cart"); isa_ok($item, "WebGUI::Shop::CartItem", "can add to cart");
$item->cart->delete;
my $loadSku = WebGUI::Asset::Sku->newBySku($session, $sku->get("sku")); my $loadSku = WebGUI::Asset::Sku->newBySku($session, $sku->get("sku"));
is($loadSku->getId, $sku->getId, "newBySku() works."); is($loadSku->getId, $sku->getId, "newBySku() works.");