diff --git a/t/Asset/Event/permissions.t b/t/Asset/Event/permissions.t index da03bb13e..14105f4a1 100644 --- a/t/Asset/Event/permissions.t +++ b/t/Asset/Event/permissions.t @@ -31,6 +31,7 @@ $session->user({ userId => 3 }); 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 $registeredUser = WebGUI::User->new( $session, "new" ); WebGUI::Test->addToCleanup($registeredUser); @@ -59,6 +60,7 @@ plan tests => 12; # Increment this number for each test you create # Test permissions of an event added by the Admin push @versionTags, WebGUI::VersionTag->getWorking($session); $versionTags[-1]->set({name=>"Photo Test, add Gallery, Album and 1 Photo"}); +WebGUI::Test->addToCleanup($versionTags[-1]); $event = $calendar->addChild({ className => 'WebGUI::Asset::Event', ownerUserId => 3, @@ -77,10 +79,4 @@ $maker->prepare( { fail => [ '1', $registeredUser, ], } )->run; -#---------------------------------------------------------------------------- -# Cleanup -END { - for my $tag ( @versionTags ) { - $tag->rollback; - } -} +#vim:ft=perl diff --git a/t/Asset/File/GalleryFile/Photo/comment.t b/t/Asset/File/GalleryFile/Photo/comment.t index acabceecd..bd7dc40e9 100644 --- a/t/Asset/File/GalleryFile/Photo/comment.t +++ b/t/Asset/File/GalleryFile/Photo/comment.t @@ -30,6 +30,7 @@ my $node = WebGUI::Asset->getImportNode($session); my @versionTags = (); push @versionTags, WebGUI::VersionTag->getWorking($session); +WebGUI::Test->addToCleanup($versionTags[-1]); $versionTags[-1]->set({name=>"Photo Test, add Gallery, Album and 1 Photo"}); my @addArguments = ( undef, undef, { skipAutoCommitWorkflows => 1 } ); @@ -327,12 +328,4 @@ TODO: { ok( 0, "Visitor has their IP logged in visitorIp field" ); } -#---------------------------------------------------------------------------- -# Cleanup -END { - foreach my $versionTag (@versionTags) { - $versionTag->rollback; - } -}; - - +#vim:ft=perl diff --git a/t/Asset/File/GalleryFile/Photo/download.t b/t/Asset/File/GalleryFile/Photo/download.t index 6fa59fcd5..4001af2eb 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,4 @@ ok( "getDownloadFileUrl croaks if resolution doesn't exist", ); - -#---------------------------------------------------------------------------- -# Cleanup -END { - foreach my $versionTag (@versionTags) { - $versionTag->rollback; - } -} - - +#vim:ft=perl diff --git a/t/Asset/File/GalleryFile/Photo/setFile.t b/t/Asset/File/GalleryFile/Photo/setFile.t index c76ca860b..3ea16a6c4 100644 --- a/t/Asset/File/GalleryFile/Photo/setFile.t +++ b/t/Asset/File/GalleryFile/Photo/setFile.t @@ -25,6 +25,7 @@ use WebGUI::Asset::File::GalleryFile::Photo; 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"}); my $gallery = $node->addChild({ @@ -70,10 +71,4 @@ ok( "Generated resolution file exists on the filesystem", ); - -#---------------------------------------------------------------------------- -# Cleanup -END { - $versionTag->rollback(); -} - +#vim:ft=perl diff --git a/t/Asset/File/Image/setfile.t b/t/Asset/File/Image/setfile.t index 0792b0699..0d7735294 100644 --- a/t/Asset/File/Image/setfile.t +++ b/t/Asset/File/Image/setfile.t @@ -25,6 +25,7 @@ use WebGUI::Asset::File::Image; my $session = WebGUI::Test->session; my $node = WebGUI::Asset->getImportNode($session); my $versionTag = WebGUI::VersionTag->getWorking($session); +WebGUI::Test->addToCleanup($versionTag); $versionTag->set({name=>"Image Test"}); my $image = $node->addChild({ @@ -54,9 +55,4 @@ ok( "Thumbnail file exists on the filesystem", ); - -#---------------------------------------------------------------------------- -# Cleanup -END { - $versionTag->rollback(); -} +#vim:ft=perl diff --git a/t/Asset/Wobject/UserList.t b/t/Asset/Wobject/UserList.t index 4584c09e4..8646bca06 100644 --- a/t/Asset/Wobject/UserList.t +++ b/t/Asset/Wobject/UserList.t @@ -27,6 +27,7 @@ my $node = WebGUI::Asset->getImportNode($session); my $versionTag = WebGUI::VersionTag->getWorking($session); $versionTag->set({name=>"UserList Test"}); +WebGUI::Test->addToCleanup($versionTag); my $userList = $node->addChild({className=>'WebGUI::Asset::Wobject::UserList'}); # Test for a sane object type @@ -45,8 +46,4 @@ foreach my $newSetting (keys %{$newUserListSettings}) { is ($userList->get($newSetting), $newUserListSettings->{$newSetting}, "updated $newSetting is ".$newUserListSettings->{$newSetting}); } -END { - # Clean up after thy self - $versionTag->rollback(); -} - +#vim:ft=perl diff --git a/t/Crud/Subclass.t b/t/Crud/Subclass.t index 92fd009ba..c54bccf1c 100644 --- a/t/Crud/Subclass.t +++ b/t/Crud/Subclass.t @@ -30,6 +30,7 @@ plan tests => 4; # Increment this number for each test you create # Create WebGUI::Crud::Subclass->crud_createTable($session); +WebGUI::Test->addToCleanup(sub { WebGUI::Crud::Subclass->crud_dropTable($session); }); my $record1 = WebGUI::Crud::Subclass->create($session, { field1 => 10 }); isa_ok($record1, "WebGUI::Crud", "isa WebGUI::Crud"); is($record1->get('field1'), 10, "got back correct field1 value"); @@ -38,11 +39,4 @@ is($record1->get('field1'), 10, "got back correct field1 value"); is(WebGUI::Crud::Subclass->create($session, { field1 => 0 })->get('field1'), 0, 'zero does not trigger default'); is(WebGUI::Crud::Subclass->create($session, { field1 => '' })->get('field1'), 5, '..but empty string intentionally triggers default'); -#---------------------------------------------------------------------------- -# Cleanup -END { - -WebGUI::Crud::Subclass->crud_dropTable($session); - -} #vim:ft=perl diff --git a/t/ProfileCategory.t b/t/ProfileCategory.t index 0c0a560e6..95c0051da 100644 --- a/t/ProfileCategory.t +++ b/t/ProfileCategory.t @@ -33,6 +33,7 @@ my @labels = map { $_->getLabel } @{ $categories }; my %originalProperties = %{ $categories->[0]->get }; my %properties = %originalProperties; +WebGUI::Test->addToCleanup(sub { $categories->[0]->set(\%originalProperties); }); $properties{visible} = 0; $categories->[0]->set(\%properties); @@ -41,6 +42,4 @@ my @newLabels = map { $_->getLabel } @{ $newCategories }; cmp_bag(\@newLabels, \@labels, 'Setting a category to not be visible does not change its availability through getCategories, with no options'); -END { - $categories->[0]->set(\%originalProperties); -} +#vim:ft=perl