make this work with cat 5.90080+
[catagits/Test-WWW-Mechanize-Catalyst.git] / t / utf8.t
CommitLineData
4c96289c 1use utf8;
2use warnings;
3use strict;
4use Test::More;
5use Encode 2.21 'decode_utf8', 'encode_utf8';
6use lib 't/lib';
7
8{
9 package MyApp::Controller::Root;
10 $INC{'MyApp/Controller/Root.pm'} = __FILE__;
11
12 use base 'Catalyst::Controller';
13
14 sub heart :Path('♥') {
15 my ($self, $c) = @_;
16 $c->response->content_type('text/html');
17 $c->response->body("<p>This is path-heart action ♥</p>");
18 }
19
20 package MyApp;
21 use Catalyst;
22
23 MyApp->setup;
24}
25
26use Test::WWW::Mechanize::Catalyst 'MyApp';
27
28my $root = "http://localhost";
29my $m = Test::WWW::Mechanize::Catalyst->new( autocheck => 0 );
30
31if(MyApp->can('encoding') and MyApp->can('clear_encoding') and MyApp->encoding eq 'UTF-8') {
32 $m->get_ok("$root/root/♥", 'got page');
33 is( $m->ct, "text/html" );
34 $m->content_contains("This is path-heart action ♥", 'matched expected content');
35} else {
36 ok 1, 'Skipping the UTF8 Tests for older installed catalyst';
37}
38
39done_testing;
40