deleteCollateral tests, and detab Sku/Product.pm

This commit is contained in:
Colin Kuskie 2008-05-03 19:24:30 +00:00
parent ef12f5118f
commit 9489383cfe
2 changed files with 72 additions and 41 deletions

View file

@ -35,7 +35,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
plan tests => 14; # Increment this number for each test you create
plan tests => 17; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
@ -127,6 +127,37 @@ cmp_deeply(
'getCollateral: negative index works',
);
$product->setCollateral('variantsJSON', 'new', { a => 'alpha', b => 'beta'});
$product->deleteCollateral('variantsJSON', 1);
cmp_deeply(
$product->getAllCollateral('variantsJSON'),
[
{a => 'aye', b => 'bee' },
{a => 'alpha', b => 'beta' },
],
'deleteCollateral: delete by index works',
);
$product->deleteCollateral('variantsJSON', 4);
cmp_deeply(
$product->getAllCollateral('variantsJSON'),
[
{a => 'aye', b => 'bee' },
{a => 'alpha', b => 'beta' },
],
'deleteCollateral: out of range index does not delete',
);
$product->deleteCollateral('variantsJSON', -1);
cmp_deeply(
$product->getAllCollateral('variantsJSON'),
[
{a => 'aye', b => 'bee' },
],
'deleteCollateral: negative index works',
);
$product->purge;