Convert accessories over to the new Product collateral methods.
Add a method to get the JSON collateral indexed, for easy access to indeces. Add tests for the new getIndexedCollateralData method. In the upgrade script, put variants in all versions of the Product. Begin work on converting the collateral tables over to JSON.
This commit is contained in:
parent
9d2b810a05
commit
4da1f8314f
3 changed files with 129 additions and 29 deletions
|
|
@ -35,7 +35,7 @@ my $session = WebGUI::Test->session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 24; # Increment this number for each test you create
|
||||
plan tests => 26; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
|
|
@ -224,6 +224,29 @@ cmp_deeply(
|
|||
'moveCollateralUp: out of range index does not do anything',
|
||||
);
|
||||
|
||||
$product->setCollateral('variantsJSON', 2, { a => 'aoo', b => 'boo' });
|
||||
|
||||
cmp_deeply(
|
||||
$product->getIndexedCollateralData('variantsJSON'),
|
||||
[
|
||||
{a => 'ah', b => 'bay', collateralIndex => 0},
|
||||
{a => 'aye', b => 'bee', collateralIndex => 1},
|
||||
{a => 'aoo', b => 'boo', collateralIndex => 2},
|
||||
],
|
||||
'getIndexedCollateralData: returns data structure with indeces',
|
||||
);
|
||||
|
||||
cmp_deeply(
|
||||
$product->getAllCollateral('variantsJSON'),
|
||||
[
|
||||
{a => 'ah', b => 'bay'},
|
||||
{a => 'aye', b => 'bee'},
|
||||
{a => 'aoo', b => 'boo'},
|
||||
],
|
||||
'getIndexedCollateralData: does not affect asset data',
|
||||
);
|
||||
|
||||
|
||||
$product->purge;
|
||||
undef $product;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue