update Sku/Product.t test to include isShippingAddress and getConfiguredTitle

This commit is contained in:
Colin Kuskie 2008-07-31 02:56:09 +00:00
parent 05f85c5db3
commit 85e2c32919

View file

@ -34,7 +34,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
plan tests => 5; # Increment this number for each test you create
plan tests => 8; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
@ -51,9 +51,10 @@ my $image = WebGUI::Storage::Image->create($session);
$image->addFileFromFilesystem(WebGUI::Test->getTestCollateralPath('lamp.jpg'));
my $imagedProduct = $node->addChild({
className => "WebGUI::Asset::Sku::Product",
title => "Bible",
image1 => $image->getId,
className => "WebGUI::Asset::Sku::Product",
title => "Bible",
image1 => $image->getId,
isShippingRequired => 1,
});
ok($imagedProduct->getThumbnailUrl(), 'getThumbnailUrl is not empty');
@ -65,6 +66,24 @@ $otherImage->addFileFromFilesystem(WebGUI::Test->getTestCollateralPath('gooey.jp
ok($imagedProduct->getThumbnailUrl($otherImage), 'getThumbnailUrl with an explicit storageId returns something');
is($imagedProduct->getThumbnailUrl($otherImage), $otherImage->getThumbnailUrl('gooey.jpg'), 'getThumbnailUrl with an explicit storageId returns the right path to the URL');
is($imagedProduct->get('isShippingRequired'), 1, 'isShippingRequired set to 1 in db');
is($imagedProduct->isShippingRequired, 1, 'isShippingRequired accessor works');
my $englishVarId = $imagedProduct->setCollateral('variantsJSON', 'variantId', 'new',
{
shortdesc => 'English',
varSku => 'english-bible',
price => 10,
weight => 5,
quantity => 1000,
}
);
use Data::Dumper;
$imagedProduct->applyOptions($imagedProduct->getCollateral('variantsJSON', 'variantId', $englishVarId));
is($imagedProduct->getConfiguredTitle, 'Bible - English', 'getConfiguredTitle is overridden and concatenates the Product Title and the variant shortdesc');
#----------------------------------------------------------------------------
# Cleanup
END {