From 85e2c32919d18cb697a54d15a0faea333314b8f5 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 31 Jul 2008 02:56:09 +0000 Subject: [PATCH] update Sku/Product.t test to include isShippingAddress and getConfiguredTitle --- t/Asset/Sku/Product.t | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/t/Asset/Sku/Product.t b/t/Asset/Sku/Product.t index c2400ee0f..91de3033e 100644 --- a/t/Asset/Sku/Product.t +++ b/t/Asset/Sku/Product.t @@ -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 {