Add storage locations to package data for a Story. With tests.

This commit is contained in:
Colin Kuskie 2009-04-13 17:56:44 +00:00
parent 9f5a82cec8
commit 4768a8687e
2 changed files with 26 additions and 6 deletions

View file

@ -204,14 +204,18 @@ sub duplicatePhotoData {
=head2 exportAssetData ( )
See WebGUI::AssetPackage::exportAssetData() for details.
Add the storage location to the export data.
Adds all storage locations to the package data.
=cut
sub exportAssetData {
my $self = shift;
my $data = $self->next::method;
return $data;
my $exportData = $self->next::method;
PHOTO: foreach my $photo (@{ $self->getPhotoData }) {
next PHOTO unless $photo->{storageId};
push @{ $exportData->{storage} }, $photo->{storageId};
}
return $exportData;
}
#-------------------------------------------------------------------

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 = 40;
my $tests = 42;
plan tests => 1
+ $tests
;
@ -54,8 +54,6 @@ $archiveTag->commit;
my $storage1 = WebGUI::Storage->create($session);
my $storage2 = WebGUI::Storage->create($session);
WebGUI::Test->storagesToDelete($storage1, $storage2);
diag $storage1->getId;
diag $session->id->toHex($storage1->getId);
SKIP: {
@ -364,6 +362,24 @@ isnt($newPhotoData->[1]->{storageId}, $photoData->[1]->{storageId}, '... and sto
WebGUI::Test->storagesToDelete( map { $_->{storageId} } @{ $newPhotoData } );
############################################################
#
# exportAssetData
#
############################################################
my $exportData = $story->exportAssetData;
isa_ok($exportData, 'HASH', 'exportAssetData');
cmp_bag(
$exportData->{storage},
[
$storage1->getId,
$storage2->getId,
],
'...asset package data has the storage locations in it'
);
}
END {