summaryrefslogtreecommitdiff
path: root/rt/lib/RT/Test.pm
diff options
context:
space:
mode:
Diffstat (limited to 'rt/lib/RT/Test.pm')
-rw-r--r--rt/lib/RT/Test.pm31
1 files changed, 13 insertions, 18 deletions
diff --git a/rt/lib/RT/Test.pm b/rt/lib/RT/Test.pm
index e1990d00d..9954ec729 100644
--- a/rt/lib/RT/Test.pm
+++ b/rt/lib/RT/Test.pm
@@ -75,7 +75,7 @@ wrap 'HTTP::Request::Common::form_data',
};
-our @EXPORT = qw(is_empty parse_mail);
+our @EXPORT = qw(is_empty);
our ($port, $dbname);
our @SERVERS;
@@ -217,7 +217,7 @@ sub bootstrap_config {
$tmp{'config'}{'RT'} = File::Spec->catfile(
"$tmp{'directory'}", 'RT_SiteConfig.pm'
);
- open( my $config, '>', $tmp{'config'}{'RT'} )
+ open my $config, '>', $tmp{'config'}{'RT'}
or die "Couldn't open $tmp{'config'}{'RT'}: $!";
print $config qq{
@@ -246,7 +246,7 @@ Set( \$RTAddressRegexp , qr/^bad_re_that_doesnt_match\$/);
Set( \$MailCommand, sub {
my \$MIME = shift;
- open( my \$handle, '>>', '$mail_catcher' )
+ open my \$handle, '>>', '$mail_catcher'
or die "Unable to open '$mail_catcher' for appending: \$!";
\$MIME->print(\$handle);
@@ -272,7 +272,7 @@ sub bootstrap_logging {
$tmp{'log'}{'RT'} = File::Spec->catfile(
"$tmp{'directory'}", 'rt.debug.log'
);
- open( my $fh, '>', $tmp{'log'}{'RT'} )
+ open my $fh, '>', $tmp{'log'}{'RT'}
or die "Couldn't open $tmp{'config'}{'RT'}: $!";
# make world writable so apache under different user
# can write into it
@@ -303,7 +303,7 @@ sub set_config_wrapper {
SCALAR => '$',
);
my $sigil = $sigils{$type} || $sigils{'SCALAR'};
- open( my $fh, '>>', $tmp{'config'}{'RT'} )
+ open my $fh, '>>', $tmp{'config'}{'RT'}
or die "Couldn't open config file: $!";
require Data::Dumper;
my $dump = Data::Dumper::Dumper([@_[2 .. $#_]]);
@@ -774,7 +774,7 @@ sub open_mailgate_ok {
my $baseurl = shift;
my $queue = shift || 'general';
my $action = shift || 'correspond';
- Test::More::ok(open(my $mail, '|-', "$RT::BinPath/rt-mailgate --url $baseurl --queue $queue --action $action"), "Opened the mailgate - $!");
+ Test::More::ok(open(my $mail, "|$RT::BinPath/rt-mailgate --url $baseurl --queue $queue --action $action"), "Opened the mailgate - $!");
return $mail;
}
@@ -1059,6 +1059,9 @@ sub start_standalone_server {
$RT::Handle->dbh( undef );
RT->ConnectToDatabase;
+ # the attribute cache holds on to a stale dbh
+ delete $RT::System->{attributes};
+
return ($ret, RT::Test::Web->new);
}
@@ -1069,7 +1072,7 @@ sub start_apache_server {
my %info = $self->apache_server_info( variant => $variant );
Test::More::diag(do {
- open( my $fh, '<', $tmp{'config'}{'RT'} ) or die $!;
+ open my $fh, '<', $tmp{'config'}{'RT'};
local $/;
<$fh>
});
@@ -1115,7 +1118,7 @@ sub start_apache_server {
}
Test::More::BAIL_OUT("Couldn't start apache server, no pid file")
unless -e $opt{'pid_file'};
- open( my $pid_fh, '<', $opt{'pid_file'} )
+ open my $pid_fh, '<', $opt{'pid_file'}
or Test::More::BAIL_OUT("Couldn't open pid file: $!");
my $pid = <$pid_fh>;
chomp $pid;
@@ -1227,7 +1230,7 @@ sub file_content {
Test::More::diag "reading content of '$path'" if $ENV{'TEST_VERBOSE'};
- open( my $fh, "<:raw", $path )
+ open my $fh, "<:raw", $path
or do {
warn "couldn't open file '$path': $!" unless $args{noexist};
return ''
@@ -1286,7 +1289,7 @@ sub process_in_file {
($out_fh, $out_conf) = tempfile();
} else {
$out_conf = $args{'out'};
- open( $out_fh, '>', $out_conf )
+ open $out_fh, '>', $out_conf
or die "couldn't open '$out_conf': $!";
}
print $out_fh $text;
@@ -1295,14 +1298,6 @@ sub process_in_file {
return ($out_fh, $out_conf);
}
-sub parse_mail {
- my $mail = shift;
- require RT::EmailParser;
- my $parser = RT::EmailParser->new;
- $parser->ParseMIMEEntityFromScalar( $mail );
- return $parser->Entity;
-}
-
END {
my $Test = RT::Test->builder;
return if $Test->{Original_Pid} != $$;