call decoded_content, instead of decoding manually
[catagits/Catalyst-View-TT.git] / t / utf8.t
CommitLineData
93c63aff 1use utf8;
2use warnings;
3use strict;
4use Test::More;
93c63aff 5use File::Spec;
6
7{
8 package MyApp::Controller::Root;
9 $INC{'MyApp/Controller/Root.pm'} = __FILE__;
10
11 use base 'Catalyst::Controller';
12
13 sub heart :Path('♥') {
14 my ($self, $c) = @_;
15 $c->stash(hearts=>'♥♥♥');
16 $c->detach('View::HTML');
17 }
18 package MyApp::View::HTML;
19 $INC{'MyApp/View/HTML.pm'} = __FILE__;
20
21 use base 'Catalyst::View::TT';
22
23 MyApp::View::HTML->config(
24 ENCODING => 'UTF-8',
25 INCLUDE_PATH=> File::Spec->catfile('t'));
26
27 package MyApp;
28 use Catalyst;
29
30 MyApp->setup;
31}
32
33use Catalyst::Test 'MyApp';
34
35if(MyApp->can('encoding') and MyApp->can('clear_encoding') ) {
2c6b6475 36 ok my $res = request '/root/♥';
93c63aff 37 is $res->code, 200, 'OK';
f6c7524b 38 is $res->decoded_content, "<p>This heart literal ♥</p><p>This is heart var ♥♥♥</p>\n", 'correct body';
93c63aff 39 is $res->content_charset, 'UTF-8';
40} else {
41 ok 1, 'Skipping the UTF8 Tests for older installed catalyst';
42}
43
44done_testing;
45