diff --git a/t/Asset.t b/t/Asset.t index 695a87bee..7f52d3626 100644 --- a/t/Asset.t +++ b/t/Asset.t @@ -306,7 +306,7 @@ my $session = WebGUI::Test->session; is $revAsset->revisedBy, $session->user->userId, 'revisedBy is current session user'; my $count = $session->db->quickScalar('SELECT COUNT(*) from assetData where assetId=?',[$testId2]); is $count, 2, 'two records in the database'; - addToCleanup($tag); + WebGUI::Test->addToCleanup($tag); $session->db->write("delete from asset where assetId like 'wg8TestAsset00000%'"); $session->db->write("delete from assetData where assetId like 'wg8TestAsset00000%'"); diff --git a/t/Asset/Asset.t b/t/Asset/Asset.t index 5b141274d..24e28d2b6 100644 --- a/t/Asset/Asset.t +++ b/t/Asset/Asset.t @@ -59,14 +59,14 @@ $testGroups{'canEdit asset'} = WebGUI::Group->new($session, 'new'); $testUsers{'canEdit group user'} = WebGUI::User->new($session, 'new'); $testUsers{'canEdit group user'}->addToGroups([$testGroups{'canEdit asset'}->getId]); $testUsers{'canEdit group user'}->username('Edit Group User'); -addToCleanup($testGroups{'canEdit asset'}); +WebGUI::Test->addToCleanup($testGroups{'canEdit asset'}); ##A group and user for groupIdEdit $testGroups{'canAdd asset'} = WebGUI::Group->new($session, 'new'); $testUsers{'canAdd group user'} = WebGUI::User->new($session, 'new'); $testUsers{'canAdd group user'}->addToGroups([$testGroups{'canAdd asset'}->getId]); $testUsers{'canEdit group user'}->username('Can Add Group User'); -addToCleanup($testGroups{'canAdd asset'}, values %testUsers); +WebGUI::Test->addToCleanup($testGroups{'canAdd asset'}, values %testUsers); my $canAddMaker = WebGUI::Test::Maker::Permission->new(); $canAddMaker->prepare({ @@ -99,7 +99,7 @@ $properties = { }; my $canEditAsset = $rootAsset->addChild($properties, $properties->{id}); -addToCleanup( $canEditAsset ); +WebGUI::Test->addToCleanup( $canEditAsset ); $properties = {}; ##Clear out the hash so that it doesn't leak later by accident. my $canEditMaker = WebGUI::Test::Maker::Permission->new(); @@ -123,7 +123,7 @@ $properties = { my $canViewAsset = $rootAsset->addChild($properties, $properties->{id}); -addToCleanup( $canViewAsset ); +WebGUI::Test->addToCleanup( $canViewAsset ); $properties = {}; ##Clear out the hash so that it doesn't leak later by accident. my $canViewMaker = WebGUI::Test::Maker::Permission->new(); @@ -363,21 +363,21 @@ my $properties = { }; my $fixUrlAsset = $defaultAsset->addChild($properties, $properties->{id}); -addToCleanup( $fixUrlAsset ); +WebGUI::Test->addToCleanup( $fixUrlAsset ); # '1234567890123456789012' $properties->{id} = 'fixUrlAsset00000000013'; $properties->{url} = 'fixUrlFolderURL9'; my $fixUrlAsset2 = $defaultAsset->addChild($properties, $properties->{id}); -addToCleanup( $fixUrlAsset2 ); +WebGUI::Test->addToCleanup( $fixUrlAsset2 ); # '1234567890123456789012' $properties->{id} = 'fixUrlAsset00000000014'; $properties->{url} = 'fixUrlFolderURL00'; my $fixUrlAsset3 = $defaultAsset->addChild($properties, $properties->{id}); -addToCleanup( $fixUrlAsset3 ); +WebGUI::Test->addToCleanup( $fixUrlAsset3 ); # '1234567890123456789012' $properties->{id} = 'fixUrlAsset00000000015'; @@ -385,7 +385,7 @@ $properties->{url} = 'fixUrlFolderURL100'; my $fixUrlAsset4 = $defaultAsset->addChild($properties, $properties->{id}); is($fixUrlAsset4->get('url'), 'fixurlfolderurl100', 'asset setup correctly for 100->101 test'); -addToCleanup( $fixUrlAsset4 ); +WebGUI::Test->addToCleanup( $fixUrlAsset4 ); delete $properties->{url}; # '1234567890123456789012' @@ -393,7 +393,7 @@ $properties->{id} = 'fixUrlAsset00000000016'; $properties->{menuTitle} = 'fix url folder url autogenerated'; my $fixUrlAsset5 = $defaultAsset->addChild($properties, $properties->{id}); -addToCleanup( $fixUrlAsset5 ); +WebGUI::Test->addToCleanup( $fixUrlAsset5 ); my $properties2 = { # '1234567890123456789012' @@ -404,7 +404,7 @@ my $properties2 = { }; my $fixTitleAsset = $defaultAsset->addChild($properties2, $properties2->{id}); -addToCleanup( $fixTitleAsset ); +WebGUI::Test->addToCleanup( $fixTitleAsset ); $properties2 = { # '1234567890123456789012' @@ -415,7 +415,7 @@ $properties2 = { }; my $getTitleAsset = $defaultAsset->addChild($properties2, $properties2->{id}); -addToCleanup( $getTitleAsset ); +WebGUI::Test->addToCleanup( $getTitleAsset ); $session->setting->set('urlExtension', undef); @@ -613,9 +613,9 @@ my $node = WebGUI::Asset->getRoot($session); my $product1 = $node->addChild({ className => 'WebGUI::Asset::Sku::Product'}, undef, undef, { skipAutoCommitWorkflows => 1}); my $product2 = $node->addChild({ className => 'WebGUI::Asset::Sku::Product'}, undef, undef, { skipAutoCommitWorkflows => 1}); my $product3 = $node->addChild({ className => 'WebGUI::Asset::Sku::Product'}, undef, undef, { skipAutoCommitWorkflows => 1}); -addToCleanup($product1, $product2, $product3); +WebGUI::Test->addToCleanup($product1, $product2, $product3); my $product4 = $node->addChild({ className => 'WebGUI::Asset::Sku::Product', status => "pending"}, undef, undef, { skipAutoCommitWorkflows => 1}); -addToCleanup($product4); +WebGUI::Test->addToCleanup($product4); my $getAProduct = WebGUI::Asset::Sku::Product->getIsa($session); isa_ok($getAProduct, 'CODE'); @@ -666,7 +666,7 @@ $properties = { }; my $iufpAsset = $defaultAsset->addChild($properties, $properties->{id}); -addToCleanup( $iufpAsset ); +WebGUI::Test->addToCleanup( $iufpAsset ); $iufpAsset->commit; $properties2 = { @@ -678,7 +678,7 @@ $properties2 = { }; my $iufpAsset2 = $iufpAsset->addChild($properties2, $properties2->{id}); -addToCleanup( $iufpAsset2 ); +WebGUI::Test->addToCleanup( $iufpAsset2 ); $iufpAsset2->update( { inheritUrlFromParent => 1 } ); is $iufpAsset2->inheritUrlFromParent, 1, 'inheritUrlFromParent set'; $iufpAsset2->commit; @@ -694,7 +694,7 @@ my $properties2a = { }; my $iufpAsset2a = $iufpAsset->addChild($properties2a, $properties2a->{id}); -addToCleanup( $iufpAsset2a ); +WebGUI::Test->addToCleanup( $iufpAsset2a ); $iufpAsset2a->commit; is($iufpAsset2a->url, 'inheriturlfromparent01/inheriturlfromparent2a', '... works when created with the property'); @@ -716,7 +716,7 @@ my $properties3 = { url => 'inheriturlfromparent03', }; my $iufpAsset3 = $iufpAsset2->addChild($properties3, $properties3->{id}); -addToCleanup( $iufpAsset3 ); +WebGUI::Test->addToCleanup( $iufpAsset3 ); $iufpAsset3->commit; $iufpAsset2->update( { inheritUrlFromParent => 1 } ); $iufpAsset2->commit; @@ -741,7 +741,7 @@ my $assetToCommit = $defaultAsset->addChild({ status => "pending", tagId => $cloneTag->getId, }); -addToCleanup($cloneTag); +WebGUI::Test->addToCleanup($cloneTag); $cloneTag->commit; is($assetToCommit->get('status'), 'pending', 'cloneFromDb: local asset is still pending'); $assetToCommit = $assetToCommit->cloneFromDb; @@ -760,7 +760,7 @@ my $trashedAsset = $defaultAsset->addChild({ my $clippedAsset = $defaultAsset->addChild({ className => 'WebGUI::Asset::Snippet', title => 'Clippy', }); -addToCleanup( $trashedAsset, $clippedAsset ); +WebGUI::Test->addToCleanup( $trashedAsset, $clippedAsset ); $trashedAsset = $trashedAsset->cloneFromDb; $clippedAsset = $clippedAsset->cloneFromDb; $trashedAsset->trash; @@ -800,7 +800,7 @@ use HTML::Packer; my $asset = WebGUI::Asset->getImportNode( $session )->addChild({ className => 'WebGUI::Asset::Snippet', }); -addToCleanup( $asset ); +WebGUI::Test->addToCleanup( $asset ); my $unpacked = qq{ diff --git a/t/Asset/AssetExportHtml.t b/t/Asset/AssetExportHtml.t index e3e7771db..2d5d332c8 100644 --- a/t/Asset/AssetExportHtml.t +++ b/t/Asset/AssetExportHtml.t @@ -183,7 +183,7 @@ is(-d $accessibleDirectory, 1, "exportCheckPath creating subdirectory actually c my $versionTag = WebGUI::VersionTag->getWorking($session); $versionTag->set({name=>"Asset Export Test"}); -addToCleanup($versionTag); +WebGUI::Test->addToCleanup($versionTag); my $importNode = WebGUI::Asset->getImportNode($session); diff --git a/t/Asset/File.t b/t/Asset/File.t index 75074afe5..4f21fa465 100644 --- a/t/Asset/File.t +++ b/t/Asset/File.t @@ -109,7 +109,7 @@ cmp_deeply( #---------------------------------------------------------------------------- # Add another new revision, changing the privs my $newRev = $asset->addRevision( { ownerUserId => '3', groupIdView => '3' }, time + 5 ); -addToCleanup( $newRev ); +WebGUI::Test->addToCleanup( $newRev ); $privs = JSON->new->decode( $newRev->getStorageLocation->getFileContentsAsScalar('.wgaccess') ); cmp_deeply( $privs, @@ -123,7 +123,7 @@ cmp_deeply( # Add a new revision, changing the privs my $newRev = $asset->addRevision( { groupIdView => '7' }, time + 8 ); -addToCleanup( $newRev ); +WebGUI::Test->addToCleanup( $newRev ); is( $newRev->getStorageLocation->getFileContentsAsScalar('.wgaccess'), undef, "wgaccess doesn't exist" ); #---------------------------------------------------------------------------- @@ -144,7 +144,7 @@ $asset->update({ filename => $filename, }); -addToCleanup( $asset ); +WebGUI::Test->addToCleanup( $asset ); $asset->trash; my $storage = $asset->getStorageLocation; my $dir = $storage->getPathClassDir(); diff --git a/t/Asset/File/GalleryFile/Photo/adjustOrientation.t b/t/Asset/File/GalleryFile/Photo/adjustOrientation.t index 302cb2596..3d8916d72 100644 --- a/t/Asset/File/GalleryFile/Photo/adjustOrientation.t +++ b/t/Asset/File/GalleryFile/Photo/adjustOrientation.t @@ -32,7 +32,7 @@ my $versionTag = WebGUI::VersionTag->getWorking($session); # Name version tag and make sure it gets cleaned up $versionTag->set({name=>"Orientation adjustment test"}); my %tag = ( tagId => $versionTag->getId, status => "pending" ); -addToCleanup($versionTag); +WebGUI::Test->addToCleanup($versionTag); # Create gallery and a single album my $gallery diff --git a/t/Asset/File/GalleryFile/Photo/edit.t b/t/Asset/File/GalleryFile/Photo/edit.t index 4f7e9909d..1330c84d5 100644 --- a/t/Asset/File/GalleryFile/Photo/edit.t +++ b/t/Asset/File/GalleryFile/Photo/edit.t @@ -34,7 +34,7 @@ my $node = WebGUI::Asset->getImportNode( $session ); # Create version tag and make sure it gets cleaned up my $versionTag = WebGUI::VersionTag->getWorking($session); -addToCleanup($versionTag); +WebGUI::Test->addToCleanup($versionTag); # Override some settings to make things easier to test # userFunctionStyleId diff --git a/t/Asset/File/Image.t b/t/Asset/File/Image.t index c0806011f..efbf2735f 100644 --- a/t/Asset/File/Image.t +++ b/t/Asset/File/Image.t @@ -40,7 +40,7 @@ $rectangle->setBackgroundColor('#0000FF'); ##Create a storage location my $storage = WebGUI::Storage->create($session); -addToCleanup($storage); +WebGUI::Test->addToCleanup($storage); ##Save the image to the location $rectangle->saveToStorageLocation($storage, 'blue.png'); diff --git a/t/Asset/Post/Thread.t b/t/Asset/Post/Thread.t index 7ee440292..3a37f52b1 100644 --- a/t/Asset/Post/Thread.t +++ b/t/Asset/Post/Thread.t @@ -25,7 +25,7 @@ my $node = WebGUI::Asset->getImportNode($session); # Grab a named version tag my $versionTag = WebGUI::VersionTag->getWorking($session); $versionTag->set({name=>"Collab setup"}); -addToCleanup($versionTag); +WebGUI::Test->addToCleanup($versionTag); # Need to create a Collaboration system in which the post lives. my @addArgs = ( undef, undef, { skipNotification => 1 } ); @@ -78,7 +78,7 @@ note 'getCSLinkUrl'; my @newThreads; my $threadCount = 15; my $versionTag2 = WebGUI::VersionTag->getWorking($session); -addToCleanup( $versionTag2 ); +WebGUI::Test->addToCleanup( $versionTag2 ); $props->{tagId} = $versionTag2->getId; while ($threadCount--) { push @newThreads, $collab->addChild($props, @addArgs); diff --git a/t/Asset/Snippet.t b/t/Asset/Snippet.t index f793681b9..d3060120a 100644 --- a/t/Asset/Snippet.t +++ b/t/Asset/Snippet.t @@ -23,7 +23,7 @@ my $node = WebGUI::Asset->getImportNode($session); my $versionTag = WebGUI::VersionTag->getWorking($session); $versionTag->set({name=>"Snippet Test"}); my %tag = ( tagId => $versionTag->getId, status => "pending" ); -addToCleanup($versionTag); +WebGUI::Test->addToCleanup($versionTag); my $snippet = $node->addChild({className=>'WebGUI::Asset::Snippet', %tag}); # Make sure TemplateToolkit is in the config file @@ -103,7 +103,7 @@ $tag{tagId} = $tag2->getId; my $snippet2 = $node->addChild({className => 'WebGUI::Asset::Snippet', %tag}); $snippet2->update({mimeType => 'text/javascript'}); $tag2->commit; -addToCleanup($tag2); +WebGUI::Test->addToCleanup($tag2); $snippet2->snippet('uncompressable'); is $snippet2->snippetPacked, 'uncompressable', 'packed snippet content was set'; diff --git a/t/Asset/Template.t b/t/Asset/Template.t index fda7b76ca..de817de53 100644 --- a/t/Asset/Template.t +++ b/t/Asset/Template.t @@ -23,7 +23,7 @@ use JSON qw{ from_json }; my $session = WebGUI::Test->session; my $tag = WebGUI::VersionTag->getWorking($session); -addToCleanup( $tag ); +WebGUI::Test->addToCleanup( $tag ); my %tag = ( tagId => $tag->getId, status => "pending" ); my $default = $session->config->get('defaultTemplateParser'); my $ht = 'WebGUI::Asset::Template::HTMLTemplate'; diff --git a/t/Asset/WikiPage/permissions.t b/t/Asset/WikiPage/permissions.t index 09b6c6af3..46a535588 100644 --- a/t/Asset/WikiPage/permissions.t +++ b/t/Asset/WikiPage/permissions.t @@ -24,12 +24,12 @@ my $node = WebGUI::Asset->getImportNode($session); my $versionTag = WebGUI::VersionTag->getWorking($session); $versionTag->set({name=>"Wiki Test"}); my %tag = ( tagId => $versionTag->getId, status => "pending" ); -addToCleanup($versionTag); +WebGUI::Test->addToCleanup($versionTag); my $assetEdit = WebGUI::Group->new($session, "new"); my $wikiAdmin = WebGUI::Group->new($session, "new"); my $wikiEditPage = WebGUI::Group->new($session, "new"); -addToCleanup($assetEdit, $wikiAdmin, $wikiEditPage); +WebGUI::Test->addToCleanup($assetEdit, $wikiAdmin, $wikiEditPage); my $assetEditor = WebGUI::User->create($session); $assetEdit->addUsers([$assetEditor->userId]); @@ -39,7 +39,7 @@ my $wikiPageEditor = WebGUI::User->create($session); $wikiEditPage->addUsers([$wikiPageEditor->userId]); my $wikiOwner = WebGUI::User->create($session); my $wikiPageOwner = WebGUI::User->create($session); -addToCleanup($assetEditor, $wikiAdministrator, $wikiPageEditor, $wikiOwner, $wikiPageOwner); +WebGUI::Test->addToCleanup($assetEditor, $wikiAdministrator, $wikiPageEditor, $wikiOwner, $wikiPageOwner); $session->user({user => $wikiOwner}); my $wiki = $node->addChild({ @@ -57,7 +57,7 @@ my $wikipage = $wiki->addChild({ }, undef, undef, {skipAutoCommitWorkflows => 1, skipNotification => 1}); is $wikipage->get('ownerUserId'), $wikiPageOwner->userId, 'wiki page owned by correct user'; -addToCleanup($wikipage); +WebGUI::Test->addToCleanup($wikipage); # Test for sane object types isa_ok($wiki, 'WebGUI::Asset::Wobject::WikiMaster'); diff --git a/t/Asset/Wobject/Calendar.t b/t/Asset/Wobject/Calendar.t index b57ae35b1..a77b12007 100644 --- a/t/Asset/Wobject/Calendar.t +++ b/t/Asset/Wobject/Calendar.t @@ -310,7 +310,7 @@ my $coincidentHigh = $windowCal->addChild({ # Everything above the window should be included in the set of events returned. $tag2->commit; -addToCleanup($tag2); +WebGUI::Test->addToCleanup($tag2); is(scalar @{ $windowCal->getLineage(['children'])}, 17, 'added events to the window calendar'); @@ -556,7 +556,7 @@ my $prevDay = $listCal->addChild({ my $tag6 = WebGUI::VersionTag->getWorking($session); $tag6->commit; -addToCleanup($tag6); +WebGUI::Test->addToCleanup($tag6); my $listVars = $listCal->viewList({ start => $bday }); diff --git a/t/Asset/Wobject/Collaboration.t b/t/Asset/Wobject/Collaboration.t index 147ba35db..c5aea4af3 100644 --- a/t/Asset/Wobject/Collaboration.t +++ b/t/Asset/Wobject/Collaboration.t @@ -32,7 +32,7 @@ my $node = WebGUI::Test->asset; # grab a named version tag my $versionTag = WebGUI::VersionTag->getWorking($session); -addToCleanup($versionTag); +WebGUI::Test->addToCleanup($versionTag); $versionTag->set({name => 'Collaboration => groupToEditPost test'}); my %tag = ( tagId => $versionTag->getId, status => "pending" ); @@ -74,7 +74,7 @@ my $props = { my $thread = $collab->addChild($props, @addChildCoda); $thread->setSkipNotification; $tag1->commit; -addToCleanup($tag1); +WebGUI::Test->addToCleanup($tag1); # Test for a sane object type isa_ok($thread, 'WebGUI::Asset::Post::Thread'); @@ -89,7 +89,7 @@ $props = { my $thread2 = $collab->addChild($props, @addChildCoda); $thread2->setSkipNotification; $tag2->commit; -addToCleanup($tag2); +WebGUI::Test->addToCleanup($tag2); my $rssitems = $collab->getRssFeedItems(); is(scalar @{ $rssitems }, 2, 'rssitems set to number of posts added'); diff --git a/t/Asset/Wobject/Collaboration/templateVariables.t b/t/Asset/Wobject/Collaboration/templateVariables.t index 999f1b431..63d47decb 100644 --- a/t/Asset/Wobject/Collaboration/templateVariables.t +++ b/t/Asset/Wobject/Collaboration/templateVariables.t @@ -110,7 +110,7 @@ foreach my $index (1 .. 5) { $newThreads[$index]->setSkipNotification; } $vt2->commit; -addToCleanup($vt2); +WebGUI::Test->addToCleanup($vt2); $session->user({userId => 3}); $templateVars = $collab->getViewTemplateVars(); diff --git a/t/Asset/Wobject/Gallery/search.t b/t/Asset/Wobject/Gallery/search.t index fb7b07c00..bfb9ced7a 100644 --- a/t/Asset/Wobject/Gallery/search.t +++ b/t/Asset/Wobject/Gallery/search.t @@ -33,7 +33,7 @@ my $versionTag = WebGUI::VersionTag->getWorking($session); $versionTag->set( { name=>"Gallery Search Test" } ); my %tag = ( tagId => $versionTag->getId, status => "pending" ); -addToCleanup( $versionTag ); +WebGUI::Test->addToCleanup( $versionTag ); # Create gallery and a single album my $gallery diff --git a/t/Asset/Wobject/GalleryAlbum/addArchive.t b/t/Asset/Wobject/GalleryAlbum/addArchive.t index 7740dac2a..16dde61f6 100644 --- a/t/Asset/Wobject/GalleryAlbum/addArchive.t +++ b/t/Asset/Wobject/GalleryAlbum/addArchive.t @@ -25,7 +25,7 @@ my $node = WebGUI::Asset->getImportNode($session); my $versionTag = WebGUI::VersionTag->getWorking($session); my %tag = ( tagId => $versionTag->getId, status => "pending" ); $versionTag->set({name=>"Add Archive to Album Test"}); -addToCleanup($versionTag); +WebGUI::Test->addToCleanup($versionTag); my $gallery = $node->addChild({ diff --git a/t/Asset/Wobject/StoryArchive.t b/t/Asset/Wobject/StoryArchive.t index 8b14a37da..69c5fb40d 100644 --- a/t/Asset/Wobject/StoryArchive.t +++ b/t/Asset/Wobject/StoryArchive.t @@ -134,7 +134,7 @@ is($todayFolder->get('styleTemplateId'), $archive->get('styleTemplateId'), '... className => 'WebGUI::Asset::Wobject::StoryArchive', title => 'Extension Tester', }); - addToCleanup($arch2); + WebGUI::Test->addToCleanup($arch2); is $arch2->get('url'), $home->get('url').'/extension-tester.ext', diff --git a/t/AssetHelper/Copy.t b/t/AssetHelper/Copy.t index f2764a310..cf4091a77 100644 --- a/t/AssetHelper/Copy.t +++ b/t/AssetHelper/Copy.t @@ -54,7 +54,7 @@ my $root = WebGUI::Asset->getRoot($session); 'AssetHelper/Copy forks a process' ); - addToCleanup( 'WebGUI::Fork' => $output->{forkId} ); + WebGUI::Test->addToCleanup( 'WebGUI::Fork' => $output->{forkId} ); } ok(WebGUI::Test->waitForAllForks(10), "Forks finished"); @@ -62,6 +62,6 @@ ok(WebGUI::Test->waitForAllForks(10), "Forks finished"); $session->cache->clear; my $clippies = $root->getLineage(["descendants"], {statesToInclude => [qw{clipboard clipboard-limbo}], returnObjects => 1,}); is @{ $clippies }, 1, '... only copied 1 asset to the clipboard, no children'; -addToCleanup(@{ $clippies }); +WebGUI::Test->addToCleanup(@{ $clippies }); #vim:ft=perl diff --git a/t/AssetHelper/CopyBranch.t b/t/AssetHelper/CopyBranch.t index ad6ab4f32..f7450323d 100644 --- a/t/AssetHelper/CopyBranch.t +++ b/t/AssetHelper/CopyBranch.t @@ -56,7 +56,7 @@ my $grand = $child->addChild({ %tag, }); $tag->commit; -addToCleanup( $tag ); +WebGUI::Test->addToCleanup( $tag ); { my $helper = WebGUI::AssetHelper::CopyBranch->new( id => 'copy_branch', session => $session, asset => $top ); @@ -88,6 +88,6 @@ $mech->get_ok( '/?op=assetHelper;helperId=copy_branch;method=copy;with=descendan WebGUI::Test->waitForAllForks; my $clippies = $root->getLineage(["descendants"], {statesToInclude => [qw{clipboard clipboard-limbo}], returnObjects => 1,}); is @{ $clippies }, 3, '... copied 3 asset to the clipboard'; -addToCleanup( @$clippies ); +WebGUI::Test->addToCleanup( @$clippies ); #vim:ft=perl diff --git a/t/AssetHelper/Lock.t b/t/AssetHelper/Lock.t index 16f4583ce..289f4412e 100644 --- a/t/AssetHelper/Lock.t +++ b/t/AssetHelper/Lock.t @@ -33,7 +33,7 @@ my $home = WebGUI::Test->asset; my $editor = WebGUI::User->create($session); $editor->addToGroups([4]); -addToCleanup($editor); +WebGUI::Test->addToCleanup($editor); $session->user({userId => 3}); my $newPage = $home->addChild({ diff --git a/t/AssetHelper/Product/ExportCSV.t b/t/AssetHelper/Product/ExportCSV.t index 9ae6cee07..5d73a94ad 100644 --- a/t/AssetHelper/Product/ExportCSV.t +++ b/t/AssetHelper/Product/ExportCSV.t @@ -85,7 +85,7 @@ my $helper = WebGUI::AssetHelper::Product::ExportCSV->new( ); my $exportProducts = \&WebGUI::AssetHelper::Product::ExportCSV::exportProducts; my $process = Test::MockObject::Extends->new( WebGUI::Fork->create( $session ) ); -addToCleanup( sub { $process->delete } ); +WebGUI::Test->addToCleanup( sub { $process->delete } ); $exportProducts->($process, {}); # Determine the storage location from the URL diff --git a/t/Auth/LDAP.t b/t/Auth/LDAP.t index f07dc69ae..0c1978a50 100644 --- a/t/Auth/LDAP.t +++ b/t/Auth/LDAP.t @@ -29,7 +29,7 @@ my $ldapProps = WebGUI::Test->getSmokeLDAPProps(); $session->db->setRow("ldapLink","ldapLinkId",$ldapProps, $ldapProps->{ldapLinkId}); my $ldapLink = WebGUI::LDAPLink->new( $session, $ldapProps->{ldapLinkId} ); -addToCleanup($ldapLink); +WebGUI::Test->addToCleanup($ldapLink); my $ldap = $ldapLink->bind; $session->setting->set('ldapConnection', $ldapProps->{ldapLinkId} ); @@ -39,7 +39,7 @@ $ldapGroup->set( "ldapLinkId", $ldapProps->{ldapLinkId} ); $ldapGroup->set( "ldapGroup", "cn=Convicts,o=shawshank" ); $ldapGroup->set( "ldapGroupProperty", "member" ); $ldapGroup->set( "ldapRecursiveProperty", "uid" ); -addToCleanup($ldapGroup); +WebGUI::Test->addToCleanup($ldapGroup); #---------------------------------------------------------------------------- # Tests diff --git a/t/Auth/WebGUI.t b/t/Auth/WebGUI.t index 335f7fabd..ccf21ecb9 100644 --- a/t/Auth/WebGUI.t +++ b/t/Auth/WebGUI.t @@ -28,7 +28,7 @@ use WebGUI::Auth::WebGUI; my $session = WebGUI::Test->session; my $user = WebGUI::User->create( $session ); -addToCleanup( $user ); +WebGUI::Test->addToCleanup( $user ); #---------------------------------------------------------------------------- # Test instance diff --git a/t/DatabaseLink.t b/t/DatabaseLink.t index 02429e4a8..a6a21f36c 100644 --- a/t/DatabaseLink.t +++ b/t/DatabaseLink.t @@ -209,7 +209,7 @@ my $dbLinkParams = { }; $dbLink = WebGUI::DatabaseLink->create($session, $dbLinkParams); -addToCleanup($dbLink); +WebGUI::Test->addToCleanup($dbLink); $dbLinkParams->{databaseLinkId} = ignore(); cmp_deeply( diff --git a/t/DateTime.t b/t/DateTime.t index ee824df12..098d69e43 100644 --- a/t/DateTime.t +++ b/t/DateTime.t @@ -107,6 +107,6 @@ sub addUser { ##so the test will not fail in the summer $user->profileField("timeZone","America/Hermosillo"); $user->username("Time Zone"); - addToCleanup($user); + WebGUI::Test->addToCleanup($user); return $user; } diff --git a/t/Group.t b/t/Group.t index 8ce3b3b5a..913d7ccbf 100644 --- a/t/Group.t +++ b/t/Group.t @@ -832,7 +832,7 @@ ok(! WebGUI::Group->vitalGroup('27'), '... 27 is not vital'); # Normal group my $happyDude = WebGUI::User->create( $session ); $happyDude->username(" Happy Dude "); -addToCleanup( $happyDude ); +WebGUI::Test->addToCleanup( $happyDude ); $gA->addUsers([ $happyDude->getId ]); $gB->addUsers([ $happyDude->getId ]); diff --git a/t/LDAPLink.t b/t/LDAPLink.t index b9b8af722..559da41f3 100644 --- a/t/LDAPLink.t +++ b/t/LDAPLink.t @@ -39,7 +39,7 @@ plan tests => 9; # Increment this number for each test you create { my $ldap = WebGUI::LDAPLink->new($session, "new"); - addToCleanup($ldap); + WebGUI::Test->addToCleanup($ldap); isa_ok($ldap, 'WebGUI::LDAPLink'); is $ldap->{_ldapLinkId}, "new", '... created with correct linkId'; } @@ -54,7 +54,7 @@ plan tests => 9; # Increment this number for each test you create my $ldapProps = WebGUI::Test->getSmokeLDAPProps(); $session->db->setRow('ldapLink', 'ldapLinkId', $ldapProps, $ldapProps->{ldapLinkId}); my $ldap = WebGUI::LDAPLink->new($session, $ldapProps->{ldapLinkId}); - addToCleanup($ldap); + WebGUI::Test->addToCleanup($ldap); cmp_deeply $ldap->get(), superhashof($ldapProps), 'all db properties retrieved'; my $connection = $ldap->bind(); isa_ok $connection, 'Net::LDAP', 'returned by bind'; @@ -73,7 +73,7 @@ plan tests => 9; # Increment this number for each test you create $ldapProps->{identifier} = 'hadley'; $session->db->setRow('ldapLink', 'ldapLinkId', $ldapProps, $ldapProps->{ldapLinkId}); my $ldap = WebGUI::LDAPLink->new($session, $ldapProps->{ldapLinkId}); - addToCleanup($ldap); + WebGUI::Test->addToCleanup($ldap); my $connection = $ldap->bind(); isa_ok $connection, 'Net::LDAP', 'returned by bind'; is $ldap->{_error}, 104, 'auth error due to bad identifier'; diff --git a/t/Macro/CanEditText.t b/t/Macro/CanEditText.t index 6814e6bda..64e8b7744 100644 --- a/t/Macro/CanEditText.t +++ b/t/Macro/CanEditText.t @@ -98,6 +98,6 @@ sub setupTest { $users[1]->addToGroups([$cm->getId]); ##User 2 is a member of a content manager sub-group $users[2]->addToGroups([$editGroup->getId]); - addToCleanup($editGroup, @users); + WebGUI::Test->addToCleanup($editGroup, @users); return ($asset, $editGroup, @users); } diff --git a/t/Macro/GroupAdd.t b/t/Macro/GroupAdd.t index 7c34fbd25..7c3cb7dba 100644 --- a/t/Macro/GroupAdd.t +++ b/t/Macro/GroupAdd.t @@ -145,13 +145,13 @@ sub setupTest { $groups[1] = WebGUI::Group->new($session, "new"); $groups[1]->name('Regular Old Group'); $groups[1]->autoAdd(0); - addToCleanup(@groups); + WebGUI::Test->addToCleanup(@groups); ##Three users. One in each group and one with no group membership my @users = map { WebGUI::User->new($session, "new") } 0..2; $users[0]->addToGroups([$groups[0]->getId]); $users[1]->addToGroups([$groups[1]->getId]); - addToCleanup(@users); + WebGUI::Test->addToCleanup(@users); my $properties = { title => 'GroupAdd test template', diff --git a/t/Macro/GroupDelete.t b/t/Macro/GroupDelete.t index 23083aa54..6e6bc3032 100644 --- a/t/Macro/GroupDelete.t +++ b/t/Macro/GroupDelete.t @@ -144,13 +144,13 @@ sub setupTest { $groups[1] = WebGUI::Group->new($session, "new"); $groups[1]->name('Regular Old Group'); $groups[1]->autoDelete(0); - addToCleanup(@groups); + WebGUI::Test->addToCleanup(@groups); ##Three users. One in each group and one with no group membership my @users = map { WebGUI::User->new($session, "new") } 0..2; $users[0]->addToGroups([$groups[0]->getId]); $users[1]->addToGroups([$groups[1]->getId]); - addToCleanup(@users); + WebGUI::Test->addToCleanup(@users); my $properties = { title => 'GroupDelete test template', diff --git a/t/Macro/GroupText.t b/t/Macro/GroupText.t index 02ecdf0a6..f2a1b1b16 100644 --- a/t/Macro/GroupText.t +++ b/t/Macro/GroupText.t @@ -57,14 +57,14 @@ my $sth = $session->db->prepare('INSERT INTO myUserTable VALUES(?)'); foreach my $mob (@mob) { $sth->execute([ $mob->userId ]); } -addToCleanup(@mob); +WebGUI::Test->addToCleanup(@mob); ##Create the 3 groups $ms_users = WebGUI::Group->new($session, "new"); $ms_distributors = WebGUI::Group->new($session, "new"); $ms_int_distributors = WebGUI::Group->new($session, "new"); -addToCleanup($ms_users, $ms_distributors, $ms_int_distributors); +WebGUI::Test->addToCleanup($ms_users, $ms_distributors, $ms_int_distributors); $ms_users->name('MS Users'); $ms_distributors->name('MS Distributors'); @@ -86,7 +86,7 @@ $ms_distributors->addGroups([$ms_int_distributors->getId]); $disti = WebGUI::User->new($session, 'new'); $int_disti = WebGUI::User->new($session, 'new'); -addToCleanup($disti, $int_disti); +WebGUI::Test->addToCleanup($disti, $int_disti); $ms_distributors->addUsers([$disti->userId]); $ms_int_distributors->addUsers([$int_disti->userId]); diff --git a/t/Macro/MiniCart.t b/t/Macro/MiniCart.t index b8f8effb3..40d020a35 100644 --- a/t/Macro/MiniCart.t +++ b/t/Macro/MiniCart.t @@ -33,7 +33,7 @@ my $donation = WebGUI::Asset->getRoot($session)->addChild({ }); my $template = setupJSONtemplate($session); -addToCleanup($cart, $donation, $template); +WebGUI::Test->addToCleanup($cart, $donation, $template); my $json; my $templateVars; diff --git a/t/Macro/NewMail.t b/t/Macro/NewMail.t index 08a29023f..2b2579709 100644 --- a/t/Macro/NewMail.t +++ b/t/Macro/NewMail.t @@ -25,7 +25,7 @@ plan tests => $numTests; my $inboxUser = WebGUI::User->create($session); $session->user({userId => $inboxUser->getId}); -addToCleanup($inboxUser); +WebGUI::Test->addToCleanup($inboxUser); my $inbox = WebGUI::Inbox->new($session); diff --git a/t/Macro/RootTitle.t b/t/Macro/RootTitle.t index 2d1b37b75..227066f22 100644 --- a/t/Macro/RootTitle.t +++ b/t/Macro/RootTitle.t @@ -31,7 +31,7 @@ my $session = WebGUI::Test->session; my $versionTag = WebGUI::VersionTag->getWorking($session); $versionTag->set({name=>"Adding assets for RootTitle tests"}); my %tag = ( tagId => $versionTag->getId, status => "pending" ); -addToCleanup($versionTag); +WebGUI::Test->addToCleanup($versionTag); my $root = WebGUI::Asset->getRoot($session); my %properties_A = ( diff --git a/t/Macro/SQL.t b/t/Macro/SQL.t index 43080cec3..8addcc4e7 100644 --- a/t/Macro/SQL.t +++ b/t/Macro/SQL.t @@ -144,7 +144,7 @@ foreach my $testSet (@testSets) { $WebGUIdbLink->set({allowMacroAccess=>$originalMacroAccessValue}); my $newLinkId = $WebGUIdbLink->copy; -addToCleanup(WebGUI::DatabaseLink->new($session, $newLinkId)); +WebGUI::Test->addToCleanup(WebGUI::DatabaseLink->new($session, $newLinkId)); my $output = WebGUI::Macro::SQL::process( $session, q{show columns from testTable like 'zero'}, diff --git a/t/Macro/UsersOnline.t b/t/Macro/UsersOnline.t index eb7b9d45d..e8e40c614 100644 --- a/t/Macro/UsersOnline.t +++ b/t/Macro/UsersOnline.t @@ -178,7 +178,7 @@ sub setupUsers { my $newSession = WebGUI::Session->open(WebGUI::Test::file); $newSession->user({user => $_}); } - addToCleanup(@users); + WebGUI::Test->addToCleanup(@users); return @users; } @@ -232,6 +232,6 @@ sub setupJSONtemplate { } EOTMPL my $template = WebGUI::Asset->getImportNode($session)->addChild({className=>'WebGUI::Asset::Template', parser => 'WebGUI::Asset::Template::HTMLTemplate', namespace => 'Macro/UsersOnline', template=>$templateBody}); - addToCleanup($template); + WebGUI::Test->addToCleanup($template); return $template; } diff --git a/t/SQL.t b/t/SQL.t index 7746e7111..90ac3e7bf 100644 --- a/t/SQL.t +++ b/t/SQL.t @@ -173,7 +173,7 @@ SKIP: { skip("No InnoDB tables in this MySQL. Skipping all transaction related tests.",7) if (lc $mysqlVariables{have_innodb} ne 'yes'); $session->db->dbh->do('DROP TABLE IF EXISTS testTable'); $session->db->dbh->do('CREATE TABLE testTable (myIndex int(8) NOT NULL default 0, message CHAR(64), PRIMARY KEY(myIndex)) TYPE=InnoDB'); - addToCleanup( SQL => 'DROP TABLE testTable' ); + WebGUI::Test->addToCleanup( SQL => 'DROP TABLE testTable' ); my $dbh2 = WebGUI::SQL->connect($session->config->get("dsn"), $session->config->get("dbuser"), $session->config->get("dbpass")); my ($sth, $sth2, $rc); diff --git a/t/Shop/ShipDriver/UPS.t b/t/Shop/ShipDriver/UPS.t index 948845f83..17382e8e4 100644 --- a/t/Shop/ShipDriver/UPS.t +++ b/t/Shop/ShipDriver/UPS.t @@ -155,7 +155,7 @@ $driver = WebGUI::Shop::ShipDriver::UPS->new($session, { enabled => 1, shipType => 'PARCEL', }); -addToCleanup($driver); +WebGUI::Test->addToCleanup($driver); eval { $driver->calculate() }; $e = Exception::Class->caught(); @@ -218,7 +218,7 @@ cmp_deeply( ); my $cart = WebGUI::Shop::Cart->newBySession($session); -addToCleanup($cart); +WebGUI::Test->addToCleanup($cart); my $addressBook = $cart->getAddressBook; my $workAddress = $addressBook->addAddress({ label => 'work', diff --git a/t/Shop/ShipDriver/USPS.t b/t/Shop/ShipDriver/USPS.t index b00674601..21dae8e03 100644 --- a/t/Shop/ShipDriver/USPS.t +++ b/t/Shop/ShipDriver/USPS.t @@ -115,7 +115,7 @@ my $options = { }; $driver2 = WebGUI::Shop::ShipDriver::USPS->new($session, $options); -addToCleanup($driver2); +WebGUI::Test->addToCleanup($driver2); isa_ok($driver2, 'WebGUI::Shop::ShipDriver::USPS'); isa_ok($driver2, 'WebGUI::Shop::ShipDriver'); @@ -153,7 +153,7 @@ my $driver = WebGUI::Shop::ShipDriver::USPS->new($session, { enabled => 1, shipType => 'PARCEL', }); -addToCleanup($driver); +WebGUI::Test->addToCleanup($driver); my $e; eval { $driver->calculate() }; @@ -183,7 +183,7 @@ cmp_deeply( ); $cart = WebGUI::Shop::Cart->newBySession($session); -addToCleanup($cart); +WebGUI::Test->addToCleanup($cart); my $addressBook = $cart->getAddressBook; my $workAddress = $addressBook->addAddress({ label => 'work', diff --git a/t/Shop/ShipDriver/USPSInternational.t b/t/Shop/ShipDriver/USPSInternational.t index da76ca145..0375bc73e 100644 --- a/t/Shop/ShipDriver/USPSInternational.t +++ b/t/Shop/ShipDriver/USPSInternational.t @@ -115,7 +115,7 @@ my $options = { }; $driver2 = WebGUI::Shop::ShipDriver::USPSInternational->new($session, $options); -addToCleanup($driver2); +WebGUI::Test->addToCleanup($driver2); isa_ok($driver2, 'WebGUI::Shop::ShipDriver::USPSInternational'); isa_ok($driver2, 'WebGUI::Shop::ShipDriver'); @@ -152,7 +152,7 @@ my $driver = WebGUI::Shop::ShipDriver::USPSInternational->new($session, { label => 'Shipping from Shawshank', enabled => 1, }); -addToCleanup($driver); +WebGUI::Test->addToCleanup($driver); my $e; eval { $driver->calculate() }; @@ -167,7 +167,7 @@ cmp_deeply( ); $cart = WebGUI::Shop::Cart->newBySession($session); -addToCleanup($cart); +WebGUI::Test->addToCleanup($cart); my $addressBook = $cart->getAddressBook; my $workAddress = $addressBook->addAddress({ label => 'work', diff --git a/t/Shop/Transaction.t b/t/Shop/Transaction.t index 0150c9ec6..f6427e749 100644 --- a/t/Shop/Transaction.t +++ b/t/Shop/Transaction.t @@ -68,7 +68,7 @@ my $transaction = WebGUI::Shop::Transaction->new($session,{ paymentDriverLabel => 'kkk', taxes => 7, }); -addToCleanup($transaction); +WebGUI::Test->addToCleanup($transaction); # objects work isa_ok($transaction, "WebGUI::Shop::Transaction"); @@ -243,13 +243,13 @@ my $shopGroup = WebGUI::Group->new($session, 'new'); my $shopAdmin = WebGUI::User->create($session); $shopUser->username('shopAdmin'); $shopGroup->addUsers([$shopAdmin->getId]); -addToCleanup($shopUser, $shopAdmin, $shopGroup); +WebGUI::Test->addToCleanup($shopUser, $shopAdmin, $shopGroup); $session->setting->set('shopSaleNotificationGroupId', $shopGroup->getId); $session->user({userId => $shopUser->getId}); my $trans = WebGUI::Shop::Transaction->new($session, {}); ok($trans->can('sendNotifications'), 'sendNotifications: valid method for transactions'); -addToCleanup($trans); +WebGUI::Test->addToCleanup($trans); ##Disable sending email my $sendmock = Test::MockObject->new( {} ); diff --git a/t/Template/downgrade.t b/t/Template/downgrade.t index 77979fedf..a7091ad95 100644 --- a/t/Template/downgrade.t +++ b/t/Template/downgrade.t @@ -75,7 +75,7 @@ sub processed_ok { template => $template, } ); - addToCleanup($tmpl); + WebGUI::Test->addToCleanup($tmpl); is( $tmpl->process( { his => { yes => 'yes', stop => 'stop' }, my => { yes => 'no', stop => 'go' } diff --git a/t/Upgrade.t b/t/Upgrade.t index 4d4235354..6541d65a3 100644 --- a/t/Upgrade.t +++ b/t/Upgrade.t @@ -162,7 +162,7 @@ END_PM isa_ok $package, 'WebGUI::Asset::Template'; my $vtId = $package->get('tagId'); my $vt = WebGUI::VersionTag->new($session, $vtId); - addToCleanup($vt); + WebGUI::Test->addToCleanup($vt); is $vt->get('name'), 'Upgrade to 8.3.0 - test-template', 'package import names version tag correctly'; } diff --git a/t/VersionTag.t b/t/VersionTag.t index fe620200a..e12e17dd7 100644 --- a/t/VersionTag.t +++ b/t/VersionTag.t @@ -384,7 +384,7 @@ $siteWideTag->rollback(); # create admin session $admin_session = WebGUI::Test->newSession; WebGUI::Test->addToCleanup($admin_session); - addToCleanup($admin_session); + WebGUI::Test->addToCleanup($admin_session); $admin_session->user({'userId' => 3}); setUserVersionTagMode($admin_session->user(), q{autoCommit}); @@ -436,10 +436,10 @@ my $redSession = WebGUI::Test->newSession(); my $andy = WebGUI::User->create($andySession); my $red = WebGUI::User->create($redSession); -addToCleanup($andy, $red); +WebGUI::Test->addToCleanup($andy, $red); my $andyTag = WebGUI::VersionTag->getWorking($andySession); -addToCleanup($andyTag); +WebGUI::Test->addToCleanup($andyTag); my $redTag = WebGUI::VersionTag->new($redSession, $andyTag->getId); $redTag->setWorking(); is($andyTag->getId, $redTag->getId, 'users share the same version tag'); @@ -459,7 +459,7 @@ $andyTag2->clearWorking; my $andyTagCheck = WebGUI::VersionTag->getWorking($andySession, 'nocreate'); is($andyTagCheck, undef, 'clearWorking: user andy does not have tag'); my $redSession2 = $redSession->duplicate; - addToCleanup($redSession2); + WebGUI::Test->addToCleanup($redSession2); my $redTagCheck = WebGUI::VersionTag->getWorking($redSession2, 'nocreate'); is($redTagCheck, undef, 'red does not either'); } diff --git a/t/Workflow/Activity/NotifyAboutLowStock.t b/t/Workflow/Activity/NotifyAboutLowStock.t index 5278642a0..bdf4f443f 100644 --- a/t/Workflow/Activity/NotifyAboutLowStock.t +++ b/t/Workflow/Activity/NotifyAboutLowStock.t @@ -75,7 +75,7 @@ my $workflow = WebGUI::Workflow->create($session, mode => 'realtime', }, ); -addToCleanup($workflow); +WebGUI::Test->addToCleanup($workflow); my $threshold = $workflow->addActivity('WebGUI::Workflow::Activity::NotifyAboutLowStock'); $threshold->set('className' , 'WebGUI::Activity::NotifyAboutLowStock'); @@ -166,7 +166,7 @@ my $movieVarId = $movie_posters->setCollateral('variantsJSON', 'variantId', 'new }, ); my $otherTag = WebGUI::VersionTag->getWorking($session); -addToCleanup($otherTag); +WebGUI::Test->addToCleanup($otherTag); $otherTag->commit; $threshold->set('warningLimit' , 10); diff --git a/t/Workflow/Activity/RecheckVATNumber.t b/t/Workflow/Activity/RecheckVATNumber.t index 054085ca1..2bd71397e 100644 --- a/t/Workflow/Activity/RecheckVATNumber.t +++ b/t/Workflow/Activity/RecheckVATNumber.t @@ -46,7 +46,7 @@ plan tests => 9; # Increment this number for each test you create my $number = 'NL34567890'; my $user = WebGUI::User->new( $session, 'new' ); my $userId = $user->userId; - addToCleanup( $user ); + WebGUI::Test->addToCleanup( $user ); # --- valid number ---------------- $return = 'VALID'; @@ -94,7 +94,7 @@ sub createInstance { } ); my $activity = $workflow->addActivity( 'WebGUI::Workflow::Activity::RecheckVATNumber' ); - addToCleanup( $workflow ); + WebGUI::Test->addToCleanup( $workflow ); my $instance = WebGUI::Workflow::Instance->create( $session, { workflowId => $workflow->getId, diff --git a/t/Workflow/Instance.t b/t/Workflow/Instance.t index 747b6ff15..8fea37ef6 100644 --- a/t/Workflow/Instance.t +++ b/t/Workflow/Instance.t @@ -67,7 +67,7 @@ my $wf = WebGUI::Workflow->create( } ); isa_ok($wf, 'WebGUI::Workflow', 'workflow created for test'); -addToCleanup($wf); +WebGUI::Test->addToCleanup($wf); # create an instance of $wfId my $properties = { @@ -179,7 +179,7 @@ my $wf2 = WebGUI::Workflow->create( type => 'None', } ); -addToCleanup($wf2); +WebGUI::Test->addToCleanup($wf2); my $wf2Instance = WebGUI::Workflow::Instance->create($session, {workflowId => $wf2->getId}); cmp_deeply($wf2Instance->get('parameters'), {}, 'get returns {} for parameters when there are no parameters stored');