12 use base 'DBIx::Class';
13 sub store_column { shift->next::method (@_) };
17 use base 'DBIx::Class::Core';
18 __PACKAGE__->load_components(qw(UTF8Columns +A::Comp));
21 qr/Incorrect loading order of DBIx::Class::UTF8Columns.+affect other components overriding store_column \(A::Comp\)/,
22 'incorrect order warning issued',
25 my $schema = DBICTest->init_schema();
26 DBICTest::Schema::CD->load_components('UTF8Columns');
27 DBICTest::Schema::CD->utf8_columns('title');
28 Class::C3->reinitialize();
30 my $cd = $schema->resultset('CD')->create( { artist => 1, title => "weird\x{466}stuff", year => '2048' } );
32 ok( utf8::is_utf8( $cd->title ), 'got title with utf8 flag' );
33 ok(! utf8::is_utf8( $cd->{_column_data}{title} ), 'store title without utf8' );
35 ok(! utf8::is_utf8( $cd->year ), 'got year without utf8 flag' );
36 ok(! utf8::is_utf8( $cd->{_column_data}{year} ), 'store year without utf8' );
38 $cd->title('nonunicode');
39 ok(! utf8::is_utf8( $cd->title ), 'got title without utf8 flag' );
40 ok(! utf8::is_utf8( $cd->{_column_data}{title} ), 'store utf8-less chars' );
43 my $v_utf8 = "\x{219}";
45 $cd->update ({ title => $v_utf8 });
47 ok( !$cd->is_column_changed('title'), 'column is not dirty after setting the same unicode value' );
49 $cd->update ({ title => $v_utf8 });
50 $cd->title('something_else');
51 ok( $cd->is_column_changed('title'), 'column is dirty after setting to something completely different');
54 local $TODO = 'There is currently no way to propagate aliases to inflate_result()';
55 $cd = $schema->resultset('CD')->find ({ title => $v_utf8 }, { select => 'title', as => 'name' });
56 ok (utf8::is_utf8( $cd->get_column ('name') ), 'utf8 flag propagates via as');