Clear cache on assets in trash and clipboard limbo states. fixes bug #11027
This commit is contained in:
parent
9a52044462
commit
e4b99f1d6c
5 changed files with 91 additions and 34 deletions
|
|
@ -22,13 +22,14 @@ use WebGUI::Asset;
|
|||
use WebGUI::VersionTag;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
plan tests => 6;
|
||||
plan tests => 12;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
$session->user({userId => 3});
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Asset Clipboard test"});
|
||||
WebGUI::Test->tagsToRollback($versionTag);
|
||||
|
||||
my $snippet = $root->addChild({
|
||||
url => 'testSnippet',
|
||||
|
|
@ -40,6 +41,32 @@ my $snippet = $root->addChild({
|
|||
|
||||
my $snippetAssetId = $snippet->getId;
|
||||
my $snippetRevisionDate = $snippet->get("revisionDate");
|
||||
my $topFolder = $root->addChild({
|
||||
url => 'TopFolder',
|
||||
title => 'TopFolder',
|
||||
menuTitle => 'topFolderMenuTitle',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
});
|
||||
my $folder1a = $topFolder->addChild({
|
||||
url => 'folder_1a',
|
||||
title => 'folder1a',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
});
|
||||
my $folder1b = $topFolder->addChild({
|
||||
url => 'folder_1b',
|
||||
title => 'folder1b',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
});
|
||||
my $folder1a2 = $folder1a->addChild({
|
||||
url => 'folder_1a2',
|
||||
title => 'folder1a2',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
});
|
||||
|
||||
|
||||
$versionTag->commit;
|
||||
|
||||
|
|
@ -61,11 +88,17 @@ is($duplicatedSnippet->getParent->getId, $root->getId, 'duplicated snippet is al
|
|||
|
||||
my $newVersionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$newVersionTag->commit;
|
||||
WebGUI::Test->tagsToRollback($newVersionTag);
|
||||
|
||||
END {
|
||||
foreach my $tag($versionTag, $newVersionTag) {
|
||||
if (defined $tag and ref $tag eq 'WebGUI::VersionTag') {
|
||||
$tag->rollback;
|
||||
}
|
||||
}
|
||||
}
|
||||
####################################################
|
||||
#
|
||||
# cut
|
||||
#
|
||||
####################################################
|
||||
|
||||
is( $topFolder->cut, 1, 'cut: returns 1 if successful' );
|
||||
is($topFolder->get('state'), 'clipboard', '... state set to trash on the trashed asset object');
|
||||
is($topFolder->cloneFromDb->get('state'), 'clipboard', '... state set to trash in db on object');
|
||||
is($folder1a->cloneFromDb->get('state'), 'clipboard-limbo', '... state set to clipboard-limbo on child #1');
|
||||
is($folder1b->cloneFromDb->get('state'), 'clipboard-limbo', '... state set to clipboard-limbo on child #2');
|
||||
is($folder1a2->cloneFromDb->get('state'), 'clipboard-limbo', '... state set to clipboard-limbo on grandchild #1-1');
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use WebGUI::Session;
|
|||
use WebGUI::User;
|
||||
|
||||
use WebGUI::Asset;
|
||||
use Test::More tests => 1; # increment this value for each test you create
|
||||
use Test::More tests => 7; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
|
||||
# Test the methods in WebGUI::AssetLineage
|
||||
|
|
@ -26,6 +26,7 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"AssetLineage Test"});
|
||||
WebGUI::Test->tagsToRollback($versionTag);
|
||||
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $topFolder = $root->addChild({
|
||||
|
|
@ -35,9 +36,40 @@ my $topFolder = $root->addChild({
|
|||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
});
|
||||
my $folder1a = $topFolder->addChild({
|
||||
url => 'folder_1a',
|
||||
title => 'folder1a',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
});
|
||||
my $folder1b = $topFolder->addChild({
|
||||
url => 'folder_1b',
|
||||
title => 'folder1b',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
});
|
||||
my $folder1a2 = $folder1a->addChild({
|
||||
url => 'folder_1a2',
|
||||
title => 'folder1a2',
|
||||
groupIdEdit => 3,
|
||||
className => 'WebGUI::Asset::Wobject::Folder',
|
||||
});
|
||||
|
||||
$versionTag->commit;
|
||||
|
||||
####################################################
|
||||
#
|
||||
# trash
|
||||
#
|
||||
####################################################
|
||||
|
||||
is( $topFolder->trash, 1, 'trash: returns 1 if successful' );
|
||||
is($topFolder->get('state'), 'trash', '... state set to trash on the trashed asset object');
|
||||
is($topFolder->cloneFromDb->get('state'), 'trash', '... state set to trash in db on object');
|
||||
is($folder1a->cloneFromDb->get('state'), 'trash-limbo', '... state set to trash-limbo on child #1');
|
||||
is($folder1b->cloneFromDb->get('state'), 'trash-limbo', '... state set to trash-limbo on child #2');
|
||||
is($folder1a2->cloneFromDb->get('state'), 'trash-limbo', '... state set to trash-limbo on grandchild #1-1');
|
||||
|
||||
####################################################
|
||||
#
|
||||
# purge
|
||||
|
|
@ -45,9 +77,3 @@ $versionTag->commit;
|
|||
####################################################
|
||||
|
||||
is($topFolder->purge, 1, 'purge returns 1 if asset can be purged');
|
||||
|
||||
END {
|
||||
foreach my $tag ($versionTag) {
|
||||
$tag->rollback;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue