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