Fix photo JSON handling in the story, where the data is cached incorrectly. Fixes bug #12136
This commit is contained in:
parent
b872694390
commit
ab1b6aa4fd
3 changed files with 64 additions and 18 deletions
|
|
@ -8,6 +8,8 @@
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use Test::MockTime qw/:all/;
|
||||
|
||||
use FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
|
|
@ -84,7 +86,7 @@ WebGUI::Test->addToCleanup($storage1, $storage2);
|
|||
#
|
||||
############################################################
|
||||
|
||||
my $tests = 47;
|
||||
my $tests = 49;
|
||||
plan tests => 1
|
||||
+ $tests
|
||||
+ $canEditMaker->plan
|
||||
|
|
@ -482,6 +484,62 @@ cmp_bag(
|
|||
) or diag Dumper( $keyword_loop );
|
||||
$session->scratch->delete('isExporting');
|
||||
|
||||
############################################################
|
||||
#
|
||||
# addRevision, copying and duplicating photo data
|
||||
#
|
||||
############################################################
|
||||
|
||||
set_relative_time(-70);
|
||||
|
||||
my $rev_story = $archive->addChild({
|
||||
className => 'WebGUI::Asset::Story',
|
||||
title => 'Story revision',
|
||||
subtitle => 'The story of a CMS',
|
||||
byline => 'C.F. Kuskie',
|
||||
story => 'Revisioning a story should not cause the photo information to be lost.',
|
||||
}, undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1, });
|
||||
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
$tag->commit;
|
||||
|
||||
my $rev_story = $rev_story->cloneFromDb;
|
||||
|
||||
my $rev_storage = WebGUI::Storage->create($session);
|
||||
|
||||
$rev_story->setPhotoData([{
|
||||
byLine => 'C Forest Kuskie',
|
||||
caption => 'ugly old hacker',
|
||||
storageId => $rev_storage->getId,
|
||||
}]);
|
||||
|
||||
cmp_deeply(
|
||||
$rev_story->getPhotoData,
|
||||
[{
|
||||
byLine => 'C Forest Kuskie',
|
||||
caption => 'ugly old hacker',
|
||||
storageId => $rev_storage->getId,
|
||||
}],
|
||||
'setup for add revision test, photo data'
|
||||
);
|
||||
|
||||
restore_time();
|
||||
|
||||
my $revision = $rev_story->addRevision({}, undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1, });
|
||||
|
||||
cmp_deeply(
|
||||
$revision->getPhotoData,
|
||||
[{
|
||||
byLine => 'C Forest Kuskie',
|
||||
caption => 'ugly old hacker',
|
||||
storageId => ignore(),
|
||||
}],
|
||||
'revision has a copy of most of the photo data'
|
||||
);
|
||||
|
||||
my $revision_storageId = $revision->getPhotoData->[0]->{storageId};
|
||||
|
||||
ok($revision_storageId && ($revision_storageId ne $rev_storage->getId), 'storageId in the revision is different from the original');
|
||||
|
||||
}
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue