From 568e2005923d2d8242294f42707cb4c8fd889afc Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sat, 26 Sep 2009 08:51:47 -0700 Subject: [PATCH] Make sure all version tags are cleaned up. --- t/Asset/Shortcut/010-linked-asset.t | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/t/Asset/Shortcut/010-linked-asset.t b/t/Asset/Shortcut/010-linked-asset.t index ed945c7a3..ab3eec740 100644 --- a/t/Asset/Shortcut/010-linked-asset.t +++ b/t/Asset/Shortcut/010-linked-asset.t @@ -26,20 +26,11 @@ use WebGUI::Asset::Snippet; # Init my $session = WebGUI::Test->session; my $node = WebGUI::Asset->getImportNode($session); -my $versionTag = WebGUI::VersionTag->getWorking($session); -$versionTag->set({name=>"Shortcut Test"}); my $snippet; my $shortcut; init(); -#---------------------------------------------------------------------------- -# Cleanup -END { - $versionTag->rollback(); -} - - #---------------------------------------------------------------------------- # Tests plan tests => 11; @@ -66,7 +57,7 @@ is( #---------------------------------------------------------------------------- # Test trashing snippet trashes shortcut also $snippet->trash; -$shortcut = WebGUI::Asset->newByDynamicClass($session, $shortcut->getId); +$shortcut = $shortcut->cloneFromDb(); ok( defined $shortcut, @@ -86,7 +77,7 @@ ok( #---------------------------------------------------------------------------- # Test restoring snippet restores shortcut also $snippet->publish; -$shortcut = WebGUI::Asset->newByDynamicClass($session, $shortcut->getId); +$shortcut = $shortcut->cloneFromDb(); ok( defined $shortcut, @@ -131,7 +122,7 @@ init(); $snippet->trash(); $snippet->purge(); -$shortcut = WebGUI::Asset->newByDynamicClass($session, $shortcut->getId); +$shortcut = $shortcut->cloneFromDb(); ok( !defined $shortcut, @@ -144,7 +135,7 @@ init(); #---------------------------------------------------------------------------- # Test purging snippet purges shortcut also $snippet->purge; -$shortcut = WebGUI::Asset->newByDynamicClass($session, $shortcut->getId); +$shortcut = $shortcut->cloneFromDb(); ok( !defined $shortcut, @@ -155,6 +146,9 @@ ok( # 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 sub init { + my $versionTag = WebGUI::VersionTag->getWorking($session); + $versionTag->set({name=>"Shortcut Test"}); + WebGUI::Test->tagsToRollback($versionTag); # Make a snippet to shortcut $snippet = $node->addChild({ @@ -166,4 +160,4 @@ sub init { className => "WebGUI::Asset::Shortcut", shortcutToAssetId => $snippet->getId, }); -} \ No newline at end of file +}