-#!/usr/bin/perl
use strict;
use warnings;
$m->submit_form(
form_name => 'ForwardMessage',
fields => {
- To => 'rt-test, rt-to@example.com',
- Cc => 'rt-cc@example.com',
+ To => '"Foo" <rt-foo@example.com>, rt-too@example.com',
+ Cc => 'rt-cc@example.com',
+ Bcc => 'root',
},
button => 'ForwardAndReturn'
);
- $m->content_contains( 'Sent email successfully', 'sent mail msg' );
$m->content_contains(
- 'Forwarded Ticket to rt-test, rt-to@example.com, rt-cc@example.com',
+ 'Forwarded Ticket to Foo <rt-foo@example.com>, <rt-too@example.com>, <rt-cc@example.com>, root (Enoch Root)',
'txn msg' );
my ($mail) = RT::Test->fetch_caught_mails;
like( $mail, qr!Subject: test forward!, 'Subject field' );
- like( $mail, qr!To: rt-test, rt-to\@example.com!, 'To field' );
+ like( $mail, qr!To: .*?rt-foo\@example.com!i, 'To field' );
+ like( $mail, qr!To: .*?rt-too\@example.com!i, 'To field' );
like( $mail, qr!Cc: rt-cc\@example.com!i, 'Cc field' );
+ like( $mail, qr!Bcc: root\@localhost!i, 'Bcc field' );
like( $mail, qr!This is a forward of ticket!, 'content' );
like( $mail, qr!this is an attachment!, 'att content' );
like( $mail, qr!$att_name!, 'att file name' );
$m->submit_form(
form_name => 'ForwardMessage',
fields => {
- To => 'rt-test, rt-to@example.com',
+ To => 'rt-to@example.com, rt-too@example.com',
Cc => 'rt-cc@example.com',
- Bcc => 'rt-bcc@example.com'
+ Bcc => 'root'
},
button => 'ForwardAndReturn'
);
- $m->content_contains( 'Sent email successfully', 'sent mail msg' );
$m->content_like(
-qr/Forwarded Transaction #\d+ to rt-test, rt-to\@example.com, rt-cc\@example.com, rt-bcc\@example.com/,
+qr/Forwarded .*?Transaction #\d+.*? to <rt-to\@example\.com>, <rt-too\@example\.com>, <rt-cc\@example\.com>, root (Enoch Root)/,
'txn msg'
);
my ($mail) = RT::Test->fetch_caught_mails;
like( $mail, qr!Subject: test forward!, 'Subject field' );
- like( $mail, qr!To: rt-test, rt-to\@example.com!, 'To field' );
+ like( $mail, qr!To: .*rt-to\@example.com!i, 'To field' );
+ like( $mail, qr!To: .*rt-too\@example.com!i, 'To field' );
like( $mail, qr!Cc: rt-cc\@example.com!i, 'Cc field' );
- like( $mail, qr!Bcc: rt-bcc\@example.com!i, 'Bcc field' );
+ like( $mail, qr!Bcc: root\@localhost!i, 'Bcc field' );
like( $mail, qr!This is a forward of transaction!, 'content' );
like( $mail, qr!$att_name!, 'att file name' );
like( $mail, qr!this is an attachment!, 'att content' );
fields => { To => 'rt-test@example.com', },
button => 'ForwardAndReturn'
);
- $m->content_contains( 'Sent email successfully', 'sent mail msg' );
my ($mail) = RT::Test->fetch_caught_mails;
- like( $mail, qr/Subject: Fwd: \[example\.com #\d\] test forward without content/, 'Subject field' );
+ like( $mail, qr/Subject: \[example\.com #\d\] Fwd: test forward without content/, 'Subject field' );
like( $mail, qr/To: rt-test\@example\.com/, 'To field' );
like( $mail, qr/This is a forward of ticket #\d/, 'content' );
}
$m->form_name('TicketCreate');
my $attach = $m->current_form->find_input('Attach');
- $attach->filename("awesome.patch");
+ $attach->filename('awesome.pátch');
$attach->headers('Content-Type' => 'text/x-diff');
$m->set_fields(
Subject => 'test forward, empty content but attachments',
Attach => RT::Test::get_relocatable_file('bpslogo.png', '..', 'data'), # an image!
);
$m->submit;
- $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
- $m->content_like( qr/awesome\.patch/, 'uploaded patch file' );
+ $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
+ $m->content_like( qr/awesome.p\%C3\%A1tch/, 'uploaded patch file' );
$m->content_like( qr/text\/x-diff/, 'uploaded patch file content type' );
$m->content_like( qr/bpslogo\.png/, 'uploaded image file' );
$m->content_like( qr/image\/png/, 'uploaded image file content type' );
},
button => 'ForwardAndReturn'
);
- $m->content_contains( 'Sent email successfully', 'sent mail msg' );
- $m->content_like( qr/Forwarded Transaction #\d+ to rt-test\@example\.com/, 'txn msg' );
+ $m->content_like( qr/Forwarded .*?Transaction #\d+.*? to <rt-test\@example\.com>/, 'txn msg' );
my ($mail) = RT::Test->fetch_caught_mails;
like( $mail, qr/Subject: test forward, empty content but attachments/, 'Subject field' );
like( $mail, qr/To: rt-test\@example.com/, 'To field' );
like( $mail, qr/This is a forward of transaction/, 'content' );
- like( $mail, qr/awesome\.patch/, 'att file name' );
+ like( $mail, qr/filename\*\=\"UTF\-8\'\'awesome.p\%C3\%A1tch\"/, 'att file name' );
like( $mail, qr/this is an attachment/, 'att content' );
like( $mail, qr/text\/x-diff/, 'att content type' );
like( $mail, qr/bpslogo\.png/, 'att image file name' );
diag "Forward Transaction with attachments but no 'content' part" if $ENV{TEST_VERBOSE};
{
my $mime = MIME::Entity->build(
- From => 'test@example.com',
+ From => '"Tést" <test@example.com>',
Subject => 'attachments for everyone',
Type => 'multipart/mixed',
);
},
button => 'ForwardAndReturn'
);
- $m->content_contains( 'Sent email successfully', 'sent mail msg' );
- $m->content_like( qr/Forwarded Transaction #\d+ to rt-test\@example\.com/, 'txn msg' );
-
+ $m->content_like( qr/Forwarded .*?Transaction #\d+.*? to <rt-test\@example\.com>/, 'txn msg' );
+
# Forward ticket
$m->follow_link_ok( { text => 'Forward', n => 1 }, 'follow 1st Forward' );
$m->submit_form(
},
button => 'ForwardAndReturn'
);
- $m->content_contains( 'Sent email successfully', 'sent mail msg' );
- $m->content_like( qr/Forwarded Ticket to rt-test\@example\.com/, 'txn msg' );
+ $m->content_like( qr/Forwarded Ticket to <rt-test\@example\.com>/, 'txn msg' );
my ($forward_txn, $forward_ticket) = RT::Test->fetch_caught_mails;
- my $tag = qr/Fwd: \[example\.com #\d+\]/;
+ my $tag = qr/\[example\.com #\d+\] Fwd:/;
like( $forward_txn, qr/Subject: $tag attachments for everyone/, 'Subject field is from txn' );
like( $forward_txn, qr/This is a forward of transaction/, 'forward description' );
like( $forward_ticket, qr/Subject: $tag test forward, attachments but no "content"/, 'Subject field is from ticket' );
like( $forward_ticket, qr/This is a forward of ticket/, 'forward description' );
+ like( $forward_ticket, qr/From: \=\?UTF-8\?.* \<test\@example\.com\>/i );
for my $mail ($forward_txn, $forward_ticket) {
like( $mail, qr/To: rt-test\@example.com/, 'To field' );
);
my ($mail) = RT::Test->fetch_caught_mails;
- like($mail, qr/Subject: OVERRIDING SUBJECT/);
+ like($mail, qr/Subject: \[example.com #\d+\] OVERRIDING SUBJECT/);
+}
+
+diag "Forward Transaction with non-ascii subject" if $ENV{TEST_VERBOSE};
+{
+ $m->follow_link_ok( { text => 'Forward', n => 2 }, 'follow 2nd Forward' );
+ my $subject = Encode::decode("UTF-8", 'test non-ascii äöü');
+ $m->submit_form(
+ form_name => 'ForwardMessage',
+ fields => {
+ Subject => $subject,
+ To => 'rt-to@example.com',
+ },
+ button => 'ForwardAndReturn'
+ );
+ my ($mail) = RT::Test->fetch_caught_mails;
+ if ( $mail =~ /Subject: (.+)/ ) {
+ like( Encode::decode("UTF-8", RT::I18N::DecodeMIMEWordsToUTF8( $1, 'Subject' )), qr/$subject/, 'non-ascii subject' );
+ }
+ $m->content_contains( $subject, 'non-ascii subject got displayed correctly' );
}
undef $m;