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 | |
8236f0dc | 10 | eval 'use utf8; 1' |
11 | or plan skip_all => 'Need utf8 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 | ||
8236f0dc | 19 | my $cd = $schema->resultset('CD')->create( { artist => 1, title => 'øni', year => 'foo' } ); |
20 | ok( utf8::is_utf8( $cd->title ), 'got title with utf8 flag' ); | |
21 | ok( !utf8::is_utf8( $cd->year ), 'got year without utf8 flag' ); | |
70350518 | 22 | |
23 | my $utf8_char = 'uniuni'; | |
8236f0dc | 24 | utf8::decode($utf8_char); |
404939a4 | 25 | $cd->title($utf8_char); |
8236f0dc | 26 | ok( !utf8::is_utf8( $cd->{_column_data}{title} ), |
404939a4 | 27 | 'store utf8-less chars' ); |
e59c17fe | 28 |