Provide a way for WebGUI::Test to register groups to clean up at

the end of a test.
Convert several tests to use that, including Post.t, which leaked Groups.
This commit is contained in:
Colin Kuskie 2009-04-13 02:45:03 +00:00
parent 0cbe0cc117
commit ddd06c2ede
4 changed files with 35 additions and 6 deletions

View file

@ -51,6 +51,8 @@ our $logger_error;
my %originalConfig;
my $originalSetting;
my @groupsToDelete;
BEGIN {
STDERR->autoflush(1);
@ -135,6 +137,9 @@ BEGIN {
END {
my $Test = Test::Builder->new;
foreach my $group (@groupsToDelete) {
$group->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'));
@ -369,6 +374,20 @@ sub originalConfig {
#----------------------------------------------------------------------------
=head2 groupsToDelete ( $group, [$group ] )
Push a list of group objects onto the stack of groups to be automatically deleted
at the end of the test.
=cut
sub groupsToDelete {
my $class = shift;
push @groupsToDelete, @_;
}
#----------------------------------------------------------------------------
=head1 BUGS
When trying to load the APR module, perl invariably throws an Out Of Memory