Forbid pasting content below a shortcut, to prevent loops on purge and other operations. Fixes bug #11855.

This commit is contained in:
Colin Kuskie 2010-09-13 18:47:17 -07:00
parent 59bd99c243
commit 4f632b27fc
4 changed files with 51 additions and 2 deletions

View file

@ -19,7 +19,7 @@ use WebGUI::Asset;
use WebGUI::VersionTag;
use Test::More; # increment this value for each test you create
plan tests => 27;
plan tests => 29;
my $session = WebGUI::Test->session;
$session->user({userId => 3});
@ -155,3 +155,38 @@ for my $i (0..2) {
is_tree_of_folders($clip, $i+1, $meth);
$clip->purge;
}
####################################################
#
# paste
#
####################################################
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($versionTag2);
my $page = $tempspace->addChild({
className => 'WebGUI::Asset::Wobject::Layout',
title => 'Parent asset',
});
my $shortcut = $tempspace->addChild({
className => 'WebGUI::Asset::Shortcut',
shortcutToAssetId => $page->getId,
});
$versionTag2->commit;
foreach my $asset ($page, $shortcut, ) {
$asset = $asset->cloneFromDb;
}
$shortcut->cut;
is $page->paste($shortcut->getId), 0, 'cannot paste a shortcut immediately below the asset it shortcuts';
$shortcut->publish;
$page->cut;
is $shortcut->paste($page->getId), 0, 'cannot paste below shortcuts';