13 use base 'DBIx::Class';
14 sub store_column { shift->next::method (@_) };
18 use base 'DBIx::Class::Core';
19 __PACKAGE__->load_components(qw(UTF8Columns +A::Comp));
21 }, qr/Incorrect loading order of DBIx::Class::UTF8Columns/ );
24 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 => 'øni', year => '2048' } );
31 my $utf8_char = 'uniuni';
34 ok( utf8::is_utf8( $cd->title ), 'got title with utf8 flag' );
35 ok(! utf8::is_utf8( $cd->year ), 'got year without utf8 flag' );
37 utf8::decode($utf8_char);
38 $cd->title($utf8_char);
39 ok(! utf8::is_utf8( $cd->{_column_data}{title} ), 'store utf8-less chars' );
42 my $v_utf8 = "\x{219}";
44 $cd->update ({ title => $v_utf8 });
46 ok( !$cd->is_column_changed('title'), 'column is not dirty after setting the same unicode value' );
48 $cd->update ({ title => $v_utf8 });
49 $cd->title('something_else');
50 ok( $cd->is_column_changed('title'), 'column is dirty after setting to something completely different');
53 local $TODO = 'There is currently no way to propagate aliases to inflate_result()';
54 $cd = $schema->resultset('CD')->find ({ title => $v_utf8 }, { select => 'title', as => 'name' });
55 ok (utf8::is_utf8( $cd->get_column ('name') ), 'utf8 flag propagates via as');