forward port Product JSON collateral wide character fix

This commit is contained in:
Colin Kuskie 2008-12-01 19:29:45 +00:00
parent 23f8e48f6d
commit e961bb6f26
3 changed files with 12 additions and 6 deletions

View file

@ -19,6 +19,7 @@ use lib "$FindBin::Bin/../../lib";
use Test::More;
use Test::Deep;
use Test::Exception;
use JSON;
use Data::Dumper;
@ -35,7 +36,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
plan tests => 33; # Increment this number for each test you create
plan tests => 34; # Increment this number for each test you create
#----------------------------------------------------------------------------
# put your tests here
@ -291,16 +292,20 @@ is( $product5->getCollateral('variantsJSON', 'vid', $newVid)->{check}, 'no leaks
$product5->purge;
##Handle wide characters
my $product6 = $root->addChild({
className => "WebGUI::Asset::Sku::Product",
title => "Wide character attempt",
});
$newVid = $product6->setCollateral('variantsJSON', 'vid', 'new', { wideChar => q!“I hope this has a smart quote in it.”!
$newVid = $product6->setCollateral('variantsJSON', 'vid', 'new', { wideChar => qq!on 16\x{201d} hand-crocheted Cord!
, vid => 'new' });
use Data::Dumper;
diag Dumper $product6->getCollateral('variantsJSON', 'vid', $newVid);
my $product6a = WebGUI::Asset->newByDynamicClass($session, $product6->getId);
lives_ok { $product6a->getAllCollateral('variantsJSON', 'vid', $newVid); }, 'Product collateral handles wide-character encodings okay';
$product6->purge;
#----------------------------------------------------------------------------
# Cleanup