fix Test::More prereq for done_testing
[catagits/Catalyst-View-TT.git] / t / utf8.t
1 use utf8;
2 use warnings;
3 use strict;
4 use Test::More 0.88;
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') ) {
36   ok my $res = request '/root/♥';
37   is $res->code, 200, 'OK';
38   is $res->decoded_content, "<p>This heart literal ♥</p><p>This is heart var ♥♥♥</p>\n", 'correct body';
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