[Rt-commit] r7807 - in rt/branches/3.7-EXPERIMENTAL-TUNIS: .

clsung at bestpractical.com clsung at bestpractical.com
Thu May 10 04:36:40 EDT 2007


Author: clsung
Date: Thu May 10 04:36:40 2007
New Revision: 7807

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/   (props changed)
   rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/sendmail.t

Log:
 r1028 at going04:  clsung | 2007-05-10 16:31:35 +0800
 - fix warnings 
   => [warning]: Use of uninitialized value in numeric gt (>) at /home/clsung/svn/rt/branches/3.7-tunis/lib/RT/Action/SendEmail.pm line 126
   => [warning]: Use of uninitialized value in abs at /home/clsung/svn/rt/branches/3.7-tunis/lib/RT/Action/SendEmail.pm line 136
 - use 'local *RT::Action::SendEmail::SendMessage = sub { return 1};' to replace
   'eval 'sub RT::Action::SendEmail::SendMessage { }';' knobs, 
   - learned from clkao@


Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/sendmail.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/sendmail.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/sendmail.t	Thu May 10 04:36:40 2007
@@ -255,23 +255,23 @@
 
 
 # be as much like the mail gateway as possible.
-&umlauts_redef_sendmessage;
+{
+    no warnings qw/redefine/;
+    local *RT::Action::SendEmail::SendMessage = sub { return 1};
 
-%args = (message => $content, queue => 1, action => 'correspond');
-RT::Interface::Email::Gateway(\%args);
-$tickets = RT::Tickets->new($RT::SystemUser);
-$tickets->OrderBy(FIELD => 'id', ORDER => 'DESC');
-$tickets->Limit(FIELD => 'id' ,OPERATOR => '>', VALUE => '0');
-$tick = $tickets->First();
+    %args = (message => $content, queue => 1, action => 'correspond');
+    RT::Interface::Email::Gateway(\%args);
+    # TODO: following 5 lines should replaced by get_latest_ticket_ok()
+    $tickets = RT::Tickets->new($RT::SystemUser);
+    $tickets->OrderBy(FIELD => 'id', ORDER => 'DESC');
+    $tickets->Limit(FIELD => 'id' ,OPERATOR => '>', VALUE => '0');
+    $tick = $tickets->First();
 
-ok ($tick->Id, "found ticket ".$tick->Id);
+    ok ($tick->Id, "found ticket ".$tick->Id);
 
-ok (first_txn($tick)->Content =~ /causes Error/, "We recorded the content right as text-plain");
-is (count_attachs($tick) , 3 , "Has three attachments, presumably a text-plain, a text-html and a multipart alternative");
+    ok (first_txn($tick)->Content =~ /causes Error/, "We recorded the content right as text-plain");
+    is (count_attachs($tick) , 3 , "Has three attachments, presumably a text-plain, a text-html and a multipart alternative");
 
-sub umlauts_redef_sendmessage {
-    no warnings qw/redefine/;
-    eval 'sub RT::Action::SendEmail::SendMessage { }';
 }
 
 # }}}
@@ -444,22 +444,19 @@
 
 
 # be as much like the mail gateway as possible.
-&notes_redef_sendmessage;
-
- %args =        (message => $content, queue => 1, action => 'correspond');
- RT::Interface::Email::Gateway(\%args);
-$tickets = RT::Tickets->new($RT::SystemUser);
-$tickets->OrderBy(FIELD => 'id', ORDER => 'DESC');
-$tickets->Limit(FIELD => 'id' ,OPERATOR => '>', VALUE => '0');
-$tick= $tickets->First();
-ok ($tick->Id, "found ticket ".$tick->Id);
-
-ok (first_txn($tick)->Content =~ /from Lotus Notes/, "We recorded the content right");
-is (count_attachs($tick) , 3 , "Has three attachments");
-
-sub notes_redef_sendmessage {
+{
     no warnings qw/redefine/;
-    eval 'sub RT::Action::SendEmail::SendMessage { }';
+    local *RT::Action::SendEmail::SendMessage = sub { return 1};
+    %args =        (message => $content, queue => 1, action => 'correspond');
+    RT::Interface::Email::Gateway(\%args);
+    $tickets = RT::Tickets->new($RT::SystemUser);
+    $tickets->OrderBy(FIELD => 'id', ORDER => 'DESC');
+    $tickets->Limit(FIELD => 'id' ,OPERATOR => '>', VALUE => '0');
+    $tick= $tickets->First();
+    ok ($tick->Id, "found ticket ".$tick->Id);
+
+    ok (first_txn($tick)->Content =~ /from Lotus Notes/, "We recorded the content right");
+    is (count_attachs($tick) , 3 , "Has three attachments");
 }
 
 # }}}
@@ -472,8 +469,9 @@
 
 
 # be as much like the mail gateway as possible.
-&crashes_redef_sendmessage;
 
+no warnings qw/redefine/;
+local *RT::Action::SendEmail::SendMessage = sub { return 1};
  %args =        (message => $content, queue => 1, action => 'correspond');
  RT::Interface::Email::Gateway(\%args);
  $tickets = RT::Tickets->new($RT::SystemUser);
@@ -485,10 +483,6 @@
 ok (first_txn($tick)->Content =~ /FYI/, "We recorded the content right");
 is (count_attachs($tick) , 5 , "Has three attachments");
 
-sub crashes_redef_sendmessage {
-    no warnings qw/redefine/;
-    eval 'sub RT::Action::SendEmail::SendMessage { }';
-}
 
 
 


More information about the Rt-commit mailing list