[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-132-g45fdf50
? sunnavy
sunnavy at bestpractical.com
Mon Aug 16 11:19:20 EDT 2010
The branch, 3.8-trunk has been updated
via 45fdf505109d201dd676354ff9c07184c9cc3a30 (commit)
via 41451bb594a9074c096a7dbb44b12b1e7c9ed361 (commit)
from 6ad50e808c1386b16bed901b09ebee8d985c2fe6 (commit)
Summary of changes:
t/web/html_template.t | 76 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 76 insertions(+), 0 deletions(-)
create mode 100644 t/web/html_template.t
- Log -----------------------------------------------------------------
commit 41451bb594a9074c096a7dbb44b12b1e7c9ed361
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Aug 16 23:15:15 2010 +0800
test for encoding of html template
diff --git a/t/web/html_template.t b/t/web/html_template.t
new file mode 100644
index 0000000..bc84e35
--- /dev/null
+++ b/t/web/html_template.t
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use RT::Test tests => 18;
+use Encode;
+my ( $baseurl, $m ) = RT::Test->started_ok;
+ok $m->login, 'logged in as root';
+
+$RT::Test::SKIP_REQUEST_WORK_AROUND = 1;
+RT::Test->set_mail_catcher;
+
+use utf8;
+
+diag('make Autoreply template a html one and add utf8 chars')
+ if $ENV{TEST_VERBOSE};
+
+{
+ $m->follow_link_ok( { text => 'Configuration' }, '-> Configuration' );
+ $m->follow_link_ok( { text => 'Global' }, '-> Global' );
+ $m->follow_link_ok( { text => 'Templates' }, '-> Templates' );
+ $m->follow_link_ok( { text => 'Autoreply' }, '-> Autoreply' );
+
+ $m->form_number(3);
+ $m->submit_form(
+ fields => {
+ Content => <<'EOF',
+Subject: AutoReply: {$Ticket->Subject}
+Content-Type: text/html; charset="utf-8"
+
+ä½ å¥½ éèà â¬
+{$Ticket->Subject}
+-------------------------------------------------------------------------
+{$Transaction->Content()}
+
+EOF
+ },
+ );
+ $m->content_like( qr/Content changed/, 'content is changed' );
+ $m->content_contains( 'ä½ å¥½', 'content is really updated' );
+}
+
+diag('create a ticket to see the autoreply mail') if $ENV{TEST_VERBOSE};
+
+{
+ $m->get_ok( $baseurl . '/Ticket/Create.html?Queue=1' );
+
+ $m->form_number(3);
+ $m->submit_form(
+ form_number => 3,
+ fields => { Subject => 'æ é¢', Content => 'æµè¯', },
+ );
+ $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
+ $m->follow_link( text => 'Show' );
+ $m->content_contains( 'ä½ å¥½', 'html has ä½ å¥½' );
+ $m->content_contains( 'éèà â¬', 'html has éèà â¬' );
+ $m->content_contains( 'æ é¢',
+ 'html has ticket subject æ é¢' );
+ $m->content_contains( 'æµè¯',
+ 'html has ticket content æµè¯' );
+}
+
+diag('test real mail outgoing') if $ENV{TEST_VERBOSE};
+
+{
+
+ # $mail is utf8 encoded
+ my ($mail) = RT::Test->fetch_caught_mails;
+ $mail = decode_utf8 $mail;
+ like( $mail, qr/ä½ å¥½/, 'mail has éèà â¬' );
+ like( $mail, qr/éèà â¬/, 'mail has éèà â¬' );
+ like( $mail, qr/æ é¢/, 'mail has ticket subject æ é¢' );
+ like( $mail, qr/æµè¯/, 'mail has ticket content æµè¯' );
+}
+
commit 45fdf505109d201dd676354ff9c07184c9cc3a30
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Aug 16 23:20:59 2010 +0800
there should be 2 counts, one for plain and html, respectively
diff --git a/t/web/html_template.t b/t/web/html_template.t
index bc84e35..0976847 100644
--- a/t/web/html_template.t
+++ b/t/web/html_template.t
@@ -27,7 +27,7 @@ diag('make Autoreply template a html one and add utf8 chars')
fields => {
Content => <<'EOF',
Subject: AutoReply: {$Ticket->Subject}
-Content-Type: text/html; charset="utf-8"
+Content-Type: text/html
ä½ å¥½ éèà â¬
{$Ticket->Subject}
@@ -68,9 +68,9 @@ diag('test real mail outgoing') if $ENV{TEST_VERBOSE};
# $mail is utf8 encoded
my ($mail) = RT::Test->fetch_caught_mails;
$mail = decode_utf8 $mail;
- like( $mail, qr/ä½ å¥½/, 'mail has éèà â¬' );
- like( $mail, qr/éèà â¬/, 'mail has éèà â¬' );
- like( $mail, qr/æ é¢/, 'mail has ticket subject æ é¢' );
- like( $mail, qr/æµè¯/, 'mail has ticket content æµè¯' );
+ like( $mail, qr/ä½ å¥½.*ä½ å¥½/s, 'mail has éèà â¬' );
+ like( $mail, qr/éèà â¬.*éèà â¬/s, 'mail has éèà â¬' );
+ like( $mail, qr/æ é¢.*æ é¢/s, 'mail has ticket subject æ é¢' );
+ like( $mail, qr/æµè¯.*æµè¯/s, 'mail has ticket content æµè¯' );
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list