From decde00451c3103471370a489ace507694b27ea3 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 13 Apr 2009 17:36:23 +0000 Subject: [PATCH] Forward port auto storage deletion code for WebGUI::Test. --- t/lib/WebGUI/Test.pm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/t/lib/WebGUI/Test.pm b/t/lib/WebGUI/Test.pm index 474f8aa0b..98ca63568 100644 --- a/t/lib/WebGUI/Test.pm +++ b/t/lib/WebGUI/Test.pm @@ -52,6 +52,7 @@ my %originalConfig; my $originalSetting; my @groupsToDelete; +my @storagesToDelete; BEGIN { @@ -140,6 +141,15 @@ END { foreach my $group (@groupsToDelete) { $group->delete; } + foreach my $stor (@storagesToDelete) { + if ($SESSION->id->valid($stor)) { + my $storage = WebGUI::Storage->get($SESSION, $stor); + $storage->delete if $storage; + } + else { + $stor->delete; + } + } if ($ENV{WEBGUI_TEST_DEBUG}) { $Test->diag('Sessions: '.$SESSION->db->quickScalar('select count(*) from userSession')); $Test->diag('Scratch : '.$SESSION->db->quickScalar('select count(*) from userSessionScratch')); @@ -379,6 +389,8 @@ sub originalConfig { Push a list of group objects onto the stack of groups to be automatically deleted at the end of the test. +This is a class method. + =cut sub groupsToDelete { @@ -388,6 +400,22 @@ sub groupsToDelete { #---------------------------------------------------------------------------- +=head2 storagesToDelete ( $storage, [$storageId ] ) + +Push a list of storage objects or storageIds onto the stack of storage locaitons +at the end of the test. + +This is a class method. + +=cut + +sub storagesToDelete { + my $class = shift; + push @storagesToDelete, @_; +} + +#---------------------------------------------------------------------------- + =head1 BUGS When trying to load the APR module, perl invariably throws an Out Of Memory