6 use RT::Test tests => 19;
8 my ( $baseurl, $m ) = RT::Test->started_ok;
9 ok $m->login, 'logged in as root';
11 $RT::Test::SKIP_REQUEST_WORK_AROUND = 1;
12 RT::Test->set_mail_catcher;
16 diag('make Autoreply template a html one and add utf8 chars')
17 if $ENV{TEST_VERBOSE};
20 $m->follow_link_ok( { text => 'Configuration' }, '-> Configuration' );
21 $m->follow_link_ok( { text => 'Global' }, '-> Global' );
22 $m->follow_link_ok( { text => 'Templates' }, '-> Templates' );
23 $m->follow_link_ok( { text => 'Autoreply' }, '-> Autoreply' );
29 Subject: AutoReply: {$Ticket->Subject}
30 Content-Type: text/html
34 -------------------------------------------------------------------------
35 {$Transaction->Content()}
40 $m->content_like( qr/Content changed/, 'content is changed' );
41 $m->content_contains( '你好', 'content is really updated' );
44 diag('create a ticket to see the autoreply mail') if $ENV{TEST_VERBOSE};
47 $m->get_ok( $baseurl . '/Ticket/Create.html?Queue=1' );
52 fields => { Subject => '标题', Content => '<h1>测试</h1>',
53 ContentType => 'text/html' },
55 $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
56 $m->follow_link( text => 'Show' );
57 $m->content_contains( '你好', 'html has 你好' );
58 $m->content_contains( 'éèà€', 'html has éèà€' );
59 $m->content_contains( '标题',
60 'html has ticket subject 标题' );
61 $m->content_contains( '<h1>测试</h1>',
62 'html has ticket html content 测试' );
65 diag('test real mail outgoing') if $ENV{TEST_VERBOSE};
69 # $mail is utf8 encoded
70 my ($mail) = RT::Test->fetch_caught_mails;
71 $mail = decode_utf8 $mail;
72 like( $mail, qr/你好.*你好/s, 'mail has éèà€' );
73 like( $mail, qr/éèà€.*éèà€/s, 'mail has éèà€' );
74 like( $mail, qr/标题.*标题/s, 'mail has ticket subject 标题' );
75 like( $mail, qr/测试.*测试/s, 'mail has ticket content 测试' );
76 like( $mail, qr!<h1>测试</h1>!, 'mail has ticket html content 测试' );