11 use base 'DBIx::Class';
12 sub store_column { shift->next::method (@_) };
26 use base 'DBIx::Class::Core';
27 __PACKAGE__->load_components(qw(Core +A::Comp Ordered UTF8Columns));
28 __PACKAGE__->load_components(qw(Ordered +A::SubComp Row UTF8Columns Core));
29 sub store_column { shift->next::method (@_) };
33 'no spurious warnings issued',
38 for (@{mro::get_linear_isa ('A::Test1')} ) {
39 $test1_mro->{$_} = $idx++;
42 cmp_ok ($test1_mro->{'A::SubComp'}, '<', $test1_mro->{'A::Comp'}, 'mro of Test1 correct (A::SubComp before A::Comp)' );
43 cmp_ok ($test1_mro->{'A::Comp'}, '<', $test1_mro->{'DBIx::Class::UTF8Columns'}, 'mro of Test1 correct (A::Comp before UTF8Col)' );
44 cmp_ok ($test1_mro->{'DBIx::Class::UTF8Columns'}, '<', $test1_mro->{'DBIx::Class::Core'}, 'mro of Test1 correct (UTF8Col before Core)' );
45 cmp_ok ($test1_mro->{'DBIx::Class::Core'}, '<', $test1_mro->{'DBIx::Class::Row'}, 'mro of Test1 correct (Core before Row)' );
51 use base 'DBIx::Class::Core';
52 __PACKAGE__->load_components(qw(UTF8Columns +A::Comp));
53 sub store_column { shift->next::method (@_) };
56 [qr/Incorrect loading order of DBIx::Class::UTF8Columns.+affect other components overriding 'store_column' \(A::Comp\)/],
57 'incorrect order warning issued (violator defines)',
63 use base 'DBIx::Class::Core';
64 __PACKAGE__->load_components(qw(UTF8Columns +A::SubComp));
65 sub store_column { shift->next::method (@_) };
68 [qr/Incorrect loading order of DBIx::Class::UTF8Columns.+affect other components overriding 'store_column' \(A::SubComp \(via A::Comp\)\)/],
69 'incorrect order warning issued (violator inherits)',
72 my $schema = DBICTest->init_schema();
73 DBICTest::Schema::CD->load_components('UTF8Columns');
74 DBICTest::Schema::CD->utf8_columns('title');
75 Class::C3->reinitialize();
77 my $cd = $schema->resultset('CD')->create( { artist => 1, title => "weird\x{466}stuff", year => '2048' } );
79 ok( utf8::is_utf8( $cd->title ), 'got title with utf8 flag' );
80 ok(! utf8::is_utf8( $cd->{_column_data}{title} ), 'store title without utf8' );
82 ok(! utf8::is_utf8( $cd->year ), 'got year without utf8 flag' );
83 ok(! utf8::is_utf8( $cd->{_column_data}{year} ), 'store year without utf8' );
85 $cd->title('nonunicode');
86 ok(! utf8::is_utf8( $cd->title ), 'got title without utf8 flag' );
87 ok(! utf8::is_utf8( $cd->{_column_data}{title} ), 'store utf8-less chars' );
90 my $v_utf8 = "\x{219}";
92 $cd->update ({ title => $v_utf8 });
94 ok( !$cd->is_column_changed('title'), 'column is not dirty after setting the same unicode value' );
96 $cd->update ({ title => $v_utf8 });
97 $cd->title('something_else');
98 ok( $cd->is_column_changed('title'), 'column is dirty after setting to something completely different');
101 local $TODO = 'There is currently no way to propagate aliases to inflate_result()';
102 $cd = $schema->resultset('CD')->find ({ title => $v_utf8 }, { select => 'title', as => 'name' });
103 ok (utf8::is_utf8( $cd->get_column ('name') ), 'utf8 flag propagates via as');