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 | |
70350518 |
13 | plan tests => 2; |
e59c17fe |
14 | |
70350518 |
15 | DBICTest::Schema::Artist->load_components('UTF8Columns'); |
16 | DBICTest::Schema::Artist->utf8_columns('name'); |
17 | Class::C3->reinitialize(); |
18 | |
19 | my $artist = $schema->resultset("Artist")->create( { name => 'uni' } ); |
20 | ok( Encode::is_utf8( $artist->name ), 'got name with utf8 flag' ); |
21 | |
22 | my $utf8_char = 'uniuni'; |
23 | Encode::_utf8_on($utf8_char); |
24 | $artist->name($utf8_char); |
25 | ok( !Encode::is_utf8( $artist->{_column_data}->{name} ), |
26 | 'store utf8 less chars' ); |
e59c17fe |
27 | |