11 use base 'DBIx::Class';
12 sub store_column { shift->next::method (@_) };
25 use base 'DBIx::Class::Core';
26 __PACKAGE__->load_components(qw(UTF8Columns +A::SubComp +A::Comp));
29 [qr/Incorrect loading order of DBIx::Class::UTF8Columns.+affect other components overriding store_column \(A::Comp\)/],
30 'incorrect order warning issued',
36 use base 'DBIx::Class::Core';
37 __PACKAGE__->load_components(qw(Core +A::Comp Ordered UTF8Columns));
38 __PACKAGE__->load_components(qw(Ordered +A::Comp Row UTF8Columns Core));
42 'no spurious warnings issued',
47 for (@{mro::get_linear_isa ('A::Test2')} ) {
48 $test2_mro->{$_} = $idx++;
51 cmp_ok ($test2_mro->{'A::Comp'}, '<', $test2_mro->{'DBIx::Class::UTF8Columns'}, 'mro of Test2 correct (A::Comp before UTF8Col)' );
52 cmp_ok ($test2_mro->{'DBIx::Class::UTF8Columns'}, '<', $test2_mro->{'DBIx::Class::Core'}, 'mro of Test2 correct (UTF8Col before Core)' );
53 cmp_ok ($test2_mro->{'DBIx::Class::Core'}, '<', $test2_mro->{'DBIx::Class::Row'}, 'mro of Test2 correct (Core before Row)' );
55 my $schema = DBICTest->init_schema();
56 DBICTest::Schema::CD->load_components('UTF8Columns');
57 DBICTest::Schema::CD->utf8_columns('title');
58 Class::C3->reinitialize();
60 my $cd = $schema->resultset('CD')->create( { artist => 1, title => "weird\x{466}stuff", year => '2048' } );
62 ok( utf8::is_utf8( $cd->title ), 'got title with utf8 flag' );
63 ok(! utf8::is_utf8( $cd->{_column_data}{title} ), 'store title without utf8' );
65 ok(! utf8::is_utf8( $cd->year ), 'got year without utf8 flag' );
66 ok(! utf8::is_utf8( $cd->{_column_data}{year} ), 'store year without utf8' );
68 $cd->title('nonunicode');
69 ok(! utf8::is_utf8( $cd->title ), 'got title without utf8 flag' );
70 ok(! utf8::is_utf8( $cd->{_column_data}{title} ), 'store utf8-less chars' );
73 my $v_utf8 = "\x{219}";
75 $cd->update ({ title => $v_utf8 });
77 ok( !$cd->is_column_changed('title'), 'column is not dirty after setting the same unicode value' );
79 $cd->update ({ title => $v_utf8 });
80 $cd->title('something_else');
81 ok( $cd->is_column_changed('title'), 'column is dirty after setting to something completely different');
84 local $TODO = 'There is currently no way to propagate aliases to inflate_result()';
85 $cd = $schema->resultset('CD')->find ({ title => $v_utf8 }, { select => 'title', as => 'name' });
86 ok (utf8::is_utf8( $cd->get_column ('name') ), 'utf8 flag propagates via as');