Commit | Line | Data |
93c63aff |
1 | use utf8; |
2 | use warnings; |
3 | use strict; |
8b7d5e5b |
4 | use Test::More 0.88; |
93c63aff |
5 | use 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 | |
33 | use Catalyst::Test 'MyApp'; |
34 | |
35 | if(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 | |
44 | done_testing; |
45 | |