From 0f312d69b296189728a4110fe849d4bf5108279a Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sat, 27 Sep 2008 21:18:24 +0000 Subject: [PATCH] fix leaking products and shelves in test --- t/Asset/Wobject/Shelf.t | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/t/Asset/Wobject/Shelf.t b/t/Asset/Wobject/Shelf.t index 928887f1b..fc505cde3 100644 --- a/t/Asset/Wobject/Shelf.t +++ b/t/Asset/Wobject/Shelf.t @@ -50,7 +50,7 @@ SKIP: { skip "Unable to load module $class", $tests unless $loaded; - my $shelf = WebGUI::Asset->getRoot($session)->addChild({className => $class}); + $shelf = WebGUI::Asset->getRoot($session)->addChild({className => $class}); ####################################################################### # @@ -100,6 +100,7 @@ SKIP: { } + $failure=0; eval { $failure = $shelf->importProducts( WebGUI::Test->getTestCollateralPath('productTables/missingHeaders.csv'), @@ -117,6 +118,7 @@ SKIP: { 'importProducts: error handling for a file with a missing header', ); + $failure=0; eval { $failure = $shelf->importProducts( WebGUI::Test->getTestCollateralPath('productTables/badHeaders.csv'), @@ -134,7 +136,8 @@ SKIP: { 'importProducts: error handling for a file with a missing header', ); - my $pass = $shelf->importProducts( + my $pass=0; + $pass = $shelf->importProducts( WebGUI::Test->getTestCollateralPath('productTables/goodProductTable.csv'), ); ok($pass, 'Products imported'); @@ -203,7 +206,7 @@ SKIP: { is(scalar @productData, 4, 'productData should have 4 entries, 1 header + 3 data'); is($productData[0], 'mastersku,title,sku,shortdescription,price,weight,quantity', 'header line is okay'); @productData = map { [ WebGUI::Text::splitCSV($_) ] } @productData[1..3]; - my ($sodas, $shirts); + my ($sodas, $shirts) = ([], []); foreach my $productData (@productData) { if ($productData->[0] eq 'soda') { push @{ $sodas }, $productData; @@ -228,6 +231,7 @@ SKIP: { # ####################################################################### + $pass=0; $pass = $shelf->importProducts( WebGUI::Test->getTestCollateralPath('productTables/secondProductTable.csv'), ); @@ -302,6 +306,7 @@ SKIP: { # ####################################################################### + $pass=0; $pass = $shelf->importProducts( WebGUI::Test->getTestCollateralPath('productTables/thirdProductTable.csv'), ); @@ -362,7 +367,6 @@ SKIP: { 'collateral added correctly for classical record' ); - } #----------------------------------------------------------------------------