diff --git a/t/DatabaseLink.t b/t/DatabaseLink.t index d31561cb7..0a9a6b827 100644 --- a/t/DatabaseLink.t +++ b/t/DatabaseLink.t @@ -206,6 +206,7 @@ my $dbLinkParams = { }; $dbLink = WebGUI::DatabaseLink->create($session, $dbLinkParams); +addToCleanup($dbLink); $dbLinkParams->{databaseLinkId} = ignore(); cmp_deeply( @@ -282,9 +283,3 @@ cmp_deeply($dbs, $dbsAfter, 'delete cleaned up all temporarily created DatabaseL # delete # #################################################### - -END { - foreach my $link ($dbLink, $wgDbLink) { - $link->delete if (defined $link and ref $link eq 'WebGUI::DatabaseLink'); - } -} diff --git a/t/lib/WebGUI/Test.pm b/t/lib/WebGUI/Test.pm index 86ecececa..05b4e5154 100644 --- a/t/lib/WebGUI/Test.pm +++ b/t/lib/WebGUI/Test.pm @@ -112,6 +112,7 @@ sub import { Transactions => 'transaction', 'Transaction Items' => 'transactionItem', 'Ship Drivers' => 'shipper', + 'Database Links' => 'databaseLink', ); my %initCounts; for ( my $i = 0; $i < @checkCount; $i += 2) { @@ -770,6 +771,7 @@ were passed in. Currently able to destroy: WebGUI::Shop::Cart WebGUI::Shop::ShipDriver WebGUI::Shop::Transaction + WebGUI::DatabaseLink Example call: @@ -811,6 +813,11 @@ Example call: die "Refusing to clean up vital user @{[ $user->username ]}!\n" if any { $userId eq $_ } (1, 3); }, + 'WebGUI::DatabaseLink' => sub { + my $db_link = shift; + die "Refusing to clean up database link @{[ $db_link->get('title') ]}!\n" + if $db_link->getId eq '0'; + }, 'WebGUI::Group' => sub { my $group = shift; die "Refusing to clean up vital group @{[ $group->name ]}!\n" @@ -844,6 +851,7 @@ Example call: 'WebGUI::Asset' => 'purge', 'WebGUI::VersionTag' => 'rollback', 'WebGUI::Workflow' => 'delete', + 'WebGUI::DatabaseLink' => 'delete', 'WebGUI::Shop::Transaction' => 'delete', 'WebGUI::Shop::ShipDriver' => 'delete', 'WebGUI::Shop::Cart' => sub {