Convert Story asset to use Class::C3 properly.

Add a method to duplicate the photo collateral JSON data, with tests.
Make addRevision and duplicate use that method.
This commit is contained in:
Colin Kuskie 2009-04-13 16:33:24 +00:00
parent 8b6ff20822
commit ec4713855a
2 changed files with 69 additions and 19 deletions

View file

@ -20,7 +20,7 @@ use Test::More; # increment this value for each test you create
use Test::Deep;
use Data::Dumper;
my $tests = 37;
my $tests = 38;
plan tests => 1
+ $tests
;
@ -339,6 +339,26 @@ cmp_deeply(
ok($viewVariables->{singlePhoto}, 'viewVariables: singlePhoto: there is just 1');
ok($viewVariables->{hasPhotos}, 'viewVariables: hasPhotos: it has photos');
############################################################
#
# duplicatePhotoData
#
############################################################
$photoData = $story->getPhotoData;
$photoData->[0]->{storageId} = ignore();
$photoData->[1]->{storageId} = ignore();
my $newPhotoData = $story->duplicatePhotoData;
cmp_deeply(
$newPhotoData,
$photoData,
'duplicatePhotoData: checking JSON data minus storage locations'
);
WebGUI::Storage->get($session, $newPhotoData->[0]->{storageId})->delete;
WebGUI::Storage->get($session, $newPhotoData->[1]->{storageId})->delete;
}
END {