Commit | Line | Data |
70350518 |
1 | use strict; |
2 | use warnings; |
e59c17fe |
3 | |
70350518 |
4 | use Test::More; |
5 | use lib qw(t/lib); |
6 | use DBICTest; |
e59c17fe |
7 | |
a47e1233 |
8 | my $schema = DBICTest->init_schema(); |
e59c17fe |
9 | |
70350518 |
10 | eval 'use Encode ; 1' |
11 | or plan skip_all => 'Install Encode run this test'; |
e59c17fe |
12 | |
404939a4 |
13 | plan tests => 3; |
e59c17fe |
14 | |
404939a4 |
15 | DBICTest::Schema::CD->load_components('UTF8Columns'); |
16 | DBICTest::Schema::CD->utf8_columns('title'); |
70350518 |
17 | Class::C3->reinitialize(); |
18 | |
404939a4 |
19 | my $cd = $schema->resultset('CD')->create( { artist => 1, title => 'uni', year => 'foo' } ); |
20 | ok( Encode::is_utf8( $cd->title ), 'got title with utf8 flag' ); |
21 | ok( !Encode::is_utf8( $cd->year ), 'got year without utf8 flag' ); |
70350518 |
22 | |
23 | my $utf8_char = 'uniuni'; |
24 | Encode::_utf8_on($utf8_char); |
404939a4 |
25 | $cd->title($utf8_char); |
26 | ok( !Encode::is_utf8( $cd->{_column_data}{title} ), |
27 | 'store utf8-less chars' ); |
e59c17fe |
28 | |