merge to 10219

This commit is contained in:
Colin Kuskie 2009-04-08 16:35:31 +00:00
parent ae28bf79c8
commit 4c1307e3d0
194 changed files with 8203 additions and 2134 deletions

View file

@ -2,6 +2,7 @@ package WebGUI::Test;
use strict;
use warnings;
use Clone qw/clone/;
=head1 LEGAL
@ -47,6 +48,9 @@ our $logger_debug;
our $logger_info;
our $logger_error;
my %originalConfig;
my $originalSetting;
BEGIN {
STDERR->autoflush(1);
@ -125,6 +129,8 @@ BEGIN {
$SESSION = WebGUI::Session->open( $WEBGUI_ROOT, $CONFIG_FILE );
$SESSION->{_request} = $pseudoRequest;
$originalSetting = clone $SESSION->setting;
}
END {
@ -135,6 +141,18 @@ END {
$Test->diag('Users : '.$SESSION->db->quickScalar('select count(*) from users'));
$Test->diag('Groups : '.$SESSION->db->quickScalar('select count(*) from groups'));
}
while (my ($key, $value) = each %originalConfig) {
if (defined $value) {
$SESSION->config->set($key, $value);
}
else {
$SESSION->config->delete($key);
}
}
my $settings = $originalSetting->get();
while (my ($param, $value) = each %{ $settings }) {
$SESSION->setting->set($param, $value);
}
$SESSION->var->end;
$SESSION->close if defined $SESSION;
}
@ -346,6 +364,24 @@ sub webguiBirthday {
#----------------------------------------------------------------------------
=head2 originalConfig ( $param )
Stores the original data from the config file, to be restored
automatically at the end of the test. This is a class method.
=cut
sub originalConfig {
my ($class, $param) = @_;
my $safeValue = my $value = $SESSION->config->get($param);
if (ref $value) {
$safeValue = clone $value;
}
$originalConfig{$param} = $safeValue;
}
#----------------------------------------------------------------------------
=head1 BUGS