From c892e51c9bad0cb0d29ec0c535e1d1464f624fb6 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 13 May 2010 13:58:32 -0700 Subject: [PATCH] Update tests for wg8 and better cleanup. --- t/Asset/File/GalleryFile/Photo/00base.t | 15 +++------------ t/Asset/File/GalleryFile/Photo/comment.t | 11 +---------- t/Asset/File/GalleryFile/Photo/download.t | 12 +----------- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/t/Asset/File/GalleryFile/Photo/00base.t b/t/Asset/File/GalleryFile/Photo/00base.t index 5fcb8b76e..bca45f0a3 100644 --- a/t/Asset/File/GalleryFile/Photo/00base.t +++ b/t/Asset/File/GalleryFile/Photo/00base.t @@ -18,12 +18,14 @@ use Scalar::Util; use WebGUI::Test; use WebGUI::Session; use Test::More; +use Test::Exception; #---------------------------------------------------------------------------- # Init my $session = WebGUI::Test->session; my $node = WebGUI::Asset->getImportNode($session); my $versionTag = WebGUI::VersionTag->getWorking($session); +WebGUI::Test->addToCleanup($versionTag); $versionTag->set({name=>"Photo Test"}); @@ -90,15 +92,4 @@ is( my $properties = $photo->get; $photo->purge; -is( - WebGUI::Asset->newByDynamicClass($session, $properties->{assetId}), undef, - "Photo no longer able to be instanciated", -); - -#---------------------------------------------------------------------------- -# Cleanup -END { - $versionTag->rollback; -} - - +dies_ok { WebGUI::Asset->newById($session, $properties->{assetId}) } "Photo no longer able to be instanciated"; diff --git a/t/Asset/File/GalleryFile/Photo/comment.t b/t/Asset/File/GalleryFile/Photo/comment.t index acabceecd..0690d4759 100644 --- a/t/Asset/File/GalleryFile/Photo/comment.t +++ b/t/Asset/File/GalleryFile/Photo/comment.t @@ -31,6 +31,7 @@ my $node = WebGUI::Asset->getImportNode($session); my @versionTags = (); push @versionTags, WebGUI::VersionTag->getWorking($session); $versionTags[-1]->set({name=>"Photo Test, add Gallery, Album and 1 Photo"}); +WebGUI::Test->addToCleanup($versionTags[-1]); my @addArguments = ( undef, undef, { skipAutoCommitWorkflows => 1 } ); my $gallery @@ -326,13 +327,3 @@ TODO: { # TODO ok( 0, "Visitor has their IP logged in visitorIp field" ); } - -#---------------------------------------------------------------------------- -# Cleanup -END { - foreach my $versionTag (@versionTags) { - $versionTag->rollback; - } -}; - - diff --git a/t/Asset/File/GalleryFile/Photo/download.t b/t/Asset/File/GalleryFile/Photo/download.t index 6fa59fcd5..3d97b6d8b 100644 --- a/t/Asset/File/GalleryFile/Photo/download.t +++ b/t/Asset/File/GalleryFile/Photo/download.t @@ -29,7 +29,7 @@ my $node = WebGUI::Asset->getImportNode($session); my @versionTags = (); push @versionTags, WebGUI::VersionTag->getWorking($session); $versionTags[-1]->set({name=>"Photo Test, add Gallery, Album and 1 Photo"}); -my $versionTag = WebGUI::VersionTag->getWorking($session); +WebGUI::Test->addToCleanup($versionTags[-1]); my $gallery = $node->addChild({ @@ -84,13 +84,3 @@ ok( "getDownloadFileUrl croaks if resolution doesn't exist", ); - -#---------------------------------------------------------------------------- -# Cleanup -END { - foreach my $versionTag (@versionTags) { - $versionTag->rollback; - } -} - -