Commit | Line | Data |
e60dc79f |
1 | use strict; |
2 | use Test::More; |
97d61088 |
3 | use 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 | |
16 | is_deeply( [sort Thing->columns("TEMP")], |
17 | [sort qw(foo bar)], |
18 | "TEMP columns set" |
19 | ); |
20 | my $thing = Thing->construct( |
21 | { thing_id => 23, foo => "this", bar => "that" } |
22 | ); |
23 | |
24 | is( $thing->id, 23 ); |
25 | is( $thing->yarrow, "hock", 'custom accessor not overwritten by column' ); |
26 | is( $thing->foo, 42, 'custom routine not overwritten by temp column' ); |
27 | is( $thing->bar, "that", 'temp column accessor generated' ); |
d9bd5195 |
28 | |
29 | done_testing; |