Make sure all version tags are cleaned up.

This commit is contained in:
Colin Kuskie 2009-09-26 08:51:47 -07:00
parent 01b6305aa7
commit 568e200592

View file

@ -26,20 +26,11 @@ use WebGUI::Asset::Snippet;
# Init # Init
my $session = WebGUI::Test->session; my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session); my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Shortcut Test"});
my $snippet; my $snippet;
my $shortcut; my $shortcut;
init(); init();
#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Tests # Tests
plan tests => 11; plan tests => 11;
@ -66,7 +57,7 @@ is(
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Test trashing snippet trashes shortcut also # Test trashing snippet trashes shortcut also
$snippet->trash; $snippet->trash;
$shortcut = WebGUI::Asset->newByDynamicClass($session, $shortcut->getId); $shortcut = $shortcut->cloneFromDb();
ok( ok(
defined $shortcut, defined $shortcut,
@ -86,7 +77,7 @@ ok(
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Test restoring snippet restores shortcut also # Test restoring snippet restores shortcut also
$snippet->publish; $snippet->publish;
$shortcut = WebGUI::Asset->newByDynamicClass($session, $shortcut->getId); $shortcut = $shortcut->cloneFromDb();
ok( ok(
defined $shortcut, defined $shortcut,
@ -131,7 +122,7 @@ init();
$snippet->trash(); $snippet->trash();
$snippet->purge(); $snippet->purge();
$shortcut = WebGUI::Asset->newByDynamicClass($session, $shortcut->getId); $shortcut = $shortcut->cloneFromDb();
ok( ok(
!defined $shortcut, !defined $shortcut,
@ -144,7 +135,7 @@ init();
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Test purging snippet purges shortcut also # Test purging snippet purges shortcut also
$snippet->purge; $snippet->purge;
$shortcut = WebGUI::Asset->newByDynamicClass($session, $shortcut->getId); $shortcut = $shortcut->cloneFromDb();
ok( ok(
!defined $shortcut, !defined $shortcut,
@ -155,6 +146,9 @@ ok(
# init a new snippet and shortcut; handy to have in a sub because we destroy # init a new snippet and shortcut; handy to have in a sub because we destroy
# them in some tests and need to reset them for the next round # them in some tests and need to reset them for the next round
sub init { sub init {
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Shortcut Test"});
WebGUI::Test->tagsToRollback($versionTag);
# Make a snippet to shortcut # Make a snippet to shortcut
$snippet $snippet
= $node->addChild({ = $node->addChild({