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 ( ) =head2 exportAssetData ( )
See WebGUI::AssetPackage::exportAssetData() for details. See WebGUI::AssetPackage::exportAssetData() for details.
Add the storage location to the export data. Adds all storage locations to the package data.
=cut =cut
sub exportAssetData { sub exportAssetData {
my $self = shift; my $self = shift;
my $data = $self->next::method; my $exportData = $self->next::method;
return $data; 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 Test::Deep;
use Data::Dumper; use Data::Dumper;
my $tests = 40; my $tests = 42;
plan tests => 1 plan tests => 1
+ $tests + $tests
; ;
@ -54,8 +54,6 @@ $archiveTag->commit;
my $storage1 = WebGUI::Storage->create($session); my $storage1 = WebGUI::Storage->create($session);
my $storage2 = WebGUI::Storage->create($session); my $storage2 = WebGUI::Storage->create($session);
WebGUI::Test->storagesToDelete($storage1, $storage2); WebGUI::Test->storagesToDelete($storage1, $storage2);
diag $storage1->getId;
diag $session->id->toHex($storage1->getId);
SKIP: { SKIP: {
@ -364,6 +362,24 @@ isnt($newPhotoData->[1]->{storageId}, $photoData->[1]->{storageId}, '... and sto
WebGUI::Test->storagesToDelete( map { $_->{storageId} } @{ $newPhotoData } ); 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 { END {