Switch CDBICompat and its tests to OptDeps
[dbsrgits/DBIx-Class.git] / t / cdbi / columns_dont_override_custom_accessors.t
CommitLineData
83eef562 1use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
2
e60dc79f 3use strict;
4a233f30 4use warnings;
83eef562 5
e60dc79f 6use Test::More;
97d61088 7use lib 't/cdbi/testlib';
e60dc79f 8
e60dc79f 9{
10 package Thing;
11
97d61088 12 use base 'DBIC::Test::SQLite';
e60dc79f 13
14 Thing->columns(TEMP => qw[foo bar]);
15 Thing->columns(All => qw[thing_id yarrow flower]);
16 sub foo { 42 }
17 sub yarrow { "hock" }
18}
19
20is_deeply( [sort Thing->columns("TEMP")],
21 [sort qw(foo bar)],
22 "TEMP columns set"
23);
24my $thing = Thing->construct(
25 { thing_id => 23, foo => "this", bar => "that" }
26);
27
28is( $thing->id, 23 );
29is( $thing->yarrow, "hock", 'custom accessor not overwritten by column' );
30is( $thing->foo, 42, 'custom routine not overwritten by temp column' );
31is( $thing->bar, "that", 'temp column accessor generated' );
d9bd5195 32
33done_testing;