6 use RT::Test tests => 19;
8 my ( $baseurl, $m ) = RT::Test->started_ok;
9 ok $m->login, 'logged in as root';
13 diag('make Autoreply template a html one and add utf8 chars')
14 if $ENV{TEST_VERBOSE};
17 $m->follow_link_ok( { id => 'tools-config-global-templates' }, '-> Templates' );
18 $m->follow_link_ok( { text => 'Autoreply' }, '-> Autoreply' );
21 form_name => 'ModifyTemplate',
24 Subject: AutoReply: {$Ticket->Subject}
25 Content-Type: text/html
29 -------------------------------------------------------------------------
30 {$Transaction->Content()}
35 $m->content_like( qr/Content changed/, 'content is changed' );
36 $m->content_contains( '你好', 'content is really updated' );
39 diag('create a ticket to see the autoreply mail') if $ENV{TEST_VERBOSE};
42 $m->get_ok( $baseurl . '/Ticket/Create.html?Queue=1' );
45 form_name => 'TicketCreate',
46 fields => { Subject => '标题', Content => '<h1>测试</h1>',
47 ContentType => 'text/html' },
49 $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
50 $m->follow_link( text => 'Show' );
51 $m->content_contains( '你好', 'html has 你好' );
52 $m->content_contains( 'éèà€', 'html has éèà€' );
53 $m->content_contains( '标题',
54 'html has ticket subject 标题' );
55 $m->content_contains( '<h1>测试</h1>',
56 'html has ticket html content 测试' );
59 diag('test real mail outgoing') if $ENV{TEST_VERBOSE};
63 # $mail is utf8 encoded
64 my ($mail) = RT::Test->fetch_caught_mails;
65 $mail = decode_utf8 $mail;
66 like( $mail, qr/你好.*你好/s, 'mail has éèà€' );
67 like( $mail, qr/éèà€.*éèà€/s, 'mail has éèà€' );
68 like( $mail, qr/标题.*标题/s, 'mail has ticket subject 标题' );
69 like( $mail, qr/测试.*测试/s, 'mail has ticket content 测试' );
70 like( $mail, qr!<h1>测试</h1>!, 'mail has ticket html content 测试' );