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