diff --git a/t/Asset/Wobject/Shelf.t b/t/Asset/Wobject/Shelf.t index fc505cde3..0293f02e1 100644 --- a/t/Asset/Wobject/Shelf.t +++ b/t/Asset/Wobject/Shelf.t @@ -33,7 +33,7 @@ my $session = WebGUI::Test->session; #---------------------------------------------------------------------------- # Tests -my $tests = 41; +my $tests = 44; plan tests => 1 + $tests; #---------------------------------------------------------------------------- @@ -44,7 +44,7 @@ my $loaded = use_ok($class); my $storage; my ($e, $failure); -my $shelf; +my ($shelf, $shelf2); SKIP: { @@ -367,6 +367,30 @@ SKIP: { 'collateral added correctly for classical record' ); + $shelf->purge; + undef $shelf; + + $record = WebGUI::Asset::Sku->newBySku($session, 'classical-records-1'); + is($record, undef, 'deleting a shelf deletes all products beneath it'); + + ####################################################################### + # + # import, quoted headers and fields + # + ####################################################################### + + $shelf2 = WebGUI::Asset->getRoot($session)->addChild({className => $class}); + + $pass = 0; + eval { + $pass = $shelf2->importProducts( + WebGUI::Test->getTestCollateralPath('productTables/quotedTable.csv'), + ); + }; + ok($pass, 'Able to load a table with quoted fields'); + $e = Exception::Class->caught(); + is($e, '', 'No exception thrown on a file with quoted fields'); + is($shelf2->getChildCount, 3, 'imported 3 children skus for shelf2 with quoted fields'); } #---------------------------------------------------------------------------- @@ -375,4 +399,7 @@ END { if (defined $shelf and ref $shelf eq $class) { $shelf->purge; } + if (defined $shelf2 and ref $shelf2 eq $class) { + $shelf2->purge; + } } diff --git a/t/supporting_collateral/productTables/quotedTable.csv b/t/supporting_collateral/productTables/quotedTable.csv new file mode 100644 index 000000000..0befb12e3 --- /dev/null +++ b/t/supporting_collateral/productTables/quotedTable.csv @@ -0,0 +1,6 @@ +"mastersku","sku","title","shortdescription","price","weight","quantity" +"Kids-lashed","red-t-shirt","Colored T-Shirts","Red T-Shirt",5,1.33,1000 +"Kids-lashed","blue-t-shirt","Colored T-Shirts","Blue T-Shirt",5.25,1.33,2000 +"soda","soda-sweet","Sweet Soda-bottled in Oregon","Sweet Soda",0.95,0.95,500 +"classical-records-1","track-16","The Marriage of Figaro","Track 16",3.25,0,50 +"classical-records-1","track-9","The Marriage of Figaro","Track 9",3.25,0,55