[Rt-commit] r19490 - in rt/3.999/trunk: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu May 7 02:58:56 EDT 2009


Author: sunnavy
Date: Thu May  7 02:58:56 2009
New Revision: 19490

Modified:
   rt/3.999/trunk/   (props changed)
   rt/3.999/trunk/lib/RT/Test.pm

Log:
 r20315 at sunnavys-mb (orig r18778):  sunnavy | 2009-03-13 16:00:16 +0800
 rewrite config part in Test.pm to make tests happy


Modified: rt/3.999/trunk/lib/RT/Test.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Test.pm	(original)
+++ rt/3.999/trunk/lib/RT/Test.pm	Thu May  7 02:58:56 2009
@@ -73,7 +73,7 @@
 
 my $config;
 our ( $existing_server, $port );
-my $mailsent;
+our $MAIL_SENT;
 
 my @server;
 
@@ -139,13 +139,13 @@
     if ( RT->config->get('DevelMode') ) { require Module::Refresh; }
 
     # make it another function
-    $mailsent = 0;
+    $MAIL_SENT = 0;
     my $mailfunc = sub {
         my $Entity = shift;
-        $mailsent++;
+        $RT::Test::MAIL_SENT++;
         return 1;
     };
-    RT->config->set( 'MailCommand' => $mailfunc );
+    RT->config->set( 'mail_command' => $mailfunc );
 }
 our $server_url;
 
@@ -182,7 +182,7 @@
 sub mailsent_ok {
     my $class    = shift;
     my $expected = shift;
-    is( $mailsent, $expected, "The number of mail sent ($expected) matches. yay" );
+    is( $MAIL_SENT, $expected, "The number of mail sent ($expected) matches. yay" );
 }
 
 =head1 UTILITIES
@@ -539,15 +539,15 @@
     );
 }
 
-my $mailbox_catcher = File::Temp->new( OPEN => 0, CLEANUP => 0 )->filename;
+our $MAILBOX_CATCHER = File::Temp->new( OPEN => 0, CLEANUP => 0 )->filename;
 
 sub set_mail_catcher {
     my $self    = shift;
     my $catcher = sub {
         my $MIME = shift;
 
-        open my $handle, '>>', $mailbox_catcher
-          or die "Unable to open $mailbox_catcher for appending: $!";
+        open my $handle, '>>', $RT::TEST::MAILBOX_CATCHER
+          or die "Unable to open $MAILBOX_CATCHER for appending: $!";
 
         $MIME->print($handle);
         print $handle "%% split me! %%\n";
@@ -566,11 +566,11 @@
 sub fetch_caught_mails {
     my $self = shift;
     return grep /\S/, split /%% split me! %%/,
-       RT::Test->file_content( $mailbox_catcher, 'unlink' => 1, noexist => 1 );
+       RT::Test->file_content( $MAILBOX_CATCHER, 'unlink' => 1, noexist => 1 );
 }
 
 sub clean_caught_mails {
-    unlink $mailbox_catcher;
+    unlink $MAILBOX_CATCHER;
 }
 
 sub file_content {
@@ -617,7 +617,7 @@
     require RT::Crypt::GnuPG;
     require GnuPG::Interface;
     my $gnupg = new GnuPG::Interface;
-    my %opt   = RT->config->get('GnuPGOptions');
+    my %opt   = %{RT->config->get('GnuPGOptions')};
     $gnupg->options->hash_init( RT::Crypt::GnuPG::_prepare_gnupg_options(%opt), meta_interactive => 0, );
 
     my %handle;
@@ -675,7 +675,7 @@
     require RT::Crypt::GnuPG;
     require GnuPG::Interface;
     my $gnupg = new GnuPG::Interface;
-    my %opt   = RT->config->get('GnuPGOptions');
+    my %opt   = %{RT->config->get('GnuPGOptions')};
     $gnupg->options->hash_init( RT::Crypt::GnuPG::_prepare_gnupg_options(%opt), meta_interactive => 0, );
 
     my %handle;


More information about the Rt-commit mailing list