Let the product importer import files with windows style line endings.

This commit is contained in:
Colin Kuskie 2008-09-29 00:57:02 +00:00
parent 72edbfd628
commit de889434da
4 changed files with 32 additions and 1 deletions

View file

@ -33,7 +33,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
my $tests = 45;
my $tests = 48;
plan tests => 1 + $tests;
#----------------------------------------------------------------------------
@ -391,6 +391,30 @@ SKIP: {
$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');
$shelf2->purge;
undef $shelf2;
#######################################################################
#
# import, windows line endings
#
#######################################################################
$shelf2 = WebGUI::Asset->getRoot($session)->addChild({className => $class});
$pass = 0;
eval {
$pass = $shelf2->importProducts(
WebGUI::Test->getTestCollateralPath('productTables/windowsTable.csv'),
);
};
ok($pass, 'Able to load a table with windows style newlines');
$e = Exception::Class->caught();
is($e, '', 'No exception thrown on a file with quoted fields');
is($shelf2->getChildCount, 2, 'imported 2 children skus for shelf2 with windows line endings fields');
$shelf2->purge;
}
#----------------------------------------------------------------------------

View file

@ -0,0 +1,4 @@
"mastersku","varSku","title","shortdescription","price","weight","quantity"
"Software","Windows-Vista","Windows Vista","Bad software",120,5.00,5000
"Software","Windows-XP","Windows XP","Mainly bad software",80,4.50,2000
"Hardware","X-box","X-box","Very expensive hardware",280,10,150
Can't render this file because it contains an unexpected character in line 1 and column 75.