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